public class CommSystemFacadeImpl extends CommSystemFacade
| Modifier and Type | Class and Description |
|---|---|
static class | CommSystemFacadeImpl.CacheEntryCache entry for IP address and hostname mappings. |
CommSystemFacade.Status| Modifier and Type | Field and Description |
|---|---|
static String | PROP_BLOCK_MY_COUNTRYPROP_BLOCK_MY_COUNTRY. |
static String | PROP_IP_COUNTRYPROP_IP_COUNTRY. |
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_UNKNOWN| Constructor and Description |
|---|
CommSystemFacadeImpl(RouterContext context)CommSystemFacadeImpl. |
| Modifier and Type | Method and Description |
|---|---|
void | adjustRdnsPool(int coreSize)Adjust the running rDNS executor pool sizes. |
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. |
static int | countRdnsCacheEntries()The number of entries in the rDNS cache. |
List<RouterAddress> | createAddresses()Create router addresses for all configured transport protocols. |
boolean | enableReverseLookups()Whether reverse lookups are enabled. |
void | exemptIncoming(Hash peer)Exempt this router hash from any incoming throttles or rejections |
void | forceDisconnect(Hash peer)Tell the comm system to disconnect from this peer. |
void | forceDisconnect(Hash peer,
String reason)Force an immediate disconnect from the given peer with the given reason. |
String | getCanonicalHostName(String ipAddress)Canonical hostname for the given IP address from cache or DNS. |
String | getCanonicalHostNameSync(String ipAddress)The canonical host name for the given IP address, resolved synchronously. |
static byte[] | getCompatibleIP(RouterInfo ri)IP address compatible with our capabilities (IPv4/IPv6). |
Map<String,String> | getCountries()Provides country code mappings. |
String | getCountry(Hash peer)Uses the transport IP first because that lookup is fast, then the IP from the netDb. |
String | getCountry(String ip)The two-letter country code for an IP address string. |
String | getCountryName(String c)Full name for a country code, or the code if we don't know the name. |
static String | getDomain(String hostname)Domain name from a reverse DNS hostname. |
List<Hash> | getEstablished()Established peers. |
long | getFramedAveragePeerClockSkew(int percentToInclude)The framed average clock skew of connected peers in milliseconds, or the clock offset if we cannot answer. |
byte[] | getIP(Hash peer)The known IP address of the given peer. |
String | getLocalHostName(String ipAddress)Fast hostname lookup that never blocks on I/O (MMDB or network). |
String | getLocalizedStatusString()The localized status string from getStatus().toStatusString(), translated if available. |
static int | getMaxRdnsCacheSize()The computed maximum rDNS cache size based on available memory. |
List<String> | getMostRecentErrorMessages()The status of the communication system. |
String | getOurCountry()Country code for this router, from the GeoIP lookup. |
int | getRdnsActiveCount()Returns rDNS executor active thread count, or 0 if not running. |
static String | getRdnsCacheStats()Cache statistics for monitoring. |
static int | getRdnsCorePoolSize()The rDNS executor core pool size. |
static int | getRdnsMaxPoolSize()The rDNS executor max pool size. |
int | getRdnsPoolSize()Returns rDNS executor total thread count, or 0 if not running. |
int | getRdnsQueueSize()Returns rDNS executor pending lookup count, or 0 if not running. |
double | getRdnsUtilization()Returns rDNS executor utilization as a ratio (0.0-1.0),
or Double.NaN if not running. |
CommSystemFacade.Status | getStatus()The current network status. |
SortedMap<String,Transport> | getTransports()Transports in use. |
static byte[] | getValidIP(RouterInfo ri)Return first valid IP (v4 or v6) we find, any transport. |
X25519KeyFactory | getXDHFactory()Factory for making X25519 key pairs. |
boolean | haveHighOutboundCapacity()Whether we have high outbound capacity. |
boolean | haveInboundCapacity(int pct)Whether we have capacity to handle an inbound message at the given percentage. |
boolean | haveOutboundCapacity(int pct)Whether we have capacity to handle an outbound message at the given percentage. |
void | initGeoIP()Router must call after netdb is initialized |
boolean | isBacklogged(Hash peer)Whether the given peer is backlogged. |
boolean | isConnecting(Hash peer)Whether we are currently connecting to the given peer. |
boolean | isDummy()Is everything disabled for testing? |
boolean | isEstablished(Hash peer)Whether the given peer is established. |
boolean | isExemptIncoming(String ip)Is this IP exempt from any incoming throttles or rejections |
boolean | isInStrictCountry()Are we in a strict country |
boolean | isInStrictCountry(Hash peer)Are they in a strict country. |
boolean | isInStrictCountry(RouterInfo ri)Are they in a strict country |
boolean | isRunning()Whether the comm system is running. |
void | mayDisconnect(Hash peer)Tell the comm system that we may disconnect from this peer. |
void | notifyRemoveAddress(boolean ipv6)Tell other transports our address changed |
void | notifyRemoveAddress(RouterAddress address)Tell other transports our address changed |
void | notifyReplaceAddress(RouterAddress udpAddr)UDP changed addresses, tell NTCP and restart
All the work moved to NTCPTransport.externalAddressReceived() |
void | processMessage(OutNetMessage msg)Process and route an outbound message through the transport system. |
void | queueLookup(byte[] ip)Queues a GeoIP lookup for the given IP. |
static String | rdnsCacheSize()The size of the rDNS cache file, in KB. |
void | registerTransport(Transport t)Pluggable transports. |
void | removeExemption(String ip)Remove this IP from the exemptions |
String | renderPeerCaps(Hash peer,
boolean inline)Renders the peer's capability HTML block. |
String | renderPeerFlag(Hash peer)Render the HTML flag image for the given peer. |
String | renderPeerHTML(Hash peer,
boolean extended)Renders HTML for a peer with optional extended info. |
void | renderStatusHTML(Writer out,
String urlBase,
int sortFlags)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. |
void | restart()Restart the communication system. |
static void | setRdnsCorePoolSize(int size)The rDNS executor core pool size, bounded 2-8. |
static void | setRdnsMaxPoolSize(int size)The rDNS executor max pool size, bounded 2-8. |
void | shutdown()Cannot be restarted after calling this. |
void | startup()Start the communication system and all transport protocols. |
void | unregisterTransport(Transport t)Pluggable transports. |
boolean | wasUnreachable(Hash peer)Whether the given peer was recently unreachable. |
getMedianPeerClockSkew, renderStatusHTMLpublic static final String PROP_BLOCK_MY_COUNTRY
public static final String PROP_IP_COUNTRY
public CommSystemFacadeImpl(RouterContext context)
public void adjustRdnsPool(int coreSize)
coreSize - new core pool size (bounded 2-8)public int countActivePeers()
countActivePeers in class CommSystemFacadepublic static int countRdnsCacheEntries()
public List<RouterAddress> createAddresses()
createAddresses in class CommSystemFacadepublic boolean enableReverseLookups()
enableReverseLookups in class CommSystemFacadepublic void exemptIncoming(Hash peer)
exemptIncoming in class CommSystemFacadepublic void forceDisconnect(Hash peer)
forceDisconnect in class CommSystemFacadepublic void forceDisconnect(Hash peer, String reason)
forceDisconnect in class CommSystemFacadepeer - the peerreason - reason for disconnection (for logging), may be nullpublic String getCanonicalHostName(String ipAddress)
getCanonicalHostName in class CommSystemFacadeipAddress - IP address to resolve, or null/"null" to return nullpublic String getCanonicalHostNameSync(String ipAddress)
getCanonicalHostNameSync in class CommSystemFacadeipAddress - the IP address to look uppublic static byte[] getCompatibleIP(RouterInfo ri)
ri - RouterInfo to get IP frompublic Map<String,String> getCountries()
getCountries in class CommSystemFacadepublic String getCountry(Hash peer)
getCountry in class CommSystemFacadepeer - not ourselves - use getOurCountry() for thatpublic String getCountry(String ip)
getCountry in class CommSystemFacadeip - IP address stringpublic String getCountryName(String c)
getCountryName in class CommSystemFacadec - two-letter country codepublic static String getDomain(String hostname)
public List<Hash> getEstablished()
getEstablished in class CommSystemFacadepublic long getFramedAveragePeerClockSkew(int percentToInclude)
getFramedAveragePeerClockSkew in class CommSystemFacadepercentToInclude - 1-100public byte[] getIP(Hash peer)
getIP in class CommSystemFacadepeer - destination hashpublic String getLocalHostName(String ipAddress)
getLocalHostName in class CommSystemFacadepublic String getLocalizedStatusString()
getLocalizedStatusString in class CommSystemFacadepublic static int getMaxRdnsCacheSize()
public List<String> getMostRecentErrorMessages()
getMostRecentErrorMessages in class CommSystemFacadepublic String getOurCountry()
getOurCountry in class CommSystemFacadepublic int getRdnsActiveCount()
public static String getRdnsCacheStats()
public static int getRdnsCorePoolSize()
public static int getRdnsMaxPoolSize()
public int getRdnsPoolSize()
public int getRdnsQueueSize()
public double getRdnsUtilization()
Double.NaN if not running.public CommSystemFacade.Status getStatus()
getStatus in class CommSystemFacadepublic SortedMap<String,Transport> getTransports()
getTransports in class CommSystemFacadepublic static byte[] getValidIP(RouterInfo ri)
public X25519KeyFactory getXDHFactory()
getXDHFactory in class CommSystemFacadepublic boolean haveHighOutboundCapacity()
haveHighOutboundCapacity in class CommSystemFacadepublic boolean haveInboundCapacity(int pct)
haveInboundCapacity in class CommSystemFacadepct - percentage of bandwidth currently in usepublic boolean haveOutboundCapacity(int pct)
haveOutboundCapacity in class CommSystemFacadepct - percentage of bandwidth currently in usepublic void initGeoIP()
initGeoIP in class CommSystemFacadepublic boolean isBacklogged(Hash peer)
isBacklogged in class CommSystemFacadepeer - the peerpublic boolean isConnecting(Hash peer)
isConnecting in class CommSystemFacadepeer - hash of the peer to checkpublic boolean isDummy()
isDummy in class CommSystemFacadepublic boolean isEstablished(Hash peer)
isEstablished in class CommSystemFacadepeer - the peerpublic boolean isExemptIncoming(String ip)
isExemptIncoming in class CommSystemFacadeip - canonical stringpublic boolean isInStrictCountry()
isInStrictCountry in class CommSystemFacadepublic boolean isInStrictCountry(Hash peer)
isInStrictCountry in class CommSystemFacadepeer - non-nullpublic boolean isInStrictCountry(RouterInfo ri)
isInStrictCountry in class CommSystemFacaderi - non-nullpublic boolean isRunning()
isRunning in class CommSystemFacadepublic void mayDisconnect(Hash peer)
mayDisconnect in class CommSystemFacadepublic void notifyRemoveAddress(boolean ipv6)
notifyRemoveAddress in class CommSystemFacadepublic void notifyRemoveAddress(RouterAddress address)
notifyRemoveAddress in class CommSystemFacadeaddress - may be null; or address's host/IP may be nullpublic void notifyReplaceAddress(RouterAddress udpAddr)
notifyReplaceAddress in class CommSystemFacadeudpAddr - may be null; or udpAddr's host/IP may be nullpublic void processMessage(OutNetMessage msg)
processMessage in class CommSystemFacademsg - the outbound message to be processed and deliveredpublic void queueLookup(byte[] ip)
queueLookup in class CommSystemFacadeip - ipv4 or ipv6public static String rdnsCacheSize()
public void registerTransport(Transport t)
registerTransport in class CommSystemFacadepublic void removeExemption(String ip)
removeExemption in class CommSystemFacadeip - canonical stringpublic String renderPeerCaps(Hash peer, boolean inline)
renderPeerCaps in class CommSystemFacadepeer - Peer Hashinline - If true, render inline without table wrapperpublic String renderPeerFlag(Hash peer)
renderPeerFlag in class CommSystemFacadepeer - the peerpublic String renderPeerHTML(Hash peer, boolean extended)
renderPeerHTML in class CommSystemFacadepeer - Peer Hashextended - Whether to show extended capabilitiespublic void renderStatusHTML(Writer out, String urlBase, int sortFlags) throws IOException
renderStatusHTML in class CommSystemFacadeout - destination writerurlBase - base URL for links, may be nullsortFlags - flags controlling sort orderIOException - on write errorpublic void restart()
IllegalStateException - if not runningpublic static void setRdnsCorePoolSize(int size)
public static void setRdnsMaxPoolSize(int size)
public void shutdown()
IllegalStateException - if not runningpublic void startup()
IllegalStateException - if already runningpublic void unregisterTransport(Transport t)
unregisterTransport in class CommSystemFacadepublic boolean wasUnreachable(Hash peer)
wasUnreachable in class CommSystemFacadepeer - the peer