config

package
v0.0.39 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: AGPL-3.0 Imports: 19 Imported by: 2

Documentation

Overview

Package config implements the configuration for the Katzenpost client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callbacks

type Callbacks struct {
	// OnConnFn is the callback function that will be called when the
	// connection status changes.  The error parameter will be nil on
	// successful connection establishment, otherwise it will be set
	// with the reason why a connection has been torn down (or a connect
	// attempt has failed).
	OnConnFn func(error)

	// OnMessageEmptyFn is the callback function that will be called
	// when the user's server side spool is empty.  This can happen
	// as the result of periodic background fetches.  Calls to the callback
	// that return an error will be treated as a signal to tear down the
	// connection.
	OnEmptyFn func() error

	// OnMessageFn is the callback function that will be called when
	// a message is retrived from the user's server side spool.  Callers
	// MUST be prepared to receive multiple callbacks with the same
	// message body.  Calls to the callback that return an error will
	// be treated as a signal to tear down the connection.
	OnMessageFn func([]byte) error

	// OnACKFn is the callback function that will be called when a
	// message CK is retreived from the user's server side spool.  Callers
	// MUST be prepared to receive multiple callbacks with the same
	// SURB ID and SURB ciphertext.  Calls to the callback that return
	// an error will be treated as a signal to tear down the connection.
	OnACKFn func(*[constants.SURBIDLength]byte, []byte) error

	// OnDocumentFn is the callback function taht will be called when a
	// new directory document is retreived for the current epoch.
	OnDocumentFn func(*cpki.Document)

	// DialContextFn is the optional alternative Dialer.DialContext function
	// to be used when creating outgoing network connections.
	DialContextFn func(ctx context.Context, network, address string) (net.Conn, error)
}

type Config

type Config struct {

	// ListenNetwork is the network type that the daemon should listen on for thin client connections.
	ListenNetwork string

	// ListenAddress is the network address that the daemon should listen on for thin client connections.
	ListenAddress string

	// PKISignatureScheme specifies the signature scheme to use with the PKI protocol.
	PKISignatureScheme string

	// WireKEMScheme specifies which KEM to use with our PQ Noise based wire protocol.
	WireKEMScheme string

	// SphinxGeometry
	SphinxGeometry *geo.Geometry

	// Logging
	Logging *Logging

	// UpstreamProxy can be used to setup a SOCKS proxy for use with a VPN or Tor.
	UpstreamProxy *UpstreamProxy

	// Debug is used to set various parameters.
	Debug *Debug

	// CachedDocument is a PKI Document that has a MixDescriptor
	// containg the Addresses and LinkKeys of minclient's Gateway
	// so that it can connect directly without contacting an Authority.
	CachedDocument *cpki.Document

	// PinnedGateways is information about a set of Gateways; the required information that lets clients initially
	// connect and download a cached PKI document.
	PinnedGateways *Gateways

	// VotingAuthority contains the voting authority peer public configuration.
	VotingAuthority *VotingAuthority

	// Callbacks should not be set by the config file.
	Callbacks *Callbacks

	// PreferedTransports is a list of the transports will be used to make
	// outgoing network connections, with the most prefered first.
	PreferedTransports []string
	// contains filtered or unexported fields
}

Config is the top level client configuration.

func Load

func Load(b []byte) (*Config, error)

Load parses and validates the provided buffer b as a config file body and returns the Config.

func LoadFile

func LoadFile(f string) (*Config, error)

LoadFile loads, parses, and validates the provided file and returns the Config.

func (*Config) FixupAndValidate

func (c *Config) FixupAndValidate() error

FixupAndValidate applies defaults to config entries and validates the configuration sections.

func (*Config) UpstreamProxyConfig

func (c *Config) UpstreamProxyConfig() *proxy.Config

UpstreamProxyConfig returns the configured upstream proxy, suitable for internal use. Most people should not use this.

type Debug

type Debug struct {
	DisableDecoyTraffic bool

	// SessionDialTimeout is the number of seconds that a session dial
	// is allowed to take until it is canceled.
	SessionDialTimeout int

	// InitialMaxPKIRetrievalDelay is the initial maximum number of seconds
	// we are willing to wait for the retreival of the PKI document.
	InitialMaxPKIRetrievalDelay int

	// PollingInterval is the interval in seconds that will be used to
	// poll the receive queue.  By default this is 10 seconds.  Reducing
	// the value too far WILL result in unnecessary Gateway load, and
	// increasing the value too far WILL adversely affect large message
	// transmit performance.
	PollingInterval int

	// EnableTimeSync enables the use of skewed remote provider time
	// instead of system time when available.
	EnableTimeSync bool
}

Debug is the debug configuration.

type Gateway

type Gateway struct {
	// WireKEMScheme specifies which KEM to use with our PQ Noise based wire protocol.
	WireKEMScheme string

	// Name is the human readable (descriptive) node identifier.
	Name string

	// IdentityKey is the node's identity (signing) key.
	IdentityKey sign.PublicKey

	// LinkKey is the node's wire protocol public key.
	LinkKey kem.PublicKey

	// PKISignatureScheme specifies the signature scheme to use with the PKI protocol.
	PKISignatureScheme string

	// Addresses are the URLs specifying the endpoints that can be used to reach the node.
	// Valid schemes are tcp:// and quic:// for TCP and quic (UDP)
	Addresses []string
}

Gateway describes all necessary Gateway connection information so that clients can connect to the Gateway and use the mixnet and retrieve cached PKI documents.

func (*Gateway) UnmarshalTOML

func (p *Gateway) UnmarshalTOML(v interface{}) error

type Gateways

type Gateways struct {
	Gateways []*Gateway
}

type Logging

type Logging struct {
	// Disable disables logging entirely.
	Disable bool

	// File specifies the log file, if omitted stdout will be used.
	File string

	// Level specifies the log level.
	Level string
}

Logging is the logging configuration.

type UpstreamProxy

type UpstreamProxy struct {
	// Type is the proxy type (Eg: "none"," socks5").
	Type string

	// Network is the proxy address' network (`unix`, `tcp`).
	Network string

	// Address is the proxy's address.
	Address string

	// User is the optional proxy username.
	User string

	// Password is the optional proxy password.
	Password string
}

UpstreamProxy is the outgoing connection proxy configuration.

type VotingAuthority

type VotingAuthority struct {
	Peers []*vServerConfig.Authority
}

VotingAuthority is a voting authority peer public configuration: key material, connection info etc.

Jump to

Keyboard shortcuts

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