12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- package net2
- import (
- "net"
- "time"
- )
- type ConnectionOptions struct {
-
-
-
- MaxActiveConnections int32
-
-
- MaxIdleConnections uint32
-
- MaxIdleTime *time.Duration
-
-
- DialMaxConcurrency int
-
-
- Dial func(network string, address string) (net.Conn, error)
-
-
-
- NowFunc func() time.Time
-
-
-
- ReadTimeout time.Duration
-
-
-
- WriteTimeout time.Duration
- }
- func (o ConnectionOptions) getCurrentTime() time.Time {
- if o.NowFunc == nil {
- return time.Now()
- } else {
- return o.NowFunc()
- }
- }
- type ConnectionPool interface {
-
- NumActive() int32
-
-
- ActiveHighWaterMark() int32
-
- NumIdle() int
-
-
- Register(network string, address string) error
-
-
-
- Unregister(network string, address string) error
-
- ListRegistered() []NetworkAddress
-
-
-
-
-
-
- Get(network string, address string) (ManagedConn, error)
-
- Release(conn ManagedConn) error
-
- Discard(conn ManagedConn) error
-
-
-
-
- EnterLameDuckMode()
- }
|