Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultMaxConnections int = 2 DefaultDeadline = 200 * time.Millisecond )
Variables ¶
View Source
var DefaultDnsPoolConfiguration = DnsPoolConfiguration{ MaxConnections: DefaultMaxConnections, }
Functions ¶
This section is empty.
Types ¶
type DnsPool ¶
type DnsPool interface { // thread safe, will block until a connection is available // creates new connections until the pool is full Get() (*dns.Conn, error) // return a connection to the pool and handle network appropriate actions // a tcp connection will be retained, a udp connection will be closed and not reused // this is thread-safe but not for a given connection (which is ok because two threads probably shouldn't try and release the same connection at the same time) Release(conn *dns.Conn) // discard a connection and remove it from the pool (used for error'd connections) // this is thread-safe but not for a given connection (which is ok because two threads probably shouldn't try and discard the same connection at the same time) Discard(conn *dns.Conn) // shutdown enables a clean/safe shutdown of the pool Shutdown() }
ConnectionPool interface for reusing existing and getting new connections
func DefaultDnsPool ¶
func NewDnsPool ¶
func NewDnsPool(protocol string, address string, config DnsPoolConfiguration) DnsPool
type DnsPoolConfiguration ¶
type DnsPoolConfiguration struct { // max connections this pool can hand out MaxConnections int }
Click to show internal directories.
Click to hide internal directories.