config

package
v0.0.0-...-259a6ac Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2018 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package config implements the configuration for the Katzenpost client mail proxy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	// User is the account user name.
	User string

	// Provider is the provider identifier used by this account.
	Provider string

	// ProviderKeyPin is the optional pinned provider signing key.
	ProviderKeyPin *eddsa.PublicKey

	// Authority is the authority configuration used by this Account.
	Authority string

	// LinkKey is the Provider authentication key used by this Account.
	LinkKey *ecdh.PrivateKey `toml:"-"`

	// IdentityKey is the identity key used by this Account.
	IdentityKey *ecdh.PrivateKey `toml:"-"`

	// StorageKey is the optional per-account database encryption key.
	StorageKey *ecdh.PrivateKey `toml:"-"`
}

Account is a provider account configuration.

type Config

type Config struct {
	Proxy         *Proxy
	Logging       *Logging
	Management    *Management
	UpstreamProxy *UpstreamProxy
	Debug         *Debug

	NonvotingAuthority map[string]*NonvotingAuthority
	Account            []*Account
	Recipients         map[string]*ecdh.PublicKey
	// contains filtered or unexported fields
}

Config is the top level mail proxy configuration.

func Load

func Load(b []byte, forceGenOnly bool) (*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, forceGenOnly bool) (*Config, error)

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

func (*Config) AccountMap

func (cfg *Config) AccountMap() map[string]*Account

AccountMap returns the account identifier->Account mapping specified in the Config.

func (*Config) AuthorityMap

func (cfg *Config) AuthorityMap() map[string]authority.Factory

AuthorityMap returns the identifier->authority.Factory mapping specified in the Config.

func (*Config) FixupAndValidate

func (cfg *Config) FixupAndValidate() error

FixupAndValidate applies defaults to config entries and validates the supplied configuration. Most people should call one of the Load variants instead.

func (*Config) UpstreamProxyConfig

func (cfg *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 {
	// ReceiveTimeout is the time in seconds after which the inbound
	// message processor will give up on a partially received message
	// measured from when the last non-duplicate fragment was received.
	// If set to 0 (the default), the timeout is infinite.
	ReceiveTimeout int

	// BounceQueueLifetime is the minimum time in seconds till the mail
	// proxy will give up on sending a particular e-mail.
	BounceQueueLifetime int

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

	// RetransmitSlack is the extra time in seconds added to account for
	// various delays such as latency and the fetch scheduler before
	// a block will be retransmitted.  Reducing this WILL result in
	// worse performance, increased spurrious retransmissions, and
	// unneccecary load on the network.
	RetransmitSlack int

	// CaseSensitiveUserIdentifiers disables the forced lower casing of
	// the Account `User` field.
	CaseSensitiveUserIdentifiers bool

	// GenerateOnly halts and cleans up the mail proxy right after long term
	// key generation.
	GenerateOnly bool
}

Debug is the mail proxy debug configuration.

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 mail proxy logging configuration.

type Management

type Management struct {
	// Enable enables the management interface.
	Enable bool

	// Path specifies the path to the management interface socket.  If left
	// empty it will use `management_sock` under the DataDir.
	Path string
}

Management is the mailproxy management interface configuration.

type NonvotingAuthority

type NonvotingAuthority struct {
	// Address is the IP address/port combination of the authority.
	Address string

	// PublicKey is the authority's public key.
	PublicKey *eddsa.PublicKey
}

NonvotingAuthority is a non-voting authority configuration.

func (*NonvotingAuthority) New

func (nvACfg *NonvotingAuthority) New(l *log.Backend, pCfg *proxy.Config) (pki.Client, error)

New constructs a pki.Client with the specified non-voting authority config.

type Proxy

type Proxy struct {
	// POP3Address is the IP address/port combination that the mail proxy will
	// bind to for POP3 access.  If omitted `127.0.0.1:2524` will be used.
	POP3Address string

	// SMTPAddress is the IP address/port combination that the mail proxy will
	// bind to for SMTP access.  If omitted `127.0.0.1:2525` will be used.
	SMTPAddress string

	// DataDir is the absolute path to the mail proxy's state files.
	DataDir string

	// NoLaunchListeners disables the POP3 and SMTP interfaces, which is
	// useful if you are using mailproxy as a library rather than a
	// stand-alone process.
	NoLaunchListeners bool

	// EventSink is the API event sink.
	EventSink chan event.Event `toml:"-"`
}

Proxy is the mail proxy 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 mailproxy outgoing connection proxy configuration.

Jump to

Keyboard shortcuts

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