Documentation ¶
Overview ¶
Package harald contains the core logic of harald.
Harald is a great guy. He takes care of forwarding connections and listens to your needs. Get him started with SIGUSR1, stop him with SIGUSR2 and shut him down for good with SIGTERM. Currently only unix-like systems (as determined by the go build constraint `unix`) are supported due to the dependency to the process signals.
Any logging is done through the default logger of log/slog. Consult the documentation for how to configure it.
Index ¶
Constants ¶
const ( KeyForwarder = "forwarder" KeyError = "error" KeySignal = "signal" KeyPid = "pid" KeyBytesWritten = "bytes-written" KeyConnId = "conn-id" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { ConfigVersion LogLevel slog.Level `json:"log_level" yaml:"log_level"` DialTimeout Duration `json:"dial_timeout" yaml:"dial_timeout"` EnableListeners bool `json:"enable_listeners" yaml:"enable_listeners"` TLS *TLS `json:"tls" yaml:"tls"` Rules []ForwardRule `json:"rules" yaml:"rules"` }
type ConfigVersion ¶
type ConfigVersion struct {
Version *int `json:"version" yaml:"version"`
}
func (ConfigVersion) Get ¶
func (v ConfigVersion) Get() int
type Duration ¶
func (*Duration) UnmarshalText ¶
type ForwardRule ¶
type Forwarder ¶
type Forwarder struct { ForwardRule // contains filtered or unexported fields }
type Forwarders ¶
type Forwarders []*Forwarder
Forwarders maintains a list of pointers to Forwarder. It holds pointers because each struct may maintain data that can not be copied.
func (Forwarders) Start ¶
func (forwarders Forwarders) Start()
Start all forwarders in the list. Logs errors encountered while starting a forwarder but continues starting the forwarders.
type TLS ¶
type TLS struct { Certificate string `json:"certificate" yaml:"certificate"` Key string `json:"key" yaml:"key"` ClientCAs string `json:"client_cas" yaml:"client_cas"` KeyLogFile string `json:"key_log_file" yaml:"key_log_file"` // ApplicationProtocols offered via ALPN in order of preference. See the // IANA registry for a list of options: // https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids ApplicationProtocols []string `json:"application_protocols" yaml:"application_protocols"` }
TLS configuration for the server side.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package haraldtest provides utilities for testing harald.
|
Package haraldtest provides utilities for testing harald. |