Documentation ¶
Index ¶
- func ToHandlerName(h interface{}) string
- func URLFromID(id string) string
- type Client
- func (c *Client) CreateHTTP(http HTTP) error
- func (c *Client) CreateServer(name string, server Server) (string, error)
- func (c *Client) DeleteHTTP() error
- func (c *Client) DeleteServer(id string) error
- func (c *Client) EnforceExists(id string) error
- func (c *Client) GetHTTP() (*HTTP, error)
- func (c *Client) GetServer(id string) (*Server, error)
- func (c *Client) UpdateHTTPGracePeriod(gracePeriod Duration) error
- func (c *Client) UpdateHTTPPort(httpPort int) error
- func (c *Client) UpdateHTTPSPort(httpsPort int) error
- func (c *Client) UpdateServerListen(id string, listen []string) error
- func (c *Client) UpdateServerRoutes(id string, routes []Route) error
- type DialFunc
- type Duration
- type FileServer
- type HTTP
- type HandleMarshal
- type Match
- type RequestBody
- type ReverseProxy
- type Route
- type Server
- type ServerErrors
- type ServerLogging
- type StaticResponse
- type StatusError
- type Subroute
- type Templates
- type Upstream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToHandlerName ¶ added in v0.2.7
func ToHandlerName(h interface{}) string
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a Caddy API Client
func NewUnixClient ¶ added in v0.2.6
func (*Client) CreateHTTP ¶
CreateHTTP creates a new http app
func (*Client) CreateServer ¶
CreateServer creates a http server
func (*Client) DeleteHTTP ¶
func (*Client) DeleteServer ¶
func (*Client) EnforceExists ¶
EnforceExists ensures that the path exists. If it doesn't currently exist, it sets it to be empty
func (*Client) UpdateHTTPGracePeriod ¶
func (*Client) UpdateHTTPPort ¶
func (*Client) UpdateHTTPSPort ¶
func (*Client) UpdateServerListen ¶
type Duration ¶
Duration is a wrapper around time.Duration with appropriate text unmarshal func
func (*Duration) UnmarshalText ¶
UnmarshalText converts `3.5s` and similar strings into the correct duration value
type FileServer ¶ added in v0.2.7
type HTTP ¶
type HTTP struct { HTTPPort int `json:"http_port"` HTTPSPort int `json:"https_port"` GracePeriod Duration `json:"grace_period"` }
HTTP is the representation of the Caddy HTTP App
type HandleMarshal ¶ added in v0.2.7
type HandleMarshal struct {
Handle interface{}
}
func (*HandleMarshal) FromHandlerName ¶ added in v0.2.7
func (s *HandleMarshal) FromHandlerName(h string, b []byte) error
func (HandleMarshal) MarshalJSON ¶ added in v0.2.7
func (s HandleMarshal) MarshalJSON() ([]byte, error)
func (*HandleMarshal) UnmarshalJSON ¶ added in v0.2.7
func (s *HandleMarshal) UnmarshalJSON(b []byte) error
type Match ¶
type Match struct { ID string `json:"@id,omitempty"` Host []string `json:"host,omitempty"` Path []string `json:"path,omitempty"` Method []string `json:"method,omitempty"` Header map[string][]string `json:"header,omitempty"` Query map[string][]string `json:"query,omitempty"` Not []Match `json:"not,omitempty"` }
Match represents the Caddy Match object https://caddyserver.com/docs/json/apps/http/servers/routes/match/
type RequestBody ¶ added in v0.2.7
type RequestBody struct {
MaxSize int `json:"max_size"`
}
type ReverseProxy ¶ added in v0.2.7
type ReverseProxy struct {
Upstreams []Upstream `json:"upstreams"`
}
type Route ¶
type Route struct { ID string `json:"@id,omitempty"` Group string `json:"group,omitempty"` Matchers []Match `json:"match,omitempty"` Handlers []HandleMarshal `json:"handle,omitempty"` Terminal bool `json:"terminal,omitempty"` }
Route represents the Caddy Route object https://caddyserver.com/docs/json/apps/http/servers/routes/
type Server ¶
type Server struct { ID string `json:"@id,omitempty"` Listen []string `json:"listen"` Routes []Route `json:"routes"` Errors *ServerErrors `json:"errors"` Logs *ServerLogging `json:"logs"` }
Server represents the Caddy Server object https://caddyserver.com/docs/json/apps/http/servers/
type ServerErrors ¶ added in v0.2.5
type ServerErrors struct {
Routes []Route `json:"routes,omitempty"`
}
type ServerLogging ¶ added in v0.2.5
type StaticResponse ¶ added in v0.2.7
type StatusError ¶
type StatusError struct {
// contains filtered or unexported fields
}
StatusError is the error returned when Request responds with non-2XX
func (StatusError) Error ¶
func (s StatusError) Error() string
type Subroute ¶ added in v0.2.7
type Subroute struct { Routes []Route `json:"routes"` Errors *ServerErrors `json:"errors"` }