- All Implemented Interfaces:
Service
This class provides the main interface between the router core and all transport protocols. It coordinates message sending, peer management, address configuration, and network monitoring while abstracting the underlying transport details.
Core Responsibilities:
- Message routing and delivery across all transports
- Peer connection management and statistics
- Network address discovery and configuration
- Bandwidth allocation and monitoring
- Transport lifecycle management (start/stop/restart)
- Network reachability testing and reporting
- Geographic IP filtering and country blocking
- Communication system status and health monitoring
Transport Integration:
- Manages NTCP, UDP, and SSU transports
- Handles transport selection and failover
- Coordinates address updates across protocols
- Provides unified API for router components
Configuration Features:
- Transport enable/disable controls
- Country-based blocking and filtering
- Proxy configuration and detection
- Network monitoring and testing options
- IPv4 and IPv6 addressing support
Security Features:
- Geographic IP filtering
- Country-based access controls
- Peer reputation and banlist management
- Transport-specific security policies
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classArbitrary sort for consistency.private classSimple check to see if we have a network connection.private classUpdate the clock offset based on the average of the peers.Nested classes/interfaces inherited from class CommSystemFacade
CommSystemFacade.StatusModifier and TypeClassDescriptionstatic enumNetwork connectivity status enumeration for IPv4 and IPv6 transport capabilities.Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RouterContextThe router context.private final CountryLookupThe country name lookup helper.Peers exempt from the incoming rate limits.private final GeoIPThe GeoIP lookup helper.private final LogLogger for the comm system facade.private final TransportManagerThe manager the facade reports to.private booleanTrue while the network monitoring is enabled.private final PeerHTMLRendererRenderer of the peer detail pages.private final ReverseDnsLookupThe reverse DNS lookup helper.private booleanTrue once the transports were started.private static final ObjectPlaceholder value for the exempt peer sets.private static final StringProperty to disable all network connections for testing purposes.private static final intInterval between the status pings.private static final intStartup delay before the first status ping.Fields inherited from class CommSystemFacade
ROUTER_BUNDLE_NAME, STATUS_DIFFERENT, STATUS_DISCONNECTED, STATUS_HOSED, STATUS_IPV4_DISABLED_IPV6_FIREWALLED, STATUS_IPV4_DISABLED_IPV6_OK, STATUS_IPV4_DISABLED_IPV6_UNKNOWN, STATUS_IPV4_FIREWALLED_IPV6_OK, STATUS_IPV4_FIREWALLED_IPV6_UNKNOWN, STATUS_IPV4_OK_IPV6_FIREWALLED, STATUS_IPV4_OK_IPV6_UNKNOWN, STATUS_IPV4_SNAT_IPV6_OK, STATUS_IPV4_SNAT_IPV6_UNKNOWN, STATUS_IPV4_UNKNOWN_IPV6_FIREWALLED, STATUS_IPV4_UNKNOWN_IPV6_OK, STATUS_OK, STATUS_REJECT_UNSOLICITED, STATUS_UNKNOWNModifier and TypeFieldDescriptionprotected static final StringBundle holding the translatable messages this subsystem logs.static final shortWe are behind a symmetric NAT which will make our 'from' address look differently when we talk to multiple people.static final shortWe have no network interface at all enabled transports.static final shortOur detection system is broken (SSU bind port failed).static final shortWe have an IPv6 transport enabled and a public IPv6 address.static final shortWe have an IPv6 transport enabled and a public IPv6 address.static final shortWe have an IPv6 transport enabled and a public IPv6 address.static final shortWe have an IPv6 transport enabled and a public IPv6 address.static final shortWe have an IPv6 transport enabled and a public IPv6 address.static final shortWe have an IPv6 transport enabled and a public IPv6 address.static final shortWe have an IPv6 transport enabled and a public IPv6 address.static final shortWe are behind a symmetric NAT which will make our 'from' address look differently when we talk to multiple people We can receive unsolicited connections on IPv6.static final shortWe are behind a symmetric NAT which will make our 'from' address look differently when we talk to multiple people We might be able to receive unsolicited connections on IPv6.static final shortWe have an IPv6 transport enabled and a public IPv6 address.static final shortWe have an IPv6 transport enabled and a public IPv6 address.static final shortThese must be increasing in "badness" (see TransportManager.java), but UNKNOWN must be last.static final shortWe are able to talk to peers that we initiate communication with, but cannot receive unsolicited connections, i.e.static final shortOur reachability is unknown on all.Constructor Summary
ConstructorsConstructorDescriptionCommSystemFacadeImpl(RouterContext context) Build the transport manager, GeoIP database and address lookup services.Method Summary
Modifier and TypeMethodDescriptionvoidadjustRdnsPool(int coreSize) Adjust the running rDNS executor pool sizes.intHow many peers are we currently connected to, that we have sent a message to or received a message from in the last minute.intHow many peers we have sent a message to in the last minute.static intThe number of entries in the rDNS cache.Create router addresses for all configured transport protocols.booleanWhether reverse lookups are enabled.voidexemptIncoming(Hash peer) Exempt this router hash from any incoming throttles or rejections.voidforceDisconnect(Hash peer) Tell the comm system to disconnect from this peer.voidforceDisconnect(Hash peer, String reason) Force an immediate disconnect from the given peer with the given reason.getCanonicalHostName(String ipAddress) Canonical hostname for the given IP address from cache or DNS.getCanonicalHostNameSync(String ipAddress) The canonical host name for the given IP address, resolved synchronously.static byte[]IP address compatible with our capabilities (IPv4/IPv6).Provides country code mappings.getCountry(String ip) The two-letter country code for an IP address string.getCountry(Hash peer) Uses the transport IP first because that lookup is fast, then the IP from the netDb.Full name for a country code.static StringDomain name from a reverse DNS hostname.Established peers.longgetFramedAveragePeerClockSkew(int percentToInclude) The framed average clock skew of connected peers in milliseconds, or the clock offset if we cannot answer.byte[]The known IP address of the given peer.getLocalHostName(String ipAddress) Fast hostname lookup that never blocks on I/O (MMDB or network).The localized status string fromgetStatus().toStatusString(), translated if available.static intThe maximum rDNS cache size, computed from the memory available.The status of the communication system.Country code for this router, from the GeoIP lookup.intReturns rDNS executor active thread count, or 0 if not running.static StringCache statistics for monitoring.static intThe rDNS executor core pool size.static intThe rDNS executor max pool size.intReturns rDNS executor total thread count, or 0 if not running.intReturns rDNS executor pending lookup count, or 0 if not running.doubleReturns rDNS executor utilization as a ratio (0.0-1.0), orDouble.NaNif not running.The current network status.Transports in use.static byte[]getValidIP(RouterInfo ri) Return first valid IP (v4 or v6) we find, any transport.Factory for making X25519 key pairs.booleanWhether we have high outbound capacity.booleanhaveInboundCapacity(int pct) Whether we have capacity to handle an inbound message at the given percentage.booleanhaveOutboundCapacity(int pct) Whether we have capacity to handle an outbound message at the given percentage.voidRouter must call after netdb is initialized.booleanisBacklogged(Hash peer) Whether the given peer is backlogged.booleanisConnecting(Hash peer) Whether we are currently connecting to the given peer.booleanisDummy()Is everything disabled for testing?booleanisEstablished(Hash peer) Whether the given peer is established.booleanIs this IP exempt from any incoming throttles or rejections.booleanAre we in a strict country.booleanisInStrictCountry(Hash peer) Are they in a strict country.booleanAre they in a strict country.booleanWhether the comm system is running.voidmayDisconnect(Hash peer) Tell the comm system that we may disconnect from this peer.voidnotifyRemoveAddress(boolean ipv6) Tell other transports our address changed.voidnotifyRemoveAddress(RouterAddress address) Tell other transports our address changed.voidnotifyReplaceAddress(RouterAddress udpAddr) UDP changed addresses, tell NTCP and restart All the work moved toNTCPTransport.externalAddressReceived(Transport.AddressSource, byte[], int).voidProcess and route an outbound message through the transport system.voidqueueLookup(byte[] ip) Queue all current destination for lookup.static StringThe size of the rDNS cache file, in KB.voidPluggable transports.voidRemove this IP from the exemptions.renderPeerCaps(Hash peer, boolean inline) Renders the peer's capability HTML block.renderPeerFlag(Hash peer) Render the HTML flag image for the given peer.renderPeerHTML(Hash peer, boolean extended) Renders HTML for a peer with optional extended info.voidrenderStatusHTML(Writer out, String urlBase, int sortFlags) Render the status of the transport manager to the console as HTML.voidrestart()Restart the communication system.static voidsetRdnsCorePoolSize(int size) The rDNS executor core pool size, bounded 2-8.static voidsetRdnsMaxPoolSize(int size) The rDNS executor max pool size, bounded 2-8.voidshutdown()Cannot be restarted after calling this.private voidRouter must call after netdb is initialized.private voidStart the network monitor.private voidStart the backup timestamper.voidstartup()Start the communication system and all transport protocols.voidPluggable transports.booleanwasFailsafeClosed(Hash peer, long withinMs) Whether the peer's most recent connection was closed by the failsafe.booleanwasUnreachable(Hash peer) Whether the given peer was recently unreachable.Methods inherited from class CommSystemFacade
getMedianPeerClockSkew, renderStatusHTMLModifier and TypeMethodDescriptionMedian clock skew of connected peers in seconds, or null if we cannot answer.voidrenderStatusHTML(Writer out) Render the transport status section of the router console page with default flags.
Field Details
_log
Logger for the comm system facade._context
The router context._manager
The manager the facade reports to._geoIP
The GeoIP lookup helper._rdns
The reverse DNS lookup helper._countryLookup
The country name lookup helper._peerHTML
Renderer of the peer detail pages._exemptIncoming
_netMonitorStatus
private volatile boolean _netMonitorStatusTrue while the network monitoring is enabled._wasStarted
private boolean _wasStartedTrue once the transports were started.PROP_DISABLED
Property to disable all network connections for testing purposes.When this property is set to true, the communication system will not establish any outbound connections or accept inbound connections. This is useful for testing scenarios or when running in debug mode.
- See Also:
DUMMY
Placeholder value for the exempt peer sets.TIME_START_DELAY
private static final int TIME_START_DELAYStartup delay before the first status ping.- See Also:
TIME_REPEAT_DELAY
private static final int TIME_REPEAT_DELAYInterval between the status pings.- See Also:
Constructor Details
CommSystemFacadeImpl
Build the transport manager, GeoIP database and address lookup services.- Parameters:
context- the router context, used to build the transport manager, GeoIP database and rDNS/country lookup services
Method Details
getRdnsCorePoolSize
public static int getRdnsCorePoolSize()The rDNS executor core pool size.- Returns:
- the number of threads currently in the rDNS core pool
setRdnsCorePoolSize
public static void setRdnsCorePoolSize(int size) The rDNS executor core pool size, bounded 2-8.- Parameters:
size- the requested core pool size, clamped by rDNS to 2-8
getRdnsMaxPoolSize
public static int getRdnsMaxPoolSize()The rDNS executor max pool size.- Returns:
- the upper bound on rDNS executor threads
setRdnsMaxPoolSize
public static void setRdnsMaxPoolSize(int size) The rDNS executor max pool size, bounded 2-8.- Parameters:
size- the requested maximum pool size, clamped by rDNS to 2-8
rdnsCacheSize
The size of the rDNS cache file, in KB.- Returns:
- the on-disk size of the rDNS cache, in kilobytes
countRdnsCacheEntries
public static int countRdnsCacheEntries()The number of entries in the rDNS cache.- Returns:
- how many hostnames are currently held in the rDNS cache
getRdnsCacheStats
Cache statistics for monitoring.- Returns:
- formatted string with cache stats
getMaxRdnsCacheSize
public static int getMaxRdnsCacheSize()The maximum rDNS cache size, computed from the memory available.- Returns:
- the entries the cache holds
adjustRdnsPool
public void adjustRdnsPool(int coreSize) Adjust the running rDNS executor pool sizes. Called by the Tuner when queue depth signals scaling.- Parameters:
coreSize- new core pool size (bounded 2-8)
getRdnsQueueSize
public int getRdnsQueueSize()Returns rDNS executor pending lookup count, or 0 if not running.- Returns:
- the rdns queue size
getRdnsActiveCount
public int getRdnsActiveCount()Returns rDNS executor active thread count, or 0 if not running.- Returns:
- the rdns active count
getRdnsPoolSize
public int getRdnsPoolSize()Returns rDNS executor total thread count, or 0 if not running.- Returns:
- the rdns pool size
getRdnsUtilization
public double getRdnsUtilization()Returns rDNS executor utilization as a ratio (0.0-1.0), orDouble.NaNif not running.- Returns:
- the rdns utilization
enableReverseLookups
public boolean enableReverseLookups()Whether reverse lookups are enabled.- Specified by:
enableReverseLookupsin classCommSystemFacade- Returns:
- true if reverse lookups are enabled
getCanonicalHostName
Canonical hostname for the given IP address from cache or DNS. If RDNS is enabled, performs a reverse DNS lookup first. Falls back to local ASN database if DNS fails, returning the org name.- Overrides:
getCanonicalHostNamein classCommSystemFacade- Parameters:
ipAddress- IP address to resolve, or null/"null" to return null- Returns:
- hostname, org name from ASN database, or null for invalid input
getCanonicalHostNameSync
The canonical host name for the given IP address, resolved synchronously.- Overrides:
getCanonicalHostNameSyncin classCommSystemFacade- Parameters:
ipAddress- the IP address to look up- Returns:
- the canonical host name
getLocalHostName
Fast hostname lookup that never blocks on I/O (MMDB or network). Returns cached result if available and useful. On cache miss, queues a background job that does ASN org name lookup (MMDB file read + regex normalization) and optional RDNS, then returns null immediately — page rendering is never blocked.- Overrides:
getLocalHostNamein classCommSystemFacade- Parameters:
ipAddress- the address to resolve, as text- Returns:
- cached hostname/ASN org name, or null if not yet resolved
startup
public void startup()Start the communication system and all transport protocols.This method initializes the communication system, starts all configured transports, and begins network operations. It handles transport discovery, address configuration, and peer management setup.
Startup Process:
- Initialize geographic IP filtering
- Start network monitoring
- Register and start all configured transports
- Begin peer discovery and connection attempts
- Setup address change notifications
- Throws:
IllegalStateException- if already running
shutdown
public void shutdown()Cannot be restarted after calling this. Userestart()for that.Gracefully shutdown the communication system.
This method performs a clean shutdown of all transport protocols and network operations. It stops accepting new connections, closes existing ones, and performs cleanup of system resources.
Shutdown Process:
- Stop network monitoring
- Stop all transport protocols
- Close all active connections
- Cleanup system resources and caches
- Save final state and statistics
- Throws:
IllegalStateException- if not running
restart
public void restart()Restart the communication system.This method performs a complete restart of all transport protocols while preserving router state. It stops all transports, reinitializes system components, and restarts network operations.
Restart Process:
- Stop all transport protocols gracefully
- Reinitialize system components
- Restart transports with preserved state
- Resume network operations and monitoring
- Reconfigure address management
- Throws:
IllegalStateException- if not running
isRunning
public boolean isRunning()Whether the comm system is running.- Overrides:
isRunningin classCommSystemFacade- Returns:
- true if start() has been called and not stopped or restarted
countActivePeers
public int countActivePeers()How many peers are we currently connected to, that we have sent a message to or received a message from in the last minute.- Specified by:
countActivePeersin classCommSystemFacade- Returns:
- the number of active peers
countActiveSendPeers
public int countActiveSendPeers()How many peers we have sent a message to in the last minute.Narrower than
CommSystemFacade.countActivePeers()in both respects that matter: send only, and a one-minute window rather than the transport's active window. The pair answers different questions - how many peers we can reach against how many we are actually driving traffic to right now.The javadoc on this method said "in the last minute" already, while
countActivePeers()above it says five. Only the latter is inaccurate: every transport's active window is sixty seconds. The send-only count is the one this declares, per transport.- Specified by:
countActiveSendPeersin classCommSystemFacade- Returns:
- the number of peers sent to in the last minute
haveInboundCapacity
public boolean haveInboundCapacity(int pct) Whether we have capacity to handle an inbound message at the given percentage.- Overrides:
haveInboundCapacityin classCommSystemFacade- Parameters:
pct- percentage of bandwidth currently in use- Returns:
- true if capacity is available
haveOutboundCapacity
public boolean haveOutboundCapacity(int pct) Whether we have capacity to handle an outbound message at the given percentage.- Overrides:
haveOutboundCapacityin classCommSystemFacade- Parameters:
pct- percentage of bandwidth currently in use- Returns:
- true if capacity is available
haveHighOutboundCapacity
public boolean haveHighOutboundCapacity()Whether we have high outbound capacity.- Overrides:
haveHighOutboundCapacityin classCommSystemFacade- Returns:
- true if high outbound capacity is available
getFramedAveragePeerClockSkew
public long getFramedAveragePeerClockSkew(int percentToInclude) The framed average clock skew of connected peers in milliseconds, or the clock offset if we cannot answer. A positive number means our clock is ahead of theirs. Todo: change List to milliseconds.- Overrides:
getFramedAveragePeerClockSkewin classCommSystemFacade- Parameters:
percentToInclude- 1-100- Returns:
- The framed average clock skew of connected peers in milliseconds, or the clock offset if we cannot answer. Average is calculated over the middle "percentToInclude" peers.
processMessage
Process and route an outbound message through the transport system.This method is the central entry point for sending messages to other I2P peers. It selects appropriate transport, handles message queuing, and manages delivery tracking.
Message Processing:
- Transport selection based on destination
- Message validation and filtering
- Queueing and throttling
- Delivery status tracking
- Failure handling and retry logic
- Callback execution for send completion
- Specified by:
processMessagein classCommSystemFacade- Parameters:
msg- the outbound message to be processed and delivered
isBacklogged
Whether the given peer is backlogged.- Overrides:
isBackloggedin classCommSystemFacade- Parameters:
peer- the router to test, identified by its router identity hash- Returns:
- true if we have messages queued for the peer, awaiting responses
isEstablished
Whether the given peer is established.- Specified by:
isEstablishedin classCommSystemFacade- Parameters:
peer- the router to test, identified by its router identity hash- Returns:
- true if the transport session to the peer is up
wasFailsafeClosed
Whether the peer's most recent connection was closed by the failsafe.- Specified by:
wasFailsafeClosedin classCommSystemFacade- Parameters:
peer- the peer to ask about, non-nullwithinMs- how far back counts as recent in ms; non-positive means nothing is recent- Returns:
- true when some transport closed a session to the peer that recently
getEstablished
Established peers.- Specified by:
getEstablishedin classCommSystemFacade- Returns:
- a new list, may be modified
wasUnreachable
Whether the given peer was recently unreachable.- Overrides:
wasUnreachablein classCommSystemFacade- Parameters:
peer- the router to test, identified by its router identity hash- Returns:
- true if the peer was unreachable
isConnecting
Whether we are currently connecting to the given peer.- Overrides:
isConnectingin classCommSystemFacade- Parameters:
peer- hash of the peer to check- Returns:
- true if a connection attempt to the peer is in progress
getIP
The known IP address of the given peer.- Overrides:
getIPin classCommSystemFacade- Parameters:
peer- the destination hash to resolve; no entry means null is returned- Returns:
- the IP address
mayDisconnect
Tell the comm system that we may disconnect from this peer. This is advisory only.- Overrides:
mayDisconnectin classCommSystemFacade- Parameters:
peer- the peer we may drop
forceDisconnect
Tell the comm system to disconnect from this peer.- Overrides:
forceDisconnectin classCommSystemFacade- Parameters:
peer- the peer to disconnect from
forceDisconnect
Force an immediate disconnect from the given peer with the given reason.- Overrides:
forceDisconnectin classCommSystemFacade- Parameters:
peer- the router to disconnect from, identified by its router identity hashreason- reason for disconnection (for logging), may be null
getMostRecentErrorMessages
The status of the communication system.- Overrides:
getMostRecentErrorMessagesin classCommSystemFacade- Returns:
- most recent error messages, most recent first
getStatus
The current network status.- Overrides:
getStatusin classCommSystemFacade- Returns:
- the router reachability status
getLocalizedStatusString
The localized status string fromgetStatus().toStatusString(), translated if available.- Overrides:
getLocalizedStatusStringin classCommSystemFacade- Returns:
- the localized status string
renderStatusHTML
Render the status of the transport manager to the console as HTML.As of 0.9.31, only outputs UPnP status.
Warning - blocking, very slow, queries the active UPnP router, will take many seconds if it has vanished.
- Overrides:
renderStatusHTMLin classCommSystemFacade- Parameters:
out- receives the HTML for this transport's status sectionurlBase- base URL for links, may be nullsortFlags- flags controlling sort order- Throws:
IOException- on write error
getTransports
Transports in use.- Overrides:
getTransportsin classCommSystemFacade- Returns:
- SortedMap of style to Transport (a copy)
createAddresses
Create router addresses for all configured transport protocols.This method generates RouterAddress objects for each transport protocol based on current configuration and network conditions. It handles address discovery, validation, and format conversion.
Address Creation:
- Iterates through all registered transports
- Gets current addresses from each transport
- Validates address format and consistency
- Handles IPv4 and IPv6 address generation
- Applies geographic and network filtering
- Overrides:
createAddressesin classCommSystemFacade- Returns:
- list of RouterAddress objects for all active transports, may be empty if no addresses available
notifyReplaceAddress
UDP changed addresses, tell NTCP and restart All the work moved toNTCPTransport.externalAddressReceived(Transport.AddressSource, byte[], int).- Overrides:
notifyReplaceAddressin classCommSystemFacade- Parameters:
udpAddr- may be null; or udpAddr's host/IP may be null
notifyRemoveAddress
Tell other transports our address changed.- Overrides:
notifyRemoveAddressin classCommSystemFacade- Parameters:
address- may be null; or address's host/IP may be null
notifyRemoveAddress
public void notifyRemoveAddress(boolean ipv6) Tell other transports our address changed.- Overrides:
notifyRemoveAddressin classCommSystemFacade- Parameters:
ipv6- true to remove the IPv6 address, false for IPv4
exemptIncoming
Exempt this router hash from any incoming throttles or rejections.- Overrides:
exemptIncomingin classCommSystemFacade- Parameters:
peer- the router to exempt
isExemptIncoming
Is this IP exempt from any incoming throttles or rejections.- Overrides:
isExemptIncomingin classCommSystemFacade- Parameters:
ip- canonical string- Returns:
- whether exempt incoming
removeExemption
Remove this IP from the exemptions.- Overrides:
removeExemptionin classCommSystemFacade- Parameters:
ip- canonical string
registerTransport
Pluggable transports. Not for NTCP or SSU.Do not call from transport constructor. Transport must be ready to be started.
Following transport methods will be called: setListener() externalAddressReceived() (zero or more times, one for each known address) startListening();
- Overrides:
registerTransportin classCommSystemFacade- Parameters:
t- the transport to register
unregisterTransport
Pluggable transports. Not for NTCP or SSU.Following transport methods will be called: setListener(null) stopListening();
- Overrides:
unregisterTransportin classCommSystemFacade- Parameters:
t- the transport to unregister
getXDHFactory
Factory for making X25519 key pairs.- Overrides:
getXDHFactoryin classCommSystemFacade- Returns:
- the XDHE factory
initGeoIP
public void initGeoIP()Router must call after netdb is initialized.- Overrides:
initGeoIPin classCommSystemFacade
startGeoIP
private void startGeoIP()Router must call after netdb is initialized. Starts the recurring country-lookup pipeline; the reverse-DNS cache file is loaded once the GeoIP queue has had a chance to settle.getOurCountry
Country code for this router, from the GeoIP lookup.- Overrides:
getOurCountryin classCommSystemFacade- Returns:
- two-letter lower-case country code or null
isInStrictCountry
public boolean isInStrictCountry()Are we in a strict country.- Overrides:
isInStrictCountryin classCommSystemFacade- Returns:
- whether in strict country
isInStrictCountry
Are they in a strict country.- Overrides:
isInStrictCountryin classCommSystemFacade- Parameters:
peer- hash of the peer to look up- Returns:
- whether in strict country
isInStrictCountry
Are they in a strict country.- Overrides:
isInStrictCountryin classCommSystemFacade- Parameters:
ri- RouterInfo of the peer, used for IP extraction- Returns:
- whether in strict country
getCountry
Uses the transport IP first because that lookup is fast, then the IP from the netDb. Not recommended for our local router hash, as we may not be either in the cache or netdb, or may not be publishing an IP.As of 0.9.32, works only for literal IPs, returns null for hostnames.
- Overrides:
getCountryin classCommSystemFacade- Parameters:
peer- not ourselves - usegetOurCountry()for that- Returns:
- two-letter lower-case country code or xx for non-banned peers, or null otherwise
getCountry
The two-letter country code for an IP address string.- Overrides:
getCountryin classCommSystemFacade- Parameters:
ip- IP address string- Returns:
- two-letter country code or null if unknown
getCountryName
Full name for a country code.- Overrides:
getCountryNamein classCommSystemFacade- Parameters:
c- the two letter country code to resolve- Returns:
- full name or the code if unknown
getCountries
Provides country code mappings.- Overrides:
getCountriesin classCommSystemFacade- Returns:
- Unmodifiable map of lower-case country codes to untranslated names
queueLookup
public void queueLookup(byte[] ip) Queue all current destination for lookup. For internal use only.- Overrides:
queueLookupin classCommSystemFacade- Parameters:
ip- full 128 bit ip address
getDomain
getValidIP
Return first valid IP (v4 or v6) we find, any transport.- Parameters:
ri- RouterInfo whose addresses are examined in order until one parses as a valid address- Returns:
- IP or null
getCompatibleIP
IP address compatible with our capabilities (IPv4/IPv6).- Parameters:
ri- RouterInfo to get IP from- Returns:
- IP or null
renderPeerHTML
Renders HTML for a peer with optional extended info. Uses cached RouterInfo, country info, and reverse lookup cache.- Overrides:
renderPeerHTMLin classCommSystemFacade- Parameters:
peer- hash of the peer to renderextended- Whether to show extended capabilities- Returns:
- HTML snippet representing peer
renderPeerFlag
Render the HTML flag image for the given peer.- Overrides:
renderPeerFlagin classCommSystemFacade- Parameters:
peer- the router whose country is shown, identified by its router identity hash- Returns:
- HTML string for the flag
renderPeerCaps
Renders the peer's capability HTML block. Caches data and removes unnecessary repeated computation.- Overrides:
renderPeerCapsin classCommSystemFacade- Parameters:
peer- hash of the peer to renderinline- If true, render inline without table wrapper- Returns:
- HTML snippet of peer capabilities
isDummy
public boolean isDummy()Is everything disabled for testing?- Overrides:
isDummyin classCommSystemFacade- Returns:
- true if the
i2np.disableproperty is set
startTimestamper
private void startTimestamper()Start the backup timestamper.startNetMonitor
private void startNetMonitor()Start the network monitor.