Documentation ¶
Index ¶
- func DisableLog()
- func UseLogger(logger elalog.Logger)
- type AddrManager
- func (a *AddrManager) AddAddress(pid [33]byte, addr net.Addr)
- func (a *AddrManager) DeserializeNetAddress(addr string) (net.Addr, error)
- func (a *AddrManager) GetAddress(pid [33]byte) net.Addr
- func (a *AddrManager) HostToNetAddress(host string, port uint16, services uint64) (net.Addr, error)
- func (a *AddrManager) Start()
- func (a *AddrManager) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.
Types ¶
type AddrManager ¶
type AddrManager struct {
// contains filtered or unexported fields
}
AddrManager provides a concurrency safe address manager for caching potential peers on the network.
func New ¶
func New(dataDir string) *AddrManager
New returns a new address manager. Use Start to begin processing asynchronous address updates.
func (*AddrManager) AddAddress ¶
func (a *AddrManager) AddAddress(pid [33]byte, addr net.Addr)
AddAddress adds a new address to the address manager. It enforces a max number of addresses and silently ignores duplicate addresses. It is safe for concurrent access.
func (*AddrManager) DeserializeNetAddress ¶
func (a *AddrManager) DeserializeNetAddress(addr string) (net.Addr, error)
DeserializeNetAddress converts a given address string to a *p2p.NetAddress
func (*AddrManager) GetAddress ¶
func (a *AddrManager) GetAddress(pid [33]byte) net.Addr
GetAddress returns the network address according to the given PID and Encode.
func (*AddrManager) HostToNetAddress ¶
HostToNetAddress returns a netaddress given a host address. If the address is a Tor .onion address this will be taken care of. Else if the host is not an IP address it will be resolved (via Tor if required).
func (*AddrManager) Start ¶
func (a *AddrManager) Start()
Start begins the core address handler which manages a pool of known addresses, timeouts, and interval based writes.
func (*AddrManager) Stop ¶
func (a *AddrManager) Stop()
Stop gracefully shuts down the address manager by stopping the main handler.