Documentation
¶
Overview ¶
Package sidecar implements the common engine of all Darvaza sidecars
Index ¶
- type BindConfig
- type Config
- type DNSConfig
- type HTTPConfig
- type Reloader
- type Server
- func (srv *Server) Cancel()
- func (srv *Server) Err() error
- func (srv *Server) Fail(cause error)
- func (srv *Server) Go(run func(ctx context.Context) error)
- func (srv *Server) GoWithShutdown(run func(context.Context) error, shutdown func() error)
- func (srv *Server) IsCancelled() bool
- func (srv *Server) Listen() error
- func (srv *Server) ListenAndServe(app http.Handler) error
- func (srv *Server) ListenWithListener(lc bind.TCPUDPListener) error
- func (srv *Server) ListenWithUpgrader(upg bind.Upgrader) error
- func (srv *Server) Shutdown(timeout time.Duration) error
- func (srv *Server) Spawn(h http.Handler, healthy time.Duration) error
- func (srv *Server) Wait() error
- type SupervisionConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BindConfig ¶
type BindConfig struct {
Interfaces []string `yaml:",omitempty" toml:",omitempty" json:",omitempty"`
Addresses []netip.Addr `yaml:",omitempty" toml:",omitempty" json:",omitempty"`
KeepAlive time.Duration `yaml:"keep_alive,omitempty" toml:",omitempty" json:",omitempty" default:"10s"`
}
BindConfig refers to the IP addresses used by a GoShop Server
type Config ¶
type Config struct {
Logger slog.Logger `json:"-" yaml:"-" toml:"-"`
Context context.Context `json:"-" yaml:"-" toml:"-"`
Store storage.Store `json:"-" yaml:"-" toml:"-"`
Name string `toml:"name" valid:"host,require"`
Supervision SupervisionConfig
Addresses BindConfig `json:",omitempty" yaml:",omitempty" toml:",omitempty"`
HTTP HTTPConfig
DNS DNSConfig
}
Config represents the generic server configuration for Darvaza sidecars
func (*Config) NewWithStore ¶
NewWithStore creates a new server using the given config and a prebuilt tls Store
func (*Config) SetDefaults ¶
SetDefaults fills the gaps in the Config
type DNSConfig ¶ added in v0.3.3
type DNSConfig struct {
Enabled bool `yaml:"enabled"`
Port uint16 `yaml:"port" default:"8053" valid:"port"`
TLSPort uint16 `yaml:"tls_port" default:"8853" valid:"port"`
MutualTLSOnly bool `yaml:"mtls_only"`
MaxTCPQueries int `yaml:"max_tcp_queries"`
ReadTimeout time.Duration `yaml:"read_timeout" default:"1s"`
IdleTimeout time.Duration `yaml:"idle_timeout" default:"10s"`
}
DNSConfig contains information for setting up the DNS server
type HTTPConfig ¶
type HTTPConfig struct {
Port uint16 `yaml:"port" default:"8443" valid:"port"`
PortInsecure uint16 `yaml:"insecure_port" default:"8080" valid:"port"`
EnableInsecure bool `yaml:"enable_insecure"`
MutualTLSOnly bool `yaml:"mtls_only"`
ReadTimeout time.Duration `yaml:"read_timeout" default:"1s"`
ReadHeaderTimeout time.Duration `yaml:"read_header_timeout" default:"2s"`
WriteTimeout time.Duration `yaml:"write_timeout" default:"1s"`
IdleTimeout time.Duration `yaml:"idle_timeout" default:"30s"`
}
HTTPConfig contains information for setting up the HTTP server
type Reloader ¶
type Reloader interface {
Reload() error
}
A Reloader is an application that can reload
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the HTTP Server of the sidecar
func (*Server) GoWithShutdown ¶ added in v0.3.3
GoWithShutdown runs a worker on the Server's Context, and a shutdown sentinel.
func (*Server) IsCancelled ¶ added in v0.3.3
IsCancelled tells if the server has been cancelled
func (*Server) ListenAndServe ¶
ListenAndServe runs the Server
func (*Server) ListenWithListener ¶
func (srv *Server) ListenWithListener(lc bind.TCPUDPListener) error
ListenWithListener listens to all needed ports using a net.ListenerConfig context
func (*Server) ListenWithUpgrader ¶
ListenWithUpgrader listens to all needed ports using a ListenUpgrader like tableflip
func (*Server) Shutdown ¶
Shutdown initiates a shutdown of all workers with optional fatal timeout while waiting for the workers to finish.
type SupervisionConfig ¶
type SupervisionConfig struct {
PIDFile string `yaml:"pid_file" default:"/tmp/tableflip.pid"`
GracefulTimeout time.Duration `yaml:"graceful_timeout" default:"5s"`
HealthWait time.Duration `yaml:"health_wait" default:"1s"`
}
SupervisionConfig represents how graceful upgrades will operate
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package dnsserver implements a DNS server for sidecars
|
Package dnsserver implements a DNS server for sidecars |
|
Package horizon implements entrypoints based on the network they belong to
|
Package horizon implements entrypoints based on the network they belong to |
|
Package httpserver implements a HTTP/HTTPS/HTTP3 server for darvaza sidecars.
|
Package httpserver implements a HTTP/HTTPS/HTTP3 server for darvaza sidecars. |
|
Package store provides a TLS certificate manager for sidecars
|
Package store provides a TLS certificate manager for sidecars |