Documentation ¶
Index ¶
- func ExtractTokenFromRequest(r *http.Request) (string, bool)
- func JSONResponse(w http.ResponseWriter, closure func() (interface{}, error))
- func WriteData(w http.ResponseWriter, data []byte)
- func WriteJsonError(w http.ResponseWriter, err error)
- type DomainConfig
- type Issuer
- type IssuerOpts
- type Middleware
- type Option
- type SSLConfig
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JSONResponse ¶
func JSONResponse(w http.ResponseWriter, closure func() (interface{}, error))
JSONResponse calls the closure and respond with data or error. If no error, but the interface is nil it will write "OK" to the response writer.
func WriteData ¶
func WriteData(w http.ResponseWriter, data []byte)
func WriteJsonError ¶
func WriteJsonError(w http.ResponseWriter, err error)
Types ¶
type DomainConfig ¶
type DomainConfig struct { Mode string `yaml:"mode" valid:"required"` Name string `yaml:"name" valid:"dns,required"` IssueSSL bool `yaml:"issue_ssl,omitempty"` Schema string `yaml:"schema,omitempty"` // Dir to store cached certificates, use sub-directory of cfgDir if possible. Dir string `yaml:"dir,omitempty" valid:"path"` }
DomainConfig is the YAML version of the `adminAPI.DomainConfig` struct.
func (*DomainConfig) Validate ¶
func (c *DomainConfig) Validate() error
type Issuer ¶
type Issuer struct {
// contains filtered or unexported fields
}
Issuer should be named like certManager
func NewIssuer ¶
func NewIssuer(opts IssuerOpts) (*Issuer, error)
type IssuerOpts ¶
type Option ¶
type Option func(w *Server)
func WithLogger ¶
func WithLogger() Option
func WithMetrics ¶
func WithMetrics() Option
func WithMiddleware ¶
func WithMiddleware(mw Middleware) Option
type SSLConfig ¶
type SSLConfig struct { // ListenAddr for HTTPS server, default: ":443" ListenAddr string `yaml:"listen_addr" valid:"listen_addr,required"` }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewDefault ¶
func NewDefault() *Server
func NewDefaultSSL ¶
func NewRedirectToSSL ¶
func (*Server) Router ¶
func (w *Server) Router() chi.Router
Router exposes chi.Router for the external registration of handlers. usage:
h.Router().Get("/apt/path", myHandler) h.Router().Post("/apt/verb", myOtherHandler)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.