Module hosts

Module hosts 

Source
Expand description

Hosts are a list of network addresses used when establishing outbound connections.

Hosts are shared across the network through the address protocol. When attempting to connect, a node will loop through addresses in the hosts store until it finds ones to connect to. Host management for the P2P network.

Hosts is the main interface managing the registry and container. Filters addresses before storing and publishes events on host/channel changes.

HostRegistry maps peer addresses to their current HostState.

HostContainer stores the hostlists (Grey, White, Gold, Black, Dark) behind a single lock for atomic cross-list operations.

ยงHost Colors

  • Grey: Recently received hosts pending refinement.
  • White: Hosts that passed refinement successfully.
  • Gold: Hosts weโ€™ve connected to in OutboundSession.
  • Black: Hostile hosts, blocked for the program duration.
  • Dark: Hosts with unsupported transports. Shared with peers but not used locally. Cleared daily to avoid propagating stale entries.

Structsยง

HostContainer
Container for all hostlists. Uses a single lock for atomic cross-list operations.
Hosts
Main interface for host management.

Enumsยง

HostColor
HostState ๐Ÿ”’
Mutually exclusive states for host lifecycle management.

Constantsยง

BLACKLIST_MAX_LEN ๐Ÿ”’
DARKLIST_MAX_LEN ๐Ÿ”’
GREYLIST_MAX_LEN ๐Ÿ”’
LOCAL_HOST_STRS
REGISTRY_PRUNE_AGE_SECS ๐Ÿ”’
How long a host can remain in Free state before being pruned from the registry. 24 hours is appropriate for long-running daemons.
WHITELIST_MAX_LEN ๐Ÿ”’

Traitsยง

UnstableFeatureIp ๐Ÿ”’

Type Aliasesยง

HostsPtr