28 lines
571 B
Go
28 lines
571 B
Go
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
type AuthMux struct {
|
|
mux *http.ServeMux
|
|
}
|
|
|
|
func NewAuthMux() *AuthMux {
|
|
return &(AuthMux{
|
|
mux: http.NewServeMux(),
|
|
})
|
|
}
|
|
|
|
func (authMux *AuthMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
authMux.mux.ServeHTTP(w, r)
|
|
}
|
|
|
|
func (authMux *AuthMux) PublicHandleFunc(pattern string, handlerFunc func(http.ResponseWriter, *http.Request)) {
|
|
authMux.mux.HandleFunc(pattern, handlerFunc)
|
|
}
|
|
|
|
func (authMux *AuthMux) PublicHandle(pattern string, handler http.Handler) {
|
|
authMux.mux.Handle(pattern, handler)
|
|
}
|