Documentation ¶
Index ¶
- Constants
- type APIError
- type APIErrorType
- type CreateMountIn
- type CreateRandomServerIn
- type CreateServerIn
- type Event
- type EventType
- type FileServeEvent
- type FsParams
- type GorillaRouter
- func (gr *GorillaRouter) GetRouteParam(r *http.Request, name string) string
- func (gr *GorillaRouter) RegisterHandler(routeName string, handler http.Handler)
- func (gr *GorillaRouter) RegisterRoute(path string, name string)
- func (gr *GorillaRouter) ReverseRoute(name string, params ...string) *url.URL
- func (gr *GorillaRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type HTTPDecoder
- type HTTPEncoder
- type HandlerRegisterer
- type JSONCodec
- type MethodHandler
- type Mount
- type MountEvent
- type RouteEvents
- type RouteFileservers
- type RouteLocation
- type RouteParamGetter
- type RouteRegisterer
- type RouteReverser
- type RouteServers
- type RouteServersOne
- type RouteServersOneMounts
- type RouteServersOneMountsOne
- type Server
- type ServerEvent
- type ServerPoolHandler
Constants ¶
const EventsQueryKey = "e"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct { Type APIErrorType `json:"type"` Msg string `json:"msg"` }
type APIErrorType ¶
type APIErrorType string
type CreateMountIn ¶
type CreateRandomServerIn ¶
type CreateRandomServerIn struct {
BindAddress string `json:"bind_address"`
}
type CreateServerIn ¶
type CreateServerIn struct {
BindAddress string `json:"bind_address"`
}
type Event ¶
type Event struct { Type EventType Resource interface{} }
func (*Event) UnmarshalJSON ¶
type FileServeEvent ¶
type FsParams ¶
type FsParams fileserver.Params
type GorillaRouter ¶
func (*GorillaRouter) GetRouteParam ¶
func (gr *GorillaRouter) GetRouteParam(r *http.Request, name string) string
func (*GorillaRouter) RegisterHandler ¶
func (gr *GorillaRouter) RegisterHandler(routeName string, handler http.Handler)
func (*GorillaRouter) RegisterRoute ¶
func (gr *GorillaRouter) RegisterRoute(path string, name string)
func (*GorillaRouter) ReverseRoute ¶
func (gr *GorillaRouter) ReverseRoute(name string, params ...string) *url.URL
func (*GorillaRouter) ServeHTTP ¶
func (gr *GorillaRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HTTPDecoder ¶
type HTTPDecoder interface {
Decode(http.ResponseWriter, *http.Request, interface{}) error
}
HTTPDecoder is the interface implemented by objects that can decode data received from a http request.
Implementors have to close the request.Body. Decode() shouldn't write to http.ResponseWriter: it's up to the caller to e.g, handle errors.
type HTTPEncoder ¶
type HTTPEncoder interface {
Encode(w http.ResponseWriter, r *http.Request, data interface{}, code int) error
}
HTTPEncoder is the interface implemented by objects that can encode values to a http response, with the specified http status.
Implementors must handle nil data.
type HandlerRegisterer ¶
HandlerRegisterer is the interface implemented by objects that can register a http handler for an http route.
type MethodHandler ¶
MethodHandler is an http.Handler that dispatches to a handler whose field name matches the name of the HTTP request's method, eg: GET
If the request's method is OPTIONS and Options is not set, then the handler responds with a status of 200 and sets the Allow header to a comma-separated list of available methods.
If the request's method has no handler for it, the MethodHandler responds with a status of 405, Method not allowed and sets the Allow header to a comma-separated list of available methods.
func (MethodHandler) ServeHTTP ¶
func (h MethodHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type MountEvent ¶
type RouteEvents ¶
type RouteEvents struct{}
func (RouteEvents) Location ¶
func (r RouteEvents) Location(rr RouteReverser) *url.URL
type RouteFileservers ¶
type RouteFileservers struct{}
func (RouteFileservers) Location ¶
func (r RouteFileservers) Location(rr RouteReverser) *url.URL
type RouteLocation ¶
type RouteLocation interface {
Location(RouteReverser) *url.URL
}
RouteLocation is the interface implemented by objects that can return an url for a route, using a RouteReverser.
type RouteParamGetter ¶
RouteParamGetter is the interface implemented by objects that can retrieve the value of a parameter of a route, by name.
type RouteRegisterer ¶
RouteRegisterer is the interface implemented by objects that can register a name for a route path.
type RouteReverser ¶
RouteReverser is the interface implemented by objects that can retrieve the url of a route based on its registered name and the route param names and values.
func NewServerPoolRoutes ¶
func NewServerPoolRoutes(baseURL *url.URL) RouteReverser
type RouteServers ¶
type RouteServers struct{}
func (RouteServers) Location ¶
func (r RouteServers) Location(rr RouteReverser) *url.URL
type RouteServersOne ¶
type RouteServersOne struct {
ServerPort string
}
func (RouteServersOne) Location ¶
func (r RouteServersOne) Location(rr RouteReverser) *url.URL
type RouteServersOneMounts ¶
type RouteServersOneMounts struct {
ServerPort string
}
func (RouteServersOneMounts) Location ¶
func (r RouteServersOneMounts) Location(rr RouteReverser) *url.URL
type RouteServersOneMountsOne ¶
func (RouteServersOneMountsOne) Location ¶
func (r RouteServersOneMountsOne) Location(rr RouteReverser) *url.URL
type ServerEvent ¶
type ServerEvent struct {
Server Server `json:"server"`
}
type ServerPoolHandler ¶
type ServerPoolHandler struct { *kraken.ServerPool Log *log.Logger // contains filtered or unexported fields }
func NewServerPoolHandler ¶
func NewServerPoolHandler(serverPool *kraken.ServerPool, baseURL *url.URL) *ServerPoolHandler
func (*ServerPoolHandler) BaseURL ¶
func (sph *ServerPoolHandler) BaseURL() *url.URL
func (*ServerPoolHandler) ServeHTTP ¶
func (sph *ServerPoolHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)