Package conn provides utilities related to connections.
This section is empty.
ErrConnectionUnavailable is returned by the Manager's Write method when the manager cannot yield a good connection.
AfterFunc imitates time.After.
Dialer imitates net.Dial. Dialer is assumed to yield connections that are safe for use by multiple concurrent goroutines.
Manager manages a net.Conn.
Clients provide a way to create the connection with a Dialer, network, and address. Clients should Take the connection when they want to use it, and Put back whatever error they receive from its use. When a non-nil error is Put, the connection is invalidated, and a new connection is established. Connection failures are retried after an exponential backoff.
NewDefaultManager is a helper constructor, suitable for most normal use in real (non-test) code. It uses the real net.Dial and time.After functions.
NewManager returns a connection manager using the passed Dialer, network, and address. The AfterFunc is used to control exponential backoff and retries. The logger is used to log errors; pass a log.NopLogger if you don't care to receive them. For normal use, prefer NewDefaultManager.
Put accepts an error that came from a previously yielded connection. If the error is non-nil, the manager will invalidate the current connection and try to reconnect, with exponential backoff. Putting a nil error is a no-op.
Take yields the current connection. It may be nil.
Write writes the passed data to the connection in a single Take/Put cycle.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4