public class CommSystemFacadeImpl extends CommSystemFacade
| Modifier and Type | Class and Description |
|---|---|
static class |
CommSystemFacadeImpl.CacheEntry
Cache entry for IP address and hostname mappings.
|
CommSystemFacade.Status| Modifier and Type | Field and Description |
|---|---|
static String |
PROP_BLOCK_MY_COUNTRY |
static String |
PROP_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) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
int |
countActiveSendPeers()
How many peers are we currently connected to, that we have
sent a message to in the last minute.
|
static int |
countRdnsCacheEntries() |
List<RouterAddress> |
createAddresses()
Create router addresses for all configured transport protocols.
|
boolean |
enableReverseLookups() |
boolean |
enableWhoisLookups() |
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.
|
String |
getCanonicalHostName(String ipAddress)
Returns the canonical hostname for the given IP address from cache or DNS.
|
String |
getCanonicalHostNameSync(String ipAddress) |
static byte[] |
getCompatibleIP(RouterInfo ri)
Return the first IP compatible with our outbound transports.
|
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 |
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) |
String |
getLocalizedStatusString()
getStatus().toStatusString(), translated if available.
|
List<String> |
getMostRecentErrorMessages() |
String |
getOurCountry() |
static String |
getRdnsCacheStats()
Get cache statistics for monitoring
|
CommSystemFacade.Status |
getStatus()
Determine under what conditions we are remotely reachable.
|
SortedMap<String,Transport> |
getTransports() |
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() |
boolean |
haveInboundCapacity(int pct) |
boolean |
haveOutboundCapacity(int pct) |
void |
initGeoIP()
Router must call after netdb is initialized
|
boolean |
isBacklogged(Hash peer) |
boolean |
isDummy()
Is everything disabled for testing?
|
boolean |
isEstablished(Hash 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() |
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) |
static String |
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) |
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.
|
void |
shutdown()
Gracefully shutdown the communication system.
|
void |
startup()
Start the communication system and all transport protocols.
|
void |
unregisterTransport(Transport t)
Pluggable transports.
|
boolean |
wasUnreachable(Hash peer) |
getMedianPeerClockSkew, renderStatusHTMLpublic static final String PROP_BLOCK_MY_COUNTRY
public static final String PROP_IP_COUNTRY
public CommSystemFacadeImpl(RouterContext context)
public int countActivePeers()
countActivePeers in class CommSystemFacadepublic int countActiveSendPeers()
countActiveSendPeers in class CommSystemFacadepublic static int countRdnsCacheEntries()
public List<RouterAddress> createAddresses()
createAddresses in class CommSystemFacadepublic boolean enableReverseLookups()
public boolean enableWhoisLookups()
public void exemptIncoming(Hash peer)
exemptIncoming in class CommSystemFacadepublic void forceDisconnect(Hash peer)
forceDisconnect in class CommSystemFacadepublic 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 CommSystemFacadepublic static byte[] getCompatibleIP(RouterInfo ri)
public 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 string (IPv4 or IPv6)public String getCountryName(String c)
getCountryName in class CommSystemFacadepublic 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)
getIP in class CommSystemFacadepublic String getLocalizedStatusString()
getLocalizedStatusString in class CommSystemFacadepublic List<String> getMostRecentErrorMessages()
getMostRecentErrorMessages in class CommSystemFacadepublic String getOurCountry()
getOurCountry in class CommSystemFacadepublic static String getRdnsCacheStats()
public CommSystemFacade.Status getStatus()
CommSystemFacadegetStatus 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 CommSystemFacadepublic boolean haveOutboundCapacity(int pct)
haveOutboundCapacity in class CommSystemFacadepublic void initGeoIP()
initGeoIP in class CommSystemFacadepublic boolean isBacklogged(Hash peer)
isBacklogged in class CommSystemFacadepublic boolean isDummy()
isDummy in class CommSystemFacadepublic boolean isEstablished(Hash peer)
isEstablished in class CommSystemFacadepublic 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 CommSystemFacadepublic 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 CommSystemFacadeIOExceptionpublic void restart()
IllegalStateException - if not runningpublic 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 CommSystemFacade