Documentation
¶
Index ¶
- type AdminAPI
- type AdminConfig
- type AuthConfig
- type AuthMapping
- type AuthMethodBasic
- type AuthMethodBasicAPI
- type AuthMethods
- type AuthScheme
- type AuthZ
- type BackendTLS
- type ConnectorConfig
- type Cookies
- type GatewayConfig
- type OASBackendMapping
- type OASBackendMappingOpts
- type OASConfig
- type ObservabilityConfig
- type Origins
- type PersistenceConfig
- type Postgres
- type RootConfig
- type Router
- type RouterBackend
- type ServerTLS
- type SuperUser
- type TargetTLS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminAPI ¶ added in v0.9.0
type AdminAPI struct {
// Cookies contain cookie settings for the csrf, session, and refresh cookies.
Cookies *Cookies `json:"cookies,omitempty"`
// Origins holds configuration for CORS origins. In addition, Origins other than the allowed ones
// will be rejected with a 403 response.
Origins *Origins `json:"origins,omitempty"`
// TLS holds configuration for TLS settings for the admin API.
TLS *ServerTLS `json:"tls,omitempty"`
}
AdminAPI holds configuration for the admin API.
type AdminConfig ¶ added in v0.8.1
type AdminConfig struct {
SuperUser *SuperUser `json:"superUser"`
API *AdminAPI `json:"api,omitempty"`
}
AdminConfig holds configuration for the admin API.
type AuthConfig ¶ added in v0.8.1
type AuthConfig struct {
Methods *AuthMethods `json:"methods"`
Scheme *AuthScheme `json:"scheme"`
Order int `json:"order"`
}
AuthConfig holds configuration for authentication and authorization.
type AuthMapping ¶ added in v0.8.1
type AuthMethodBasic ¶ added in v0.8.1
type AuthMethodBasic struct {
API *AuthMethodBasicAPI `json:"api,omitempty"`
}
type AuthMethodBasicAPI ¶ added in v1.3.0
type AuthMethods ¶ added in v0.8.1
type AuthMethods struct {
Basic *AuthMethodBasic `json:"basic"`
}
type AuthScheme ¶ added in v0.8.1
type AuthScheme struct {
Mappings []*AuthMapping `json:"mappings"`
}
type BackendTLS ¶ added in v0.9.0
type BackendTLS struct {
// RootCAFile is the path to a PEM-encoded CA bundle used to verify the backend's certificate.
// When empty, the system certificate pool is used.
RootCAFile string `json:"rootCAFile,omitempty"`
// ClientCertFile and ClientKeyFile enable mTLS.
// Both must be set together.
ClientCertFile string `json:"clientCertFile,omitempty"`
ClientKeyFile string `json:"clientKeyFile,omitempty"`
// InsecureSkipVerify disables server certificate verification.
// Must only be used in non-production environments.
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"`
}
BackendTLS holds per-backend TLS settings. When nil, the forwarder uses plain HTTP for that backend.
type ConnectorConfig ¶ added in v1.2.0
type ConnectorConfig struct {
// Origins holds configuration for CORS origins. In addition, Origins other than the allowed ones
// will be rejected with a 403 response.
Origins *Origins `json:"origins,omitempty"`
// Persistence holds configuration for the persistence layer.
Persistence *PersistenceConfig `json:"persistence"`
// TLS holds configuration for the server TLS settings.
TLS *ServerTLS `json:"tls,omitempty"`
// TargetTLS holds configuration for the target TLS settings.
TargetTLS *TargetTLS `json:"targetTls,omitempty"`
}
type Cookies ¶ added in v1.3.0
type Cookies struct {
// Domain is the domain setting for cookies, this translates directly to Domain=<value> for cookies.
Domain string `json:"domain,omitempty"`
// SameSite is the SameSite setting for cookies, this translates directly to SameSite=<value> for cookies.
SameSite string `json:"sameSite,omitempty"`
}
type GatewayConfig ¶ added in v0.9.0
GatewayConfig holds configuration for the API gateway.
type OASBackendMapping ¶ added in v0.8.1
type OASBackendMapping struct {
Backend string `json:"backend"`
Specification string `json:"specification"`
Options *OASBackendMappingOpts `json:"options"`
}
type OASBackendMappingOpts ¶ added in v0.8.1
type OASBackendMappingOpts struct {
ValidateBody bool `json:"validateBody"`
}
type OASConfig ¶ added in v0.8.1
type OASConfig struct {
Order int `json:"order"`
Mappings []*OASBackendMapping `json:"mappings"`
}
OASConfig holds configuration for OAS-based request routing and validation.
type ObservabilityConfig ¶ added in v0.8.1
type ObservabilityConfig struct {
Enabled bool `json:"enabled"`
RuntimeMetrics bool `json:"runtimeMetrics"`
}
ObservabilityConfig holds configuration for observability features.
type Origins ¶ added in v1.3.0
type Origins struct {
// AllowedOrigins is a list of allowed origins for CORS.
AllowedOrigins []string `json:"allowedOrigins,omitempty"`
// AllowAll indicates whether to allow all origins for CORS. Mutually exclusive with 'allowedOrigins'.
// AllowAll will mean the Access-Control-Allow-Origin header is set to whatever Origin was received.
AllowAll bool `json:"allowAll,omitempty"`
// DenyAll denies any request with an Origin header, effectively disabling cross-site access.
// Mutually exclusive with 'allowedOrigins' and 'allowAll'.
DenyAll bool `json:"denyAll,omitempty"`
}
Origins holds configuration for CORS origins.
type PersistenceConfig ¶ added in v0.10.0
type PersistenceConfig struct {
// Driver selects the database backend: "sqlite" or "postgres".
Driver string `json:"driver"`
// Address is the database address. For postgres: host. For sqlite: file path.
Address string `json:"address"`
// Postgres contains specific configuration for the postgres driver. Ignored for other drivers.
*Postgres `json:"postgres,omitempty"`
}
PersistenceConfig holds configuration for the backing database.
type Postgres ¶ added in v0.10.0
type Postgres struct {
// Database is the database name (postgres only).
Database string `json:"database"`
// Username is the database user (postgres only).
Username *string `json:"username,omitempty"`
// Password is the database password (postgres only).
Password *string `json:"password,omitempty"`
// SSLMode controls TLS for postgres connections (e.g. "disable", "require", "verify-full").
SSLMode *string `json:"sslMode,omitempty"`
}
type RootConfig ¶ added in v0.8.1
type RootConfig struct {
*GatewayConfig `json:"gateway"`
*ObservabilityConfig `json:"observability"`
*AdminConfig `json:"admin"`
*OASConfig `json:"oas,omitempty"`
*AuthConfig `json:"auth,omitempty"`
*PersistenceConfig `json:"persistence,omitempty"`
// contains filtered or unexported fields
}
func New ¶
func New() *RootConfig
func (*RootConfig) AuthEnabled ¶ added in v0.8.1
func (rc *RootConfig) AuthEnabled() bool
func (*RootConfig) Load ¶ added in v0.8.1
func (rc *RootConfig) Load(data []byte)
func (*RootConfig) OASEnabled ¶ added in v0.8.1
func (rc *RootConfig) OASEnabled() bool
func (*RootConfig) Parse ¶ added in v0.8.1
func (rc *RootConfig) Parse() error
type Router ¶ added in v0.9.0
type Router struct {
Backends []*RouterBackend `json:"backends"`
}
Router holds configuration for the request router.
type RouterBackend ¶ added in v0.8.1
type RouterBackend struct {
Name string `json:"name"`
Host string `json:"host"`
Port int `json:"port"`
TimeoutMs int `json:"timeout,omitempty"`
// Origins holds configuration for CORS origins. In addition, Origins other than the allowed ones
// will be rejected with a 403 response.
Origins *Origins `json:"origins,omitempty"`
TLS *BackendTLS `json:"tls,omitempty"`
}
type TargetTLS ¶ added in v1.3.3
type TargetTLS struct {
// RootCAFile is the path to a PEM-encoded CA bundle used to verify the target's certificate.
// When empty, the system certificate pool is used.
RootCAFile string `json:"rootCAFile,omitempty"`
// InsecureSkipVerify indicates whether to skip TLS verification for the target.
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"`
}