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()countRdnsCacheEntries. |
List<RouterAddress> | createAddresses()Create router addresses for all configured transport protocols. |
boolean | enableReverseLookups()enableReverseLookups. |
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)forceDisconnect. |
String | getCanonicalHostName(String ipAddress)Returns the canonical hostname for the given IP address from cache or DNS. |
String | getCanonicalHostNameSync(String ipAddress)Synchronous canonical hostname lookup for the given IP. |
static byte[] | getCompatibleIP(RouterInfo ri)Get an 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)Get 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) |
List<Hash> | getEstablished()Get all the peers we are connected to. |
long | getFramedAveragePeerClockSkew(int percentToInclude)Return framed average clock skew of connected peers in seconds, or null if we cannot answer. |
byte[] | getIP(Hash peer)Get the IP address associated with the given destination. |
String | getLocalHostName(String ipAddress)Fast hostname lookup that never blocks on I/O (MMDB or network). |
String | getLocalizedStatusString()getStatus().toStatusString(), translated if available. |
static int | getMaxRdnsCacheSize() |
List<String> | getMostRecentErrorMessages()Retrieve recent transport-related error messages for display in the console. |
String | getOurCountry()Our two-letter country code determined from our external IP. |
int | getRdnsActiveCount()Returns rDNS executor active thread count, or 0 if not running. |
static String | getRdnsCacheStats()Get cache statistics for monitoring |
static int | getRdnsCorePoolSize()Get the rDNS executor core pool size. |
static int | getRdnsMaxPoolSize()Get 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()Determine under what conditions we are remotely reachable. |
SortedMap<String,Transport> | getTransports()Registered transports by style name. |
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()haveHighOutboundCapacity. |
boolean | haveInboundCapacity(int pct)haveInboundCapacity. |
boolean | haveOutboundCapacity(int pct)haveOutboundCapacity. |
void | initGeoIP()Router must call after netdb is initialized |
boolean | isBacklogged(Hash peer)Check whether the given peer has excessive pending outbound messages. |
boolean | isConnecting(Hash peer)Check if any transport has a connection attempt in progress
for the given peer (handshake started but not yet complete). |
boolean | isDummy()Is everything disabled for testing? |
boolean | isEstablished(Hash peer)Check whether a transport connection exists with the given peer. |
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 fully initialized and 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)Queue a reverse-DNS lookup for the given IP address. |
static String | rdnsCacheSize()rdnsCacheSize. |
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)renderPeerFlag. |
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)Set the rDNS executor core pool size, bounded 2-8. |
static void | setRdnsMaxPoolSize(int size)Set 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)wasUnreachable. |
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()
public 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)
CommSystemFacadegetCanonicalHostNameSync 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()
CommSystemFacadegetEstablished in class CommSystemFacadepublic long getFramedAveragePeerClockSkew(int percentToInclude)
CommSystemFacadegetFramedAveragePeerClockSkew in class CommSystemFacadepercentToInclude - 1-100public byte[] getIP(Hash peer)
CommSystemFacadegetIP 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()
CommSystemFacadegetMostRecentErrorMessages in class CommSystemFacadepublic String getOurCountry()
CommSystemFacadegetOurCountry 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()
CommSystemFacadegetStatus in class CommSystemFacadepublic SortedMap<String,Transport> getTransports()
CommSystemFacadegetTransports 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)
CommSystemFacadeisBacklogged in class CommSystemFacadepeer - the peerpublic boolean isConnecting(Hash peer)
CommSystemFacadeisConnecting in class CommSystemFacadepeer - hash of the peer to checkpublic boolean isDummy()
isDummy in class CommSystemFacadepublic boolean isEstablished(Hash peer)
CommSystemFacadeisEstablished 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()
CommSystemFacadeisRunning 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)
CommSystemFacadequeueLookup 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