Documentation
¶
Index ¶
- Constants
- func Service(configurators ...Configurator) host.Configurator
- type Config
- type Configurator
- type EndpointConfig
- type EndpointConfigurator
- func AddSlash() EndpointConfigurator
- func BodyLimit(limit int64) EndpointConfigurator
- func Domains(domains ...string) EndpointConfigurator
- func EnableWebsockets() EndpointConfigurator
- func HTTPS(httpsMode HTTPSMode) EndpointConfigurator
- func Methods(methods ...string) EndpointConfigurator
- func Path(path string) EndpointConfigurator
- func PlainBindings(bindings ...string) EndpointConfigurator
- func RemoveWWW() EndpointConfigurator
- func TLSBindings(bindings ...string) EndpointConfigurator
- type EndpointID
- type HTTPIngress
- type HTTPSMode
- type TargetConfig
Constants ¶
const ( // PortHTTP is the port for http traffic. PortHTTP = 80 // PortHTTPS is the port for https traffic. PortHTTPS = 443 )
Variables ¶
This section is empty.
Functions ¶
func Service ¶
func Service(configurators ...Configurator) host.Configurator
Service returns ingress service.
Types ¶
type Config ¶
type Config struct {
// WaveServers are addresses of wave servers.
WaveServers []string
// Targets defines target registrations for endpoint.
Targets map[EndpointID][]TargetConfig
// Endpoints defines HTTP endpoints inside HTTPIngress.
Endpoints map[EndpointID]EndpointConfig
}
Config defines configuration of HTTP HTTPIngress.
type Configurator ¶
type Configurator func(c *Config)
Configurator is the function configuring ingress.
func Endpoint ¶
func Endpoint(endpointID EndpointID, configurators ...EndpointConfigurator) Configurator
Endpoint adds endpoint to the ingress.
func Target ¶
func Target(endpointID EndpointID, host string, port uint16, path string) Configurator
Target adds target for an endpoint.
func Waves ¶
func Waves(waves ...string) Configurator
Waves adds wave servers to send challenge requests to.
type EndpointConfig ¶
type EndpointConfig struct {
// Path is a prefix service is available under.
Path string
// HTTPSMode defines how https traffic is handled.
HTTPSMode HTTPSMode
// PlainBindings specify endpoints in form <ip>:<port> which HTTPIngress binds to for http traffic.
PlainBindings []string
// TLSBindings specify endpoints in form <ip>:<port> which HTTPIngress binds to for https traffic.
TLSBindings []string
// AllowedDomains are domains requests are accepted for.
AllowedDomains []string
// AllowedMethods are allowed http methods.
AllowedMethods []string
// AllowWebsockets enables websocket connections.
AllowWebsockets bool
// MaxBodyLength defines maximum size of request body.
MaxBodyLength int64
// RemoveWWWPrefix causes redirection to URL with `www.` prefix removed.
RemoveWWWPrefix bool
// AddSlashToDirs redirects to the path with slash (/) added at the end if there is no dot (.) in last segment.
AddSlashToDirs bool
}
EndpointConfig describes configuration of http HTTPIngress endpoint.
type EndpointConfigurator ¶
type EndpointConfigurator func(c *EndpointConfig)
EndpointConfigurator is the function configuring endpoint.
func AddSlash ¶
func AddSlash() EndpointConfigurator
AddSlash causes redirection to slash-suffixed URL if URL does not end with slash or dotted (.sth) suffix.
func BodyLimit ¶
func BodyLimit(limit int64) EndpointConfigurator
BodyLimit sets the maximum allowed size of the request body in bytes. Requests exceeding this limit will be rejected.
func EnableWebsockets ¶
func EnableWebsockets() EndpointConfigurator
EnableWebsockets enables websockets.
func HTTPS ¶
func HTTPS(httpsMode HTTPSMode) EndpointConfigurator
HTTPS configures mode of https operation.
func Methods ¶
func Methods(methods ...string) EndpointConfigurator
Methods sets serviced HTTP methods.
func PlainBindings ¶
func PlainBindings(bindings ...string) EndpointConfigurator
PlainBindings configures socket bindings for HTTP.
func RemoveWWW ¶
func RemoveWWW() EndpointConfigurator
RemoveWWW causes redirection of www.* domains to non-www ones.
func TLSBindings ¶
func TLSBindings(bindings ...string) EndpointConfigurator
TLSBindings configures socket bindings for HTTPS.
type HTTPIngress ¶
type HTTPIngress struct {
// contains filtered or unexported fields
}
HTTPIngress is the http ingress.
type HTTPSMode ¶
type HTTPSMode string
HTTPSMode defines how https traffic is handled by http HTTPIngress endpoint.
const ( // HTTPSModeDisabled causes HTTPIngress to work in http mode only. HTTPSModeDisabled HTTPSMode = "disabled" // HTTPSModeOptional causes HTTPIngress to work in both http and https modes. HTTPSModeOptional HTTPSMode = "optional" // HTTPSModeRedirect causes HTTPIngress to redirect client from http to https. HTTPSModeRedirect HTTPSMode = "redirect" // HTTPSModeOnly causes HTTPIngress to run only https endpoint, http just won't respond at all. HTTPSModeOnly HTTPSMode = "only" )
type TargetConfig ¶
TargetConfig represents target registration.