config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2019 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultLocalDirectoryServerTopologyEndpoint = mainConfig.LocalDirectoryServerTopology
)

Variables

This section is empty.

Functions

func DefaultConfigPath

func DefaultConfigPath(clientID string) (string, error)

DefaultConfigPath returns absolute path to the default configuration file of the particular client. The returned path should be $HOME/.nym/Clients/clientID/config/config.toml

func WriteConfigFile

func WriteConfigFile(path string, config *Config) error

WriteConfigFile renders config using the template and writes it to specified file path.

Types

type Client

type Client struct {
	// HomeDirectory specifies absolute path to the home nym Clients directory.
	// It is expected to use default value and hence .toml file should not redefine this field.
	HomeDirectory string `toml:"nym_home_directory"`

	// ID specifies the human readable ID of this particular client.
	// If not provided a random id will be generated instead.
	ID string `toml:"id"`

	// DirectoryServerTopologyEndpoint specifies URL to the topology endpoint of the directory server.
	DirectoryServerTopologyEndpoint string `toml:"directory_server_topology"`

	// MixAppsDirectory specifies directory for mixapps, such as a chat client,
	// to store their app-specific data.
	MixAppsDirectory string `toml:"mixapps_directory"`

	// PrivateKey specifies path to file containing private key.
	PrivateKey string `toml:"priv_key_file"`

	// PublicKey specifies path to file containing public key.
	// TODO: we could actually get rid of public key file completely, as it can be inferred from the private key alone
	// But I guess having an explicit public key file could be convenient?
	// To say, for example, share it with somebody else.
	PublicKey string `toml:"pub_key_file"`

	// ProviderID specifies ID of the provider to which the client should send messages.
	// If initially omitted, a random provider will be chosen from the available topology.
	ProviderID string `toml:"provider_id"`
}

Client is the Nym Client configuration.

func DefaultClientConfig

func DefaultClientConfig(clientID string) (*Client, error)

DefaultClientConfig returns default Client config for provided clientID.

func (*Client) FullMixAppsDir

func (cfg *Client) FullMixAppsDir() string

func (*Client) Home

func (cfg *Client) Home() string

func (*Client) PrivateKeyFile

func (cfg *Client) PrivateKeyFile() string

PrivateKeyFile returns the full path to the public key file.

func (*Client) PublicKeyFile

func (cfg *Client) PublicKeyFile() string

PublicKeyFile returns the full path to the private key file.

type Config

type Config struct {
	Client  *Client  `toml:"client"`
	Logging *Logging `toml:"logging"`
	Debug   *Debug   `toml:"debug"`
}

Config is the top level Nym Client configuration.

func DefaultConfig

func DefaultConfig(clientID string) (*Config, error)

DefaultConfig returns full default config for given clientID

func LoadBinary

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

LoadBinary loads, parses and validates the provided buffer b (as a config) and returns the Config.

func LoadFile

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

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

type Debug

type Debug struct {
	// LoopCoverTrafficRate defines the rate at which clients are sending loop packets in the loop cover traffic stream.
	// The value is the parameter of an exponential distribution, and is the reciprocal of the
	// expected value of the exponential distribution.
	// If set to a negative value, the loop cover traffic stream will be disabled.
	LoopCoverTrafficRate float64 `toml:"loop_cover_traffic_rate"`

	// FetchMessageRate defines the rate at which clients are querying the providers for received packets.
	// The value is the parameter of an exponential distribution, and is the reciprocal of the
	// expected value of the exponential distribution.
	// If set to a negative value, client will never try to fetch its messages.
	FetchMessageRate float64 `toml:"fetch_message_rate"`

	// MessageSendingRate defines the rate at which clients are sending their real traffic to providers.
	// If no real packets are available and cover traffic is enabled,
	// a drop cover message is sent instead in order to preserve the rate.
	// The value is the parameter of an exponential distribution, and is the reciprocal of the
	// expected value of the exponential distribution.
	// If set to a negative value, client will never try to send real traffic data.
	MessageSendingRate float64 `toml:"message_sending_rate "`

	// RateCompliantCoverMessagesDisabled specifies whether loop cover messages should be sent
	// to respect MessageSendingRate. In the case of it being disabled and not having enough real traffic
	// waiting to be sent the actual sending rate is going be lower than the desired value
	// thus decreasing the anonymity.
	RateCompliantCoverMessagesDisabled bool `toml:"rate_compliant_cover_messages_disabled"`
}

Debug is the Nym Client debug configuration.

func DefaultDebugConfig

func DefaultDebugConfig() *Debug

DefaultDebugConfig returns default debug configuration.

type Logging

type Logging struct {
	// Disable disables logging entirely.
	Disable bool `toml:"disable"`

	// File specifies the log file, if omitted stdout will be used.
	File string `toml:"file"`

	// Level specifies the log level.
	Level string `toml:"level"`
}

Logging is the Nym Client logging configuration.

func DefaultLoggingConfig

func DefaultLoggingConfig(clientID string) *Logging

DefaultLoggingConfig returns default logging configuration.

Jump to

Keyboard shortcuts

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