Documentation
¶
Overview ¶
Package httpingress implements the http.ingress.core microservice.
The HTTP ingress microservice relays incoming HTTP requests to the NATS bus.
Index ¶
- Constants
- type Middleware
- type MiddlewareFunc
- type Mock
- type Service
- func (svc *Service) AddMiddleware(middleware ...Middleware) error
- func (svc *Service) AddMiddlewareFunc(handler ...MiddlewareFunc) error
- func (svc *Service) Init(initializer func(svc *Service)) *Service
- func (svc *Service) OnChangedAllowedOrigins(ctx context.Context) (err error)
- func (svc *Service) OnChangedBlockedPaths(ctx context.Context) (err error)
- func (svc *Service) OnChangedPortMappings(ctx context.Context) (err error)
- func (svc *Service) OnChangedPorts(ctx context.Context) (err error)
- func (svc *Service) OnChangedReadHeaderTimeout(ctx context.Context) (err error)
- func (svc *Service) OnChangedReadTimeout(ctx context.Context) (err error)
- func (svc *Service) OnChangedServerLanguages(ctx context.Context) (err error)
- func (svc *Service) OnChangedWriteTimeout(ctx context.Context) (err error)
- func (svc *Service) OnShutdown(ctx context.Context) (err error)
- func (svc *Service) OnStartup(ctx context.Context) (err error)
- func (svc *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)
Constants ¶
const Hostname = "http.ingress.core"
Hostname is the default hostname of the microservice: http.ingress.core.
const SourceCodeSHA256 = "4bed259286710e280f9d8e5337ad797f13f786148759d502f951e9a657fd0d9c"
const Timestamp = "2024-08-01T15:49:24.691176Z"
const Version = 253
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
type Middleware interface {
Serve(w http.ResponseWriter, r *http.Request, next connector.HTTPHandler) (err error)
}
Middleware is a processor that can be added to pre- or post-process a request. It should call the next function in the chain.
type MiddlewareFunc ¶
type MiddlewareFunc func(w http.ResponseWriter, r *http.Request, next connector.HTTPHandler) (err error)
MiddlewareFunc is a processor that can be added to pre- or post-process a request. It should call the next function in the chain.
type Mock ¶
type Mock = intermediate.Mock
Mock is a mockable version of the http.ingress.core microservice, allowing functions, event sinks and web handlers to be mocked.
type Service ¶
type Service struct { *intermediate.Intermediate // DO NOT REMOVE // contains filtered or unexported fields }
Service implements the http.ingress.core microservice.
The HTTP ingress microservice relays incoming HTTP requests to the NATS bus.
func NewService ¶
func NewService() *Service
NewService creates a new http.ingress.core microservice.
func (*Service) AddMiddleware ¶
func (svc *Service) AddMiddleware(middleware ...Middleware) error
AddMiddleware adds a Middleware to the chain of middleware. Middleware is a processor that can be added to pre- or post-process a request. Middlewares are chained together. Each receives the request after it was processed by the preceding (upstream) middleware, passing it along to the next (downstream) one. And conversely, each receives the response from the next (downstream) middleware, and passes it back to the preceding (upstream) middleware. The request and/or response may be modified in the process. A middleware should call the next function in the chain.
func (*Service) AddMiddlewareFunc ¶
func (svc *Service) AddMiddlewareFunc(handler ...MiddlewareFunc) error
AddMiddleware creates a middleware for each MiddlewareFunc and adds them to the chain of middleware.
func (*Service) Init ¶
Init enables a single-statement pattern for initializing the microservice.
svc.Init(func(svc Service) { svc.SetGreeting("Hello") })
func (*Service) OnChangedAllowedOrigins ¶
OnChangedAllowedOrigins is triggered when the value of the AllowedOrigins config property changes.
func (*Service) OnChangedBlockedPaths ¶
OnChangedBlockedPaths is triggered when the value of the BlockPaths config property changes.
func (*Service) OnChangedPortMappings ¶
OnChangedPortMappings is triggered when the value of the PortMappings config property changes.
func (*Service) OnChangedPorts ¶
OnChangedPorts is triggered when the value of the Ports config property changes.
func (*Service) OnChangedReadHeaderTimeout ¶
OnChangedReadHeaderTimeout is triggered when the value of the ReadHeaderTimeout config property changes.
func (*Service) OnChangedReadTimeout ¶
OnChangedReadTimeout is triggered when the value of the ReadTimeout config property changes.
func (*Service) OnChangedServerLanguages ¶
OnChangedServerLanguages is triggered when the value of the ServerLanguages config property changes.
func (*Service) OnChangedWriteTimeout ¶
OnChangedWriteTimeout is triggered when the value of the WriteTimeout config property changes.
func (*Service) OnShutdown ¶
OnShutdown is called when the microservice is shut down.
func (*Service) ServeHTTP ¶
func (svc *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP forwards incoming HTTP requests to the appropriate microservice on NATS. An incoming request http://localhost:8080/echo.example/echo is forwarded to the microservice at https://echo.example/echo . ServeHTTP implements the http.Handler interface
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
app
|
|
Package httpingressapi implements the public API of the http.ingress.core microservice, including clients and data structures.
|
Package httpingressapi implements the public API of the http.ingress.core microservice, including clients and data structures. |
Package intermediate serves as the foundation of the http.ingress.core microservice.
|
Package intermediate serves as the foundation of the http.ingress.core microservice. |