config

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const AdvertiseIntervalDefault = 15 * time.Second
View Source
const AdvertiseTTLMargin = 10 * time.Second
View Source
const HTTPEgressConnectTimeoutDefault = 10 * time.Second
View Source
const HTTPEgressKeepAliveTimeoutDefault = 60 * time.Second
View Source
const HTTPEgressMaxConnectionsDefault = 100
View Source
const HTTPIngressKeepAliveTimeoutDefault = 60 * time.Second
View Source
const PeeringConnectionDefaultCount = 3

Variables

View Source
var HTTPBodyTimeoutDefault = 60 * time.Second
View Source
var HTTPHeaderTimeoutDefault = 60 * time.Second

Functions

This section is empty.

Types

type EgressConfigs

type EgressConfigs struct {
	AdvertiseIntervalSec int `json:"advertise-interval-sec" yaml:"advertise-interval-sec"`

	HTTP []HTTPEgressConfig `json:"http" yaml:"http"`
}

type HTTPEgressConfig

type HTTPEgressConfig struct {
	// (optional) This egress receive HTTP traffic that match with this hostname.
	// By default or for empty string, match with any host.
	//
	// Can use "*" in the 1st part of hostname (e.g. "*.example.com" match with "sub.example.com").
	// "*" match with only 1 level of hostname element (e.g. "*.example.com" not match with "a.b.example.com")
	//
	// If multiple egress matches with request, longest match preffered.
	Host string `json:"host" yaml:"host"`

	// Upstream serer, "schme://hostname:port" format (e.g. "http://localhost:8080")
	Server string `json:"server" yaml:"server"`

	MaxConnections   int          `json:"max_connections" yaml:"max_connections"`
	KeepAliveTimeout string       `json:"keep_alive_timeout" yaml:"keep_alive_timeout"`
	ConnectTimeout   string       `json:"connect_timeout" yaml:"connect_timeout"`
	ResponseTimeout  *HTTPTimeout `json:"response_timeout" yaml:"response_timeout"`
}

func (*HTTPEgressConfig) ConfigureDialer

func (c *HTTPEgressConfig) ConfigureDialer(d *net.Dialer)

func (*HTTPEgressConfig) ConfigureHTTPTransport

func (c *HTTPEgressConfig) ConfigureHTTPTransport(t *http.Transport)

type HTTPIngressConfig

type HTTPIngressConfig struct {
	// (optional) "host:port" to listen (e.g. "localhost:8080", ":8080")
	// Use random available port by default.
	Listen string `json:"listen" yaml:"listen"`

	TLS *TLSServerConfig `json:"tls" yaml:"tls"`

	Probe *HTTPProbeConfig `json:"probe" yaml:"probe"`

	RequestTimeout   *HTTPTimeout `json:"request_timeout" yaml:"request_timeout"`
	ResponseTimeout  *HTTPTimeout `json:"response_timeout" yaml:"response_timeout"`
	KeepAliveTimeout string       `json:"keep_alive_timeout" yaml:"keep_alive_timeout"`
}

func (*HTTPIngressConfig) GetKeepAliveTimeout

func (c *HTTPIngressConfig) GetKeepAliveTimeout() time.Duration

type HTTPProbeConfig

type HTTPProbeConfig struct {
	// (optional) Hostname (expected Host header value) of the probe endpoint
	Host string `json:"host" yaml:"host"`
	// Path of the probe endpoint (e.g. "/probe")
	Path string `json:"path" yaml:"path"`
}

type HTTPTimeout

type HTTPTimeout struct {
	Header string `json:"header" yaml:"header"`
	Body   string `json:"body" yaml:"body"`
}

func (*HTTPTimeout) BodyTimeout

func (ht *HTTPTimeout) BodyTimeout() time.Duration

func (*HTTPTimeout) HeaderTimeout

func (ht *HTTPTimeout) HeaderTimeout() time.Duration

type IngressConfigs

type IngressConfigs struct {
	HTTP []HTTPIngressConfig `json:"http" yaml:"http"`
}

type MTLSCertLoadConfig

type MTLSCertLoadConfig struct {
	// Path of PKCS#12 encoded credential file
	Path string `json:"path" yaml:"path"`
	// Password of PKCS#12 archive
	Password string `json:"password" yaml:"password"`
}

type NodeID

type NodeID string

func GenerateNodeID

func GenerateNodeID(hostname string) NodeID

type PeeringAcceptConfig

type PeeringAcceptConfig struct {
	// (optional) "host:port" to listen (e.g. "localhost:50051", ":50051")
	// Use random available port by default.
	Listen string `json:"listen" yaml:"listen"`

	TLS *TLSServerConfig `json:"tls" yaml:"tls"`
}

type PeeringConfig

type PeeringConfig struct {
	Accept  *PeeringAcceptConfig    `json:"accept" yaml:"accept"`
	Connect []*PeeringConnectConfig `json:"connect" yaml:"connect"`
}

type PeeringConnectConfig

type PeeringConnectConfig struct {
	/** e.g. "localhost:50051" */
	Address string `json:"address" yaml:"address"`

	TLS *TLSClientConfig `json:"tls" yaml:"tls"`

	Connections                int `json:"connections" yaml:"connections"`
	ConnectionRetryIntervalSec int `json:"connection_retry_interval_sec" yaml:"connection_retry_interval_sec"`
}

type ServerConfig

type ServerConfig struct {
	Hostname string `json:"hostname" yaml:"hostname"` // = prefix of NodeID

	Perring *PeeringConfig  `json:"peering" yaml:"peering"`
	Ingress *IngressConfigs `json:"ingress" yaml:"ingress"`
	Egress  *EgressConfigs  `json:"egress" yaml:"egress"`
}

func ParseConfig

func ParseConfig(in io.Reader) (*ServerConfig, error)

type TLSClientConfig

type TLSClientConfig struct {
	// (optional) PKCS#12 encoded client credentials for mTLS
	ClientCerts []MTLSCertLoadConfig `json:"client_certs" yaml:"client_certs"`

	// (optional) If present, use those certs for Root CA instead of environment provided root CA list.
	RootCAFiles []string `json:"root_ca_files" yaml:"root_ca_files"`
}

type TLSServerConfig

type TLSServerConfig struct {
	// (optional) "TLS1.2" or "TLS1.3"
	MinVersion string `json:"min_version" yaml:"min_version"`
	// (optional) "TLS1.2" or "TLS1.3"
	MaxVersion string `json:"max_version" yaml:"max_version"`

	CertFile string `json:"cert_file" yaml:"cert_file"`
	KeyFile  string `json:"key_file" yaml:"key_file"`

	// (optional) If present, require client certificate (mTLS)
	ClientCertCAFile string `json:"client_cert_ca_file" yaml:"client_cert_ca_file"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL