Documentation
¶
Overview ¶
Package intermediate serves as the foundation of the http.ingress.core microservice.
The HTTP ingress microservice relays incoming HTTP requests to the NATS bus.
Index ¶
- type Intermediate
- func (svc *Intermediate) AllowedOrigins() (origins string)
- func (svc *Intermediate) BlockedPaths() (blockedPaths string)
- func (svc *Intermediate) PortMappings() (mappings string)
- func (svc *Intermediate) Ports() (port string)
- func (svc *Intermediate) ReadHeaderTimeout() (timeout time.Duration)
- func (svc *Intermediate) ReadTimeout() (timeout time.Duration)
- func (svc *Intermediate) RequestMemoryLimit() (megaBytes int)
- func (svc *Intermediate) ServerLanguages() (languages string)
- func (svc *Intermediate) SetAllowedOrigins(origins string) error
- func (svc *Intermediate) SetBlockedPaths(blockedPaths string) error
- func (svc *Intermediate) SetPortMappings(mappings string) error
- func (svc *Intermediate) SetPorts(port string) error
- func (svc *Intermediate) SetReadHeaderTimeout(timeout time.Duration) error
- func (svc *Intermediate) SetReadTimeout(timeout time.Duration) error
- func (svc *Intermediate) SetRequestMemoryLimit(megaBytes int) error
- func (svc *Intermediate) SetServerLanguages(languages string) error
- func (svc *Intermediate) SetTimeBudget(budget time.Duration) error
- func (svc *Intermediate) SetWriteTimeout(timeout time.Duration) error
- func (svc *Intermediate) TimeBudget() (budget time.Duration)
- func (svc *Intermediate) WriteTimeout() (timeout time.Duration)
- type Mock
- func (svc *Mock) OnChangedAllowedOrigins(ctx context.Context) (err error)
- func (svc *Mock) OnChangedBlockedPaths(ctx context.Context) (err error)
- func (svc *Mock) OnChangedPortMappings(ctx context.Context) (err error)
- func (svc *Mock) OnChangedPorts(ctx context.Context) (err error)
- func (svc *Mock) OnChangedReadHeaderTimeout(ctx context.Context) (err error)
- func (svc *Mock) OnChangedReadTimeout(ctx context.Context) (err error)
- func (svc *Mock) OnChangedServerLanguages(ctx context.Context) (err error)
- func (svc *Mock) OnChangedWriteTimeout(ctx context.Context) (err error)
- func (svc *Mock) OnShutdown(ctx context.Context) (err error)
- func (svc *Mock) OnStartup(ctx context.Context) (err error)
- type ToDo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Intermediate ¶
Intermediate extends and customizes the generic base connector. Code generated microservices then extend the intermediate.
func NewService ¶
func NewService(impl ToDo, version int) *Intermediate
NewService creates a new intermediate service.
func (*Intermediate) AllowedOrigins ¶
func (svc *Intermediate) AllowedOrigins() (origins string)
AllowedOrigins is a comma-separated list of CORS origins to allow requests from. The * origin can be used to allow CORS request from all origins.
func (*Intermediate) BlockedPaths ¶
func (svc *Intermediate) BlockedPaths() (blockedPaths string)
A newline-separated list of paths or extensions to block with a 404. Paths should not include any arguments and are matched exactly. Extensions are specified with "*.ext" and are matched against the extension of the path only.
func (*Intermediate) PortMappings ¶
func (svc *Intermediate) PortMappings() (mappings string)
PortMappings is a comma-separated list of mappings in the form x:y->z where x is the inbound HTTP port, y is the requested NATS port, and z is the port to serve. An HTTP request https://ingresshost:x/servicehost:y/path is mapped to internal NATS request https://servicehost:z/path . Both x and y can be * to indicate all ports. Setting z to * indicates to serve the requested port y without change. Specific rules take precedence over * rules. The default mapping grants access to all internal ports via HTTP port 8080 but restricts HTTP ports 443 and 80 to only internal port 443.
func (*Intermediate) Ports ¶
func (svc *Intermediate) Ports() (port string)
Ports is a comma-separated list of HTTP ports on which to listen for requests.
func (*Intermediate) ReadHeaderTimeout ¶
func (svc *Intermediate) ReadHeaderTimeout() (timeout time.Duration)
ReadHeaderTimeout specifies the timeout for fully reading the header of a request.
func (*Intermediate) ReadTimeout ¶
func (svc *Intermediate) ReadTimeout() (timeout time.Duration)
ReadTimeout specifies the timeout for fully reading a request.
func (*Intermediate) RequestMemoryLimit ¶
func (svc *Intermediate) RequestMemoryLimit() (megaBytes int)
RequestMemoryLimit is the memory capacity used to hold pending requests, in megabytes.
func (*Intermediate) ServerLanguages ¶
func (svc *Intermediate) ServerLanguages() (languages string)
ServerLanguages is a comma-separated list of languages that the server supports. This list is matched against the Accept-Language header of the request.
func (*Intermediate) SetAllowedOrigins ¶
func (svc *Intermediate) SetAllowedOrigins(origins string) error
SetAllowedOrigins sets the value of the configuration property.
AllowedOrigins is a comma-separated list of CORS origins to allow requests from. The * origin can be used to allow CORS request from all origins.
func (*Intermediate) SetBlockedPaths ¶
func (svc *Intermediate) SetBlockedPaths(blockedPaths string) error
SetBlockedPaths sets the value of the configuration property.
A newline-separated list of paths or extensions to block with a 404. Paths should not include any arguments and are matched exactly. Extensions are specified with "*.ext" and are matched against the extension of the path only.
func (*Intermediate) SetPortMappings ¶
func (svc *Intermediate) SetPortMappings(mappings string) error
SetPortMappings sets the value of the configuration property.
PortMappings is a comma-separated list of mappings in the form x:y->z where x is the inbound HTTP port, y is the requested NATS port, and z is the port to serve. An HTTP request https://ingresshost:x/servicehost:y/path is mapped to internal NATS request https://servicehost:z/path . Both x and y can be * to indicate all ports. Setting z to * indicates to serve the requested port y without change. Specific rules take precedence over * rules. The default mapping grants access to all internal ports via HTTP port 8080 but restricts HTTP ports 443 and 80 to only internal port 443.
func (*Intermediate) SetPorts ¶
func (svc *Intermediate) SetPorts(port string) error
SetPorts sets the value of the configuration property.
Ports is a comma-separated list of HTTP ports on which to listen for requests.
func (*Intermediate) SetReadHeaderTimeout ¶
func (svc *Intermediate) SetReadHeaderTimeout(timeout time.Duration) error
SetReadHeaderTimeout sets the value of the configuration property.
ReadHeaderTimeout specifies the timeout for fully reading the header of a request.
func (*Intermediate) SetReadTimeout ¶
func (svc *Intermediate) SetReadTimeout(timeout time.Duration) error
SetReadTimeout sets the value of the configuration property.
ReadTimeout specifies the timeout for fully reading a request.
func (*Intermediate) SetRequestMemoryLimit ¶
func (svc *Intermediate) SetRequestMemoryLimit(megaBytes int) error
SetRequestMemoryLimit sets the value of the configuration property.
RequestMemoryLimit is the memory capacity used to hold pending requests, in megabytes.
func (*Intermediate) SetServerLanguages ¶
func (svc *Intermediate) SetServerLanguages(languages string) error
SetServerLanguages sets the value of the configuration property.
ServerLanguages is a comma-separated list of languages that the server supports. This list is matched against the Accept-Language header of the request.
func (*Intermediate) SetTimeBudget ¶
func (svc *Intermediate) SetTimeBudget(budget time.Duration) error
SetTimeBudget sets the value of the configuration property.
TimeBudget specifies the timeout for handling a request, after it has been read. A value of 0 or less indicates no time budget.
func (*Intermediate) SetWriteTimeout ¶
func (svc *Intermediate) SetWriteTimeout(timeout time.Duration) error
SetWriteTimeout sets the value of the configuration property.
WriteTimeout specifies the timeout for fully writing the response to a request.
func (*Intermediate) TimeBudget ¶
func (svc *Intermediate) TimeBudget() (budget time.Duration)
TimeBudget specifies the timeout for handling a request, after it has been read. A value of 0 or less indicates no time budget.
func (*Intermediate) WriteTimeout ¶
func (svc *Intermediate) WriteTimeout() (timeout time.Duration)
WriteTimeout specifies the timeout for fully writing the response to a request.
type Mock ¶
type Mock struct {
*Intermediate
}
Mock is a mockable version of the http.ingress.core microservice, allowing functions, event sinks and web handlers to be mocked.
func (*Mock) OnChangedAllowedOrigins ¶
OnChangedAllowedOrigins is a no op.
func (*Mock) OnChangedBlockedPaths ¶
OnChangedBlockedPaths is a no op.
func (*Mock) OnChangedPortMappings ¶
OnChangedPortMappings is a no op.
func (*Mock) OnChangedPorts ¶
OnChangedPorts is a no op.
func (*Mock) OnChangedReadHeaderTimeout ¶
OnChangedReadHeaderTimeout is a no op.
func (*Mock) OnChangedReadTimeout ¶
OnChangedReadTimeout is a no op.
func (*Mock) OnChangedServerLanguages ¶
OnChangedServerLanguages is a no op.
func (*Mock) OnChangedWriteTimeout ¶
OnChangedWriteTimeout is a no op.
func (*Mock) OnShutdown ¶
OnShutdown is a no op.
type ToDo ¶
type ToDo interface { OnStartup(ctx context.Context) (err error) OnShutdown(ctx context.Context) (err error) OnChangedPorts(ctx context.Context) (err error) OnChangedAllowedOrigins(ctx context.Context) (err error) OnChangedPortMappings(ctx context.Context) (err error) OnChangedReadTimeout(ctx context.Context) (err error) OnChangedWriteTimeout(ctx context.Context) (err error) OnChangedReadHeaderTimeout(ctx context.Context) (err error) OnChangedServerLanguages(ctx context.Context) (err error) OnChangedBlockedPaths(ctx context.Context) (err error) }
ToDo defines the interface that the microservice must implement. The intermediate delegates handling to this interface.