Documentation
¶
Overview ¶
Package http is a generated GoMock package.
Index ¶
- Constants
- func AddQueryParams(u url.URL, params map[string]string) url.URL
- type AuthConfig
- type AuthType
- type ClientConfig
- type Config
- type EchoCreator
- type EchoServer
- type Engine
- type InternalConfig
- type LogLevel
- type MockEchoServer
- func (m *MockEchoServer) Add(method, path string, handler echo.HandlerFunc, ...) *echo.Route
- func (m_2 *MockEchoServer) CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (m_2 *MockEchoServer) DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (m *MockEchoServer) EXPECT() *MockEchoServerMockRecorder
- func (m_2 *MockEchoServer) GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (m_2 *MockEchoServer) HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (m_2 *MockEchoServer) OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (m_2 *MockEchoServer) PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (m_2 *MockEchoServer) POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (m_2 *MockEchoServer) PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (m *MockEchoServer) Shutdown(ctx context.Context) error
- func (m *MockEchoServer) Start(address string) error
- func (m_2 *MockEchoServer) TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (m *MockEchoServer) Use(middleware ...echo.MiddlewareFunc)
- type MockEchoServerMockRecorder
- func (mr *MockEchoServerMockRecorder) Add(method, path, handler any, middleware ...any) *gomock.Call
- func (mr *MockEchoServerMockRecorder) CONNECT(path, h any, m ...any) *gomock.Call
- func (mr *MockEchoServerMockRecorder) DELETE(path, h any, m ...any) *gomock.Call
- func (mr *MockEchoServerMockRecorder) GET(path, h any, m ...any) *gomock.Call
- func (mr *MockEchoServerMockRecorder) HEAD(path, h any, m ...any) *gomock.Call
- func (mr *MockEchoServerMockRecorder) OPTIONS(path, h any, m ...any) *gomock.Call
- func (mr *MockEchoServerMockRecorder) PATCH(path, h any, m ...any) *gomock.Call
- func (mr *MockEchoServerMockRecorder) POST(path, h any, m ...any) *gomock.Call
- func (mr *MockEchoServerMockRecorder) PUT(path, h any, m ...any) *gomock.Call
- func (mr *MockEchoServerMockRecorder) Shutdown(ctx any) *gomock.Call
- func (mr *MockEchoServerMockRecorder) Start(address any) *gomock.Call
- func (mr *MockEchoServerMockRecorder) TRACE(path, h any, m ...any) *gomock.Call
- func (mr *MockEchoServerMockRecorder) Use(middleware ...any) *gomock.Call
- type MultiEcho
- func (c *MultiEcho) Add(method, path string, handler echo.HandlerFunc, ...) *echo.Route
- func (c *MultiEcho) Bind(path string, addresses []string, ...) error
- func (c *MultiEcho) CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (c *MultiEcho) DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (c *MultiEcho) GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (c *MultiEcho) HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (c *MultiEcho) OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (c *MultiEcho) PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (c *MultiEcho) POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (c *MultiEcho) PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (c MultiEcho) Shutdown(ctx context.Context) error
- func (c MultiEcho) Start() error
- func (c *MultiEcho) TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
- func (c MultiEcho) Use(middleware ...echo.MiddlewareFunc)
- type PublicConfig
Constants ¶
const ( // LogNothingLevel indicates nothing will be logged for incoming/outgoing HTTP traffic. LogNothingLevel LogLevel = "nothing" // LogMetadataLevel indicates that only metadata (HTTP URI, method, response code, etc) will be logged for incoming/outgoing HTTP traffic. LogMetadataLevel = "metadata" // LogMetadataAndBodyLevel indicates that metadata and full request/reply bodies will be logged for incoming/outgoing HTTP traffic. LogMetadataAndBodyLevel = "metadata-and-body" )
const HealthPath = "/health"
HealthPath is the path used for the health endpoint.
const InternalPath = "/internal"
InternalPath is the path used for internal endpoints.
const MetricsPath = "/metrics"
MetricsPath is the path used for the metrics endpoint.
const RootPath = "/"
RootPath is the path used for routes that don't map to a configured bind.
const StatusPath = "/status"
StatusPath is the path used for the status endpoint.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthConfig ¶
type AuthConfig struct {
// Type specifies the type of authentication required for the interface.
Type AuthType `koanf:"type"`
// AuthorizedKeysPath specifies the path to an authorized_keys file which specified the allowed signers for JWT tokens
AuthorizedKeysPath string `koanf:"authorizedkeyspath"`
// Audience specifies the expected aud value for JWT tokens. If left empty the system hostname is used.
Audience string `koanf:"audience"`
}
AuthConfig contains the configuration for authentication for an HTTP interface.
type AuthType ¶
type AuthType string
AuthType defines the type for authentication types constants.
const ( // BearerTokenAuth specifies that a legacy bearer token (v1) authentication is in use BearerTokenAuth AuthType = "token" // BearerTokenAuthV2 specifies the latest version of bearer token authention BearerTokenAuthV2 = "token_v2" )
type ClientConfig ¶
type ClientConfig struct {
// AllowedInternalCIDRs lists IP ranges in CIDR notation (e.g. "10.0.0.0/8") exempted from the
// strict-mode SSRF guard, which otherwise blocks outbound requests to non-public networks. Use
// to permit internal flows that legitimately target a private address, such as an internal
// credential offering or an internal OAuth user flow. Leave empty to block all non-public
// addresses.
AllowedInternalCIDRs []string `koanf:"allowedinternalcidrs"`
// DeniedCIDRs lists IP ranges in CIDR notation that outbound HTTP requests must never target
// in strict mode, in addition to the built-in blocked ranges (non-public addresses and cloud
// metadata endpoints). Use for publicly routable ranges that are internal-only in your
// infrastructure. Denied ranges take precedence over AllowedInternalCIDRs.
DeniedCIDRs []string `koanf:"deniedcidrs"`
}
ClientConfig contains the configuration for outbound HTTP clients.
type Config ¶
type Config struct {
// Log specifies what should be logged of HTTP requests.
Log LogLevel `koanf:"log"`
Public PublicConfig `koanf:"public"`
Internal InternalConfig `koanf:"internal"`
Client ClientConfig `koanf:"client"`
// ResponseCacheSize is the maximum number of bytes cached by HTTP clients.
ResponseCacheSize int `koanf:"cache.maxbytes"`
ClientIPHeaderName string `koanf:"clientipheader"`
}
Config is the top-level config struct for HTTP interfaces.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default configuration for the HTTP engine.
type EchoCreator ¶
type EchoCreator func() (EchoServer, error)
EchoCreator is a function used to create an Echo server.
type EchoServer ¶
type EchoServer interface {
core.EchoRouter
Start(address string) error
Shutdown(ctx context.Context) error
}
EchoServer implements both the EchoRouter interface and Start function to aid testing.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the HTTP engine.
func New ¶
func New(serverShutdownCb func(), signingKeyResolver cryptoEngine.KeyResolver) *Engine
New returns a new HTTP engine. The callback is called when an HTTP interface shuts down unexpectedly.
func (*Engine) Config ¶
func (h *Engine) Config() interface{}
Config returns the configuration of the HTTP engine.
func (*Engine) Configure ¶
func (h *Engine) Configure(serverConfig core.ServerConfig) error
Configure loads the configuration for the HTTP engine.
func (Engine) Router ¶
func (h Engine) Router() core.EchoRouter
Router returns the router of the HTTP engine, which can be used by other engines to register HTTP handlers.
type InternalConfig ¶
type InternalConfig struct {
// Address holds the interface address the HTTP service must be bound to, in the format of `interface:port` (e.g. localhost:5555).
Address string `koanf:"address"`
// Auth specifies what authentication is required when accessing this interface.
Auth AuthConfig `koanf:"auth"`
}
InternalConfig contains the configuration for internal HTTP endpoints.
type LogLevel ¶
type LogLevel string
LogLevel specifies what to log for incoming/outgoing HTTP traffic.
type MockEchoServer ¶
type MockEchoServer struct {
// contains filtered or unexported fields
}
MockEchoServer is a mock of EchoServer interface.
func NewMockEchoServer ¶
func NewMockEchoServer(ctrl *gomock.Controller) *MockEchoServer
NewMockEchoServer creates a new mock instance.
func (*MockEchoServer) Add ¶
func (m *MockEchoServer) Add(method, path string, handler echo.HandlerFunc, middleware ...echo.MiddlewareFunc) *echo.Route
Add mocks base method.
func (*MockEchoServer) CONNECT ¶
func (m_2 *MockEchoServer) CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
CONNECT mocks base method.
func (*MockEchoServer) DELETE ¶
func (m_2 *MockEchoServer) DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
DELETE mocks base method.
func (*MockEchoServer) EXPECT ¶
func (m *MockEchoServer) EXPECT() *MockEchoServerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockEchoServer) GET ¶
func (m_2 *MockEchoServer) GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
GET mocks base method.
func (*MockEchoServer) HEAD ¶
func (m_2 *MockEchoServer) HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
HEAD mocks base method.
func (*MockEchoServer) OPTIONS ¶
func (m_2 *MockEchoServer) OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
OPTIONS mocks base method.
func (*MockEchoServer) PATCH ¶
func (m_2 *MockEchoServer) PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PATCH mocks base method.
func (*MockEchoServer) POST ¶
func (m_2 *MockEchoServer) POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
POST mocks base method.
func (*MockEchoServer) PUT ¶
func (m_2 *MockEchoServer) PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PUT mocks base method.
func (*MockEchoServer) Shutdown ¶
func (m *MockEchoServer) Shutdown(ctx context.Context) error
Shutdown mocks base method.
func (*MockEchoServer) Start ¶
func (m *MockEchoServer) Start(address string) error
Start mocks base method.
func (*MockEchoServer) TRACE ¶
func (m_2 *MockEchoServer) TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
TRACE mocks base method.
func (*MockEchoServer) Use ¶
func (m *MockEchoServer) Use(middleware ...echo.MiddlewareFunc)
Use mocks base method.
type MockEchoServerMockRecorder ¶
type MockEchoServerMockRecorder struct {
// contains filtered or unexported fields
}
MockEchoServerMockRecorder is the mock recorder for MockEchoServer.
func (*MockEchoServerMockRecorder) Add ¶
func (mr *MockEchoServerMockRecorder) Add(method, path, handler any, middleware ...any) *gomock.Call
Add indicates an expected call of Add.
func (*MockEchoServerMockRecorder) CONNECT ¶
func (mr *MockEchoServerMockRecorder) CONNECT(path, h any, m ...any) *gomock.Call
CONNECT indicates an expected call of CONNECT.
func (*MockEchoServerMockRecorder) DELETE ¶
func (mr *MockEchoServerMockRecorder) DELETE(path, h any, m ...any) *gomock.Call
DELETE indicates an expected call of DELETE.
func (*MockEchoServerMockRecorder) GET ¶
func (mr *MockEchoServerMockRecorder) GET(path, h any, m ...any) *gomock.Call
GET indicates an expected call of GET.
func (*MockEchoServerMockRecorder) HEAD ¶
func (mr *MockEchoServerMockRecorder) HEAD(path, h any, m ...any) *gomock.Call
HEAD indicates an expected call of HEAD.
func (*MockEchoServerMockRecorder) OPTIONS ¶
func (mr *MockEchoServerMockRecorder) OPTIONS(path, h any, m ...any) *gomock.Call
OPTIONS indicates an expected call of OPTIONS.
func (*MockEchoServerMockRecorder) PATCH ¶
func (mr *MockEchoServerMockRecorder) PATCH(path, h any, m ...any) *gomock.Call
PATCH indicates an expected call of PATCH.
func (*MockEchoServerMockRecorder) POST ¶
func (mr *MockEchoServerMockRecorder) POST(path, h any, m ...any) *gomock.Call
POST indicates an expected call of POST.
func (*MockEchoServerMockRecorder) PUT ¶
func (mr *MockEchoServerMockRecorder) PUT(path, h any, m ...any) *gomock.Call
PUT indicates an expected call of PUT.
func (*MockEchoServerMockRecorder) Shutdown ¶
func (mr *MockEchoServerMockRecorder) Shutdown(ctx any) *gomock.Call
Shutdown indicates an expected call of Shutdown.
func (*MockEchoServerMockRecorder) Start ¶
func (mr *MockEchoServerMockRecorder) Start(address any) *gomock.Call
Start indicates an expected call of Start.
type MultiEcho ¶
type MultiEcho struct {
// contains filtered or unexported fields
}
MultiEcho allows to bind specific URLs to specific HTTP interfaces
func NewMultiEcho ¶
func NewMultiEcho() *MultiEcho
NewMultiEcho creates a new MultiEcho which uses the given function to create core.EchoServers. If a route is registered for an unknown path is bound to the given defaultInterface.
func (*MultiEcho) Add ¶
func (c *MultiEcho) Add(method, path string, handler echo.HandlerFunc, middleware ...echo.MiddlewareFunc) *echo.Route
Add calls the add function.
func (*MultiEcho) Bind ¶
func (c *MultiEcho) Bind(path string, addresses []string, creatorFn func(ipHeader string) (EchoServer, error), ipHeader string) error
Bind binds the given path (first part of the URL) to the given HTTP interfaces. Calling Bind for the same path twice results in an error being returned.
func (*MultiEcho) CONNECT ¶
func (c *MultiEcho) CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
CONNECT registers a new CONNECT route for the given path with optional middleware.
func (*MultiEcho) DELETE ¶
func (c *MultiEcho) DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
DELETE registers a new DELETE route for the given path with optional middleware.
func (*MultiEcho) GET ¶
func (c *MultiEcho) GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
GET registers a new GET route for the given path with optional middleware.
func (*MultiEcho) HEAD ¶
func (c *MultiEcho) HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
HEAD registers a new HEAD route for the given path with optional middleware.
func (*MultiEcho) OPTIONS ¶
func (c *MultiEcho) OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
OPTIONS registers a new OPTIONS route for the given path with optional middleware.
func (*MultiEcho) PATCH ¶
func (c *MultiEcho) PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PATCH registers a new PATCH route for the given path with optional middleware.
func (*MultiEcho) POST ¶
func (c *MultiEcho) POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
POST registers a new POST route for the given path with optional middleware.
func (*MultiEcho) PUT ¶
func (c *MultiEcho) PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PUT registers a new PUT route for the given path with optional middleware.
func (*MultiEcho) TRACE ¶
func (c *MultiEcho) TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
TRACE registers a new TRACE route for the given path with optional middleware.
func (MultiEcho) Use ¶
func (c MultiEcho) Use(middleware ...echo.MiddlewareFunc)
Use applies the given middleware function to all Echo servers.
type PublicConfig ¶
type PublicConfig struct {
// Address holds the interface address the HTTP service must be bound to, in the format of `interface:port` (e.g. localhost:5555).
Address string `koanf:"address"`
}
PublicConfig contains the configuration for outside-facing HTTP endpoints.