Documentation ¶
Index ¶
- Constants
- func NewDemuxer(handlers map[string]http.Handler, rootHandler http.Handler) *demuxer
- func NewHostsFinder(configGateways []config.GatewayConfig) (*hostsFinder, error)
- func NewRequestsProcessor(hostFinder HostFinder) (*requestsProcessor, error)
- func RespondWithError(writer http.ResponseWriter, err error, statusCode int)
- type GenericAPIResponse
- type HostFinder
- type ReturnCode
Constants ¶
const UrlParameterBlockNonce = "blockNonce"
UrlParameterBlockNonce represents the name of a URL parameter
const UrlParameterHintEpoch = "hintEpoch"
UrlParameterHintEpoch represents the name of a URL parameter
Variables ¶
This section is empty.
Functions ¶
func NewDemuxer ¶ added in v1.0.1
NewDemuxer can create a demuxer able to call different http handlers based on the request.RequestURI. the default handler should be registered with the * key
func NewHostsFinder ¶
func NewHostsFinder(configGateways []config.GatewayConfig) (*hostsFinder, error)
NewHostsFinder will create a new hosts finder instance
func NewRequestsProcessor ¶
func NewRequestsProcessor(hostFinder HostFinder) (*requestsProcessor, error)
NewRequestsProcessor creates a new requests processor
func RespondWithError ¶
func RespondWithError(writer http.ResponseWriter, err error, statusCode int)
RespondWithError should be called when the request cannot be satisfied due to an internal error
Types ¶
type GenericAPIResponse ¶
type GenericAPIResponse struct { Data interface{} `json:"data"` Error string `json:"error"` Code ReturnCode `json:"code"` }
GenericAPIResponse defines the structure of all responses on API endpoints
type HostFinder ¶
type HostFinder interface { FindHost(urlValues map[string][]string) (config.GatewayConfig, error) IsInterfaceNil() bool }
HostFinder is able to return a valid host based on a search criteria
type ReturnCode ¶
type ReturnCode string
ReturnCode defines the type defines to identify return codes
const ( // ReturnCodeRequestError defines a request which hasn't been executed successfully due to a bad request received ReturnCodeRequestError ReturnCode = "bad_request" )