Versions in this module Expand all Collapse all v0 v0.1.0 Oct 26, 2024 Changes in this version + var Assets embed.FS + var AuthConfigInfo = fs.Options + var ConfigInfo = fs.Options + var ErrInvalidMinTLSVersion = errors.New("invalid value for --min-tls-version") + var ErrTLSBodyMismatch = errors.New("need both TLSCertBody and TLSKeyBody to use TLS") + var ErrTLSFileMismatch = errors.New("need both --cert and --key to use TLS") + var ErrTLSParseCA = errors.New("unable to parse client certificate authority") + var TemplateConfigInfo = fs.Options + func AddAuthFlagsPrefix(flagSet *pflag.FlagSet, prefix string, cfg *AuthConfig) + func AddHTTPFlagsPrefix(flagSet *pflag.FlagSet, prefix string, cfg *Config) + func AddTemplateFlagsPrefix(flagSet *pflag.FlagSet, prefix string, cfg *TemplateConfig) + func AfterEpoch(t time.Time) bool + func AuthHelp(prefix string) string + func CtxGetAuth(ctx context.Context) interface + func CtxGetUser(ctx context.Context) (string, bool) + func CtxSetUser(ctx context.Context, value string) context.Context + func GetTemplate(tmpl string) (*template.Template, error) + func Help(prefix string) string + func IsAuthenticated(r *http.Request) bool + func NewBaseContext(ctx context.Context, url string) func(l net.Listener) context.Context + func PublicURL(r *http.Request) string + func TemplateHelp(prefix string) string + type AuthConfig struct + BasicPass string + BasicUser string + CustomAuthFn CustomAuthFn + HtPasswd string + Realm string + Salt string + func DefaultAuthCfg() AuthConfig + func (cfg *AuthConfig) AddFlagsPrefix(flagSet *pflag.FlagSet, prefix string) + type Config struct + AllowOrigin string + BaseURL string + ClientCA string + ListenAddr []string + MaxHeaderBytes int + MinTLSVersion string + ServerReadTimeout time.Duration + ServerWriteTimeout time.Duration + TLSCert string + TLSCertBody []byte + TLSKey string + TLSKeyBody []byte + func DefaultCfg() Config + func (cfg *Config) AddFlagsPrefix(flagSet *pflag.FlagSet, prefix string) + type CustomAuthFn func(user, pass string) (value interface{}, err error) + type LoggedBasicAuth struct + func NewLoggedBasicAuthenticator(realm string, secrets goauth.SecretProvider) *LoggedBasicAuth + func (a *LoggedBasicAuth) CheckAuth(r *http.Request) string + type Middleware func(http.Handler) http.Handler + func MiddlewareAuthBasic(user, pass, realm, salt string) Middleware + func MiddlewareAuthCertificateUser() Middleware + func MiddlewareAuthCustom(fn CustomAuthFn, realm string, userFromContext bool) Middleware + func MiddlewareAuthHtpasswd(path, realm string) Middleware + func MiddlewareCORS(allowOrigin string) Middleware + func MiddlewareStripPrefix(prefix string) Middleware + type Option func(*Server) + func WithAuth(cfg AuthConfig) Option + func WithConfig(cfg Config) Option + func WithTemplate(cfg TemplateConfig) Option + type Server struct + func NewServer(ctx context.Context, options ...Option) (*Server, error) + func (s *Server) HTMLTemplate() *template.Template + func (s *Server) Router() chi.Router + func (s *Server) Serve() + func (s *Server) Shutdown() error + func (s *Server) URLs() []string + func (s *Server) UsingAuth() bool + func (s *Server) Wait() + type TemplateConfig struct + Path string + func DefaultTemplateCfg() TemplateConfig + func (cfg *TemplateConfig) AddFlagsPrefix(flagSet *pflag.FlagSet, prefix string)