Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // message channels ErrorChan = make(chan error, 10) // error messages (if pool has failed) WarnChan = make(chan error, 10) // warning messages (errors which did not cause the pool to fail) LogChan = make(chan string, 10) // informative messages DebugChan = make(chan string, 10) // additional debug messages )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Name for the usenet server Name string // Usenet server host name or IP address Host string // Usenet server port number Port uint32 // Use SSL if set to true SSL bool // Skip SSL certificate check SkipSSLCheck bool // Username to connect to the usenet server User string // Password to connect to the usenet server Pass string // Max number of opened connections. MaxConns uint32 // Time to wait in seconds before trying to re-connect ConnWaitTime time.Duration // Duartion after idle connections will be closed IdleTimeout time.Duration // Check health of connection befor passing it on HealthCheck bool // Number of max "too many connections" errors after which MaxConns is automatically reduced (0 = disabled) MaxTooManyConnsErrors uint32 // Number of max consecutive connection errors after which the pool fails if no connection could be established at all (0 = disabled) MaxConnErrors uint32 }
type ConnectionPool ¶
type ConnectionPool interface { // Returns number of currently used and total opened connections. Conns() (uint32, uint32) // Returns the maximum number of simultaneously used connections. MaxConns() uint32 // Retrieves connection from pool if it exists or opens new connection. Get(ctx context.Context) (*NNTPConn, error) // Returns connection to pool. Put(conn *NNTPConn) // Closes all connections and pool. Close() }
func New ¶
func New(c interface{}, initialConns uint32) (ConnectionPool, error)
Opens new connection pool.
type MultiConfig ¶
Click to show internal directories.
Click to hide internal directories.