Documentation ¶
Overview ¶
Package connrotation implements a connection dialer that tracks and can close all created connections.
This is used for credential rotation of long-lived connections, when there's no way to re-authenticate on a live connection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionTracker ¶
type ConnectionTracker struct {
// contains filtered or unexported fields
}
ConnectionTracker keeps track of opened connections
func NewConnectionTracker ¶
func NewConnectionTracker() *ConnectionTracker
NewConnectionTracker returns a connection tracker for use with NewDialerWithTracker
func (*ConnectionTracker) CloseAll ¶
func (c *ConnectionTracker) CloseAll()
CloseAll forcibly closes all tracked connections.
Note: new connections may get created before CloseAll returns.
type Dialer ¶
type Dialer struct { *ConnectionTracker // contains filtered or unexported fields }
Dialer opens connections through Dial and tracks them.
func NewDialer ¶
NewDialer creates a new Dialer instance. Equivalent to NewDialerWithTracker(dial, nil).
func NewDialerWithTracker ¶
func NewDialerWithTracker(dial DialFunc, tracker *ConnectionTracker) *Dialer
NewDialerWithTracker creates a new Dialer instance.
If dial is not nil, it will be used to create new underlying connections. Otherwise net.DialContext is used. If tracker is not nil, it will be used to track new underlying connections. Otherwise NewConnectionTracker() is used.