config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ServerConfig ProxyServerConfig `yaml:"smtpd-proxy"`
}

Config represents the structure of the yaml file

func Parse

func Parse(reader io.Reader) (*Config, error)

Parse takes a raw data and returns Config

func ParseFile

func ParseFile(path string) (*Config, error)

ParseFile takes a path to a yaml file and produces a parsed Config

func (*Config) LoadDefaults

func (c *Config) LoadDefaults() (*Config, error)

LoadDefaults sets defaults for configuration

type ProxyServerConfig

type ProxyServerConfig struct {
	Listen                string           `yaml:"listen" default:"127.0.0.1:1025"`
	Ehlo                  string           `yaml:"ehlo" default:"-"`
	Username              string           `yaml:"username" default:"-"`
	Password              string           `yaml:"password" default:"-"`
	IsAnonAuthAllowed     bool             `yaml:"is_anon_auth_allowed" default:"-"`
	ServerCertificatePath string           `yaml:"server-cert" default:"-"`
	ServerKeyPath         string           `yaml:"server-key" default:"-"`
	UpstreamServers       []UpstreamServer `yaml:"upstream-servers"`
}

ProxyServerConfig the top level config

type UpstreamServer

type UpstreamServer struct {
	Type     string         `yaml:"type" default:"smtp"`
	Weight   int            `yaml:"weight" default:"1"`
	Settings map[string]any `yaml:"settings" default:"{}"`
}

UpstreamServer upstream server config

Jump to

Keyboard shortcuts

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