config

package
v1.16.2 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorParamEmpty liberr.CodeError = iota + liberr.MinPkgSMTPConfig
	ErrorConfigValidator
	ErrorConfigInvalidDSN
	ErrorConfigInvalidNetwork
	ErrorConfigInvalidParams
	ErrorConfigInvalidHost
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	SMTP

	SetHost(host string)
	SetPort(port int)
	SetUser(user string)
	SetPass(pass string)
	SetNet(mode network.NetworkMode)
	SetTls(tls libtls.Config)

	ForceTLSSkipVerify(skip bool)
	SetTLSServerName(serverName string)
}

func New

func New(cfg ConfigModel) (Config, liberr.Error)

New parses the DSN string to a Config. nolint: gocognit

type ConfigModel

type ConfigModel struct {
	DSN     string        `json:"dsn" yaml:"dsn" toml:"dsn" mapstructure:"dsn"`
	TLS     libtls.Config `json:"tls,omitempty" yaml:"tls,omitempty" toml:"tls,omitempty" mapstructure:"tls,omitempty"`
	Monitor libmon.Config `json:"monitor,omitempty" yaml:"monitor,omitempty" toml:"monitor,omitempty" mapstructure:"monitor,omitempty"`
}

func (ConfigModel) Config

func (c ConfigModel) Config() (Config, liberr.Error)

func (ConfigModel) Validate

func (c ConfigModel) Validate() liberr.Error

type SMTP

type SMTP interface {
	GetHost() string
	GetPort() int
	GetUser() string
	GetPass() string
	GetNet() network.NetworkMode

	GetTls() libtls.Config
	GetTlSServerName() string
	GetTlsMode() smtptp.TLSMode
	SetTlsMode(mode smtptp.TLSMode)

	IsTLSSkipVerify() bool
	GetDsn() string
}

Jump to

Keyboard shortcuts

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