Documentation ¶
Index ¶
Constants ¶
View Source
const ( UnexpectedError = iota StopError CreateDataFileError EncodeDataFileError OpenDataFileError DecodeDataFileError WrongVersionError )
Variables ¶
View Source
var ErrCodeMessage = map[int]struct { Code int Message string }{ UnexpectedError: {-1, "Unexpected error"}, StopError: {-2, "Address manager is already in the process of shutting down"}, CreateDataFileError: {-3, "Error opening file"}, EncodeDataFileError: {-4, "Failed to encode file"}, OpenDataFileError: {-5, "Error opening file"}, DecodeDataFileError: {-6, "Error to decode file"}, WrongVersionError: {-7, "Unknown Version in serialized addrmanager"}, }
View Source
var Logger = AddrManagerLogger{}
Global instant to use
Functions ¶
This section is empty.
Types ¶
type AddrManager ¶
type AddrManager struct {
// contains filtered or unexported fields
}
func NewAddrManager ¶
func NewAddrManager(dataDir string, key common.Hash) *AddrManager
NewAddrManager - init a AddrManager object, set config and return pointer to object
func (*AddrManager) AddressCache ¶
func (addrManager *AddrManager) AddressCache() []*peer.Peer
AddressCache returns the current address cache. It must be treated as read-only (but since it is a copy now, this is not as dangerous).
func (*AddrManager) Good ¶
func (addrManager *AddrManager) Good(addr *peer.Peer)
Good marks the given address as good. To be called after a successful connection and Version exchange. If the address is unknown to the address manager it will be ignored.
func (*AddrManager) Start ¶
func (addrManager *AddrManager) Start()
Start begins the core address handler which manages a pool of known addresses, timeouts, and interval based writes.
func (*AddrManager) Stop ¶
func (addrManager *AddrManager) Stop() error
Stop gracefully shuts down the address manager by stopping the main handler.
type AddrManagerError ¶
func NewAddrManagerError ¶
func NewAddrManagerError(key int, err error) *AddrManagerError
func (AddrManagerError) Error ¶
func (e AddrManagerError) Error() string
type AddrManagerLogger ¶
type AddrManagerLogger struct {
// contains filtered or unexported fields
}
func (*AddrManagerLogger) Init ¶
func (addrManagerLogger *AddrManagerLogger) Init(inst common.Logger)
Click to show internal directories.
Click to hide internal directories.