config

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCfg added in v0.2.6

func GetCfg() (*Flags, *Config)

GetCfg parses the command line flags and config file if they haven't been previously parsed. This should be an init function but tests fail if flags are parsed in init.

See: https://github.com/golang/go/issues/46869

Types

type Config

type Config struct {
	General struct {
		Loglevel     string `yaml:"loglevel"`
		LogToFile    bool   `yaml:"logtofile"`
		LogToJournal bool   `yaml:"logtojournal"`
	} `yaml:"general"`
	Files struct {
		// Config is a special variable that returns the name of the active config file.
		// If it's set in the config file, it will be ignored.
		Config   string
		Pubring  string `yaml:"pubring"`
		Mlist2   string `yaml:"mlist2"`
		Pubkey   string `yaml:"pubkey"`
		Secring  string `yaml:"secring"`
		Adminkey string `yaml:"adminkey"`
		Help     string `yaml:"help"`
		Pooldir  string `yaml:"pooldir"`
		Maildir  string `yaml:"maildir"`
		IDlog    string `yaml:"idlog"`
		ChunkDB  string `yaml:"chunkdb"`
		Logfile  string `yaml:"logfile"`
	} `yaml:"files"`
	Urls struct {
		Fetch   bool   `yaml:"fetch"`
		Pubring string `yaml:"pubring"`
		Mlist2  string `yaml:"mlist2"`
	} `yaml:"urls"`
	Mail struct {
		Sendmail     bool   `yaml:"sendmail"`
		Pipe         string `yaml:"pipe"`
		Outfile      bool   `yaml:"outfile"`
		UseTLS       bool   `yaml:"usetls"`
		SMTPRelay    string `yaml:"smtp_relay"`
		SMTPPort     int    `yaml:"smtp_port"`
		MXRelay      bool   `yaml:"mx_relay"`
		OnionRelay   bool   `yaml:"onion_relay"`
		Sender       string `yaml:"sender"`
		Username     string `yaml:"username"`
		Password     string `yaml:"password"`
		OutboundName string `yaml:"outbound_name"`
		OutboundAddy string `yaml:"outbound_addy"`
		CustomFrom   bool   `yaml:"custom_from"`
	} `yaml:"mail"`
	Stats struct {
		Minlat     int     `yaml:"minlat"`
		Maxlat     int     `yaml:"maxlat"`
		Minrel     float32 `yaml:"minrel"`
		Relfinal   float32 `yaml:"rel_final"`
		Chain      string  `yaml:"chain"`
		Numcopies  int     `yaml:"num_copies"`
		Distance   int     `yaml:"distance"`
		StaleHrs   int     `yaml:"stale_hours"`
		UseExpired bool    `yaml:"use_expired"`
	} `yaml:"stats"`
	Pool struct {
		Size    int `yaml:"size"`
		Rate    int `yaml:"rate"`
		MinSend int `yaml:"min_send"`
		Loop    int `yaml:"loop"`
		// Delete excessively old messages from the outbound pool
		MaxAge int `yaml:"max_age"`
	} `yaml:"pool"`
	Remailer struct {
		Name        string `yaml:"name"`
		Address     string `yaml:"address"`
		Exit        bool   `yaml:"exit"`
		MaxSize     int    `yaml:"max_size"`
		IDexp       int    `yaml:"id_expire"`
		ChunkExpire int    `yaml:"chunk_expire"`
		MaxAge      int    `yaml:"max_age"`
		Keylife     int    `yaml:"key_life"`
		Keygrace    int    `yaml:"key_grace"`
		Daemon      bool   `yaml:"daemon"`
	} `yaml:"remailer"`
}

Config contains all the configuration settings for Yamn.

func (*Config) Debug

func (c *Config) Debug() ([]byte, error)

func (*Config) WriteConfig

func (c *Config) WriteConfig(filename string) error

WriteConfig will write the current config to a given filename

type Flags

type Flags struct {
	Dir      string
	Debug    bool
	Client   bool
	Send     bool
	Refresh  bool
	Remailer bool
	Daemon   bool
	Chain    string
	To       string
	Subject  string
	Args     []string
	Config   string
	Copies   int
	Stdin    bool
	Stdout   bool
	Dummy    bool
	NoDummy  bool
	Version  bool
	MemInfo  bool
}

func ParseFlags

func ParseFlags() *Flags

func (*Flags) ParseConfig

func (f *Flags) ParseConfig() (*Config, error)

ParseConfig returns an instance of Config with defaults overridden by the content of a config file

Jump to

Keyboard shortcuts

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