# README
connmgr
Package connmgr implements a generic Bitcoin network connection manager.
Overview
Connection Manager handles all the general connection concerns such as maintaining a set number of outbound connections, sourcing peers, banning, limiting max connections, tor lookup, etc.
The package provides a generic connection manager which is able to accept connection requests from a source or a set of given addresses, dial them and notify the caller on connections. The main intended use is to initialize a pool of active connections and maintain them to remain connected to the P2P network.
In addition the connection manager provides the following utilities:
- Notifications on connections or disconnections
- Handle failures and retry new addresses from the source
- Connect only to specified addresses
- Permanent connections with increasing backoff retry timers
- Disconnect or Remove an established connection
Installation and Updating
$ go get -u github.com/bitweb-project/bted/connmgr
License
Package connmgr is licensed under the copyfree ISC License.
# Functions
DisableLog disables all library log output.
New returns a new connection manager.
SeedFromDNS uses DNS seeding to populate the address manager with peers.
TorLookupIP uses Tor to resolve DNS via the SOCKS extension they provide for resolution over the Tor network.
UseLogger uses a specified Logger to output package logging info.
# Constants
ConnState can be either pending, established, disconnected or failed.
ConnState can be either pending, established, disconnected or failed.
ConnState can be either pending, established, disconnected or failed.
ConnState can be either pending, established, disconnected or failed.
ConnState can be either pending, established, disconnected or failed.
Halflife defines the time (in seconds) by which the transient part of the ban score decays to one half of it's original value.
Lifetime defines the maximum age of the transient part of the ban score to be considered a non-zero score (in seconds).
# Variables
ErrDialNil is used to indicate that Dial cannot be nil in the configuration.
ErrTorInvalidAddressResponse indicates an invalid address was returned by the Tor DNS resolver.
ErrTorInvalidProxyResponse indicates the Tor proxy returned a response in an unexpected format.
ErrTorUnrecognizedAuthMethod indicates the authentication method provided is not recognized.
# Structs
Config holds the configuration options related to the connection manager.
ConnManager provides a manager to handle network connections.
ConnReq is the connection request to a network address.
DynamicBanScore provides dynamic ban scores consisting of a persistent and a decaying component.
# Type aliases
ConnState represents the state of the requested connection.
LookupFunc is the signature of the DNS lookup function.
OnSeed is the signature of the callback function which is invoked when DNS seeding is succesfull.