Documentation
¶
Index ¶
Constants ¶
View Source
const ( DefaultMaxConnections = 10 DefaultMaxIdle = time.Minute DefaultSweepInterval = time.Second * 70 DefaultScalingFactor uint = 2 DefaultMaxRetries int = 3 )
Timing settings
View Source
const ( DefaultHostname = "dv.net" DefaultIdentity = "localhost-client" )
Variables ¶
View Source
var ( ErrNoAvailableConnections = errors.New("no available SMTP connections") ErrMaxConnectionsReached = errors.New("pool maximum SMTP connections reached") ErrScalingDisabled = errors.New("pool scaling is disabled") ErrShrinkThresholdReached = errors.New("pool shrink threshold reached. Default being 10") ErrPoolClosed = errors.New("pool is closed") )
Functions ¶
This section is empty.
Types ¶
type PoolOptions ¶
type PoolOptions struct {
Address string `json:"address"` // SMTP server address ex. being (smtp.example.com:1025)
MaxConn uint `json:"max_conn"`
Hostname string `json:"hostname"`
SSL bool `json:"ssl"`
Username *string `json:"username"`
Password *string `json:"password"`
Identity string `json:"identity"`
Auth *sasl.Client `json:"auth"` // Used to authenticate clients to the server
TLSConfig *tls.Config `json:"tls_config"`
MaxIdle time.Duration `json:"max_idle"`
MaxRetries int `json:"max_retries"`
SweepInterval time.Duration `json:"sweep_interval"` // Time interval to sweep idle connections
Scaling bool `json:"scaling"` // If true, pool will dynamically grow and shrink itself
ScalingFactor uint `json:"scaling_factor"` // Scaling factor for dynamic pool size
}
type SMTPPool ¶
type SMTPPool struct {
// contains filtered or unexported fields
}
func NewSMTPPool ¶
func NewSMTPPool(ctx context.Context, o *PoolOptions) (*SMTPPool, error)
Click to show internal directories.
Click to hide internal directories.