public abstract class CommSystemFacade extends Object implements Service
| Modifier and Type | Class and Description |
|---|---|
static class | CommSystemFacade.StatusNetwork connectivity status enumeration for IPv4 and IPv6 transport capabilities. |
| Modifier and Type | Field and Description |
|---|---|
protected static String | ROUTER_BUNDLE_NAME |
static short | STATUS_DIFFERENTWe are behind a symmetric NAT which will make our 'from' address look
differently when we talk to multiple people |
static short | STATUS_DISCONNECTEDWe have no network interface at all enabled transports |
static short | STATUS_HOSEDOur detection system is broken (SSU bind port failed) |
static short | STATUS_IPV4_DISABLED_IPV6_FIREWALLEDWe have an IPv6 transport enabled and a public IPv6 address. |
static short | STATUS_IPV4_DISABLED_IPV6_OKWe have an IPv6 transport enabled and a public IPv6 address. |
static short | STATUS_IPV4_DISABLED_IPV6_UNKNOWNWe have an IPv6 transport enabled and a public IPv6 address. |
static short | STATUS_IPV4_FIREWALLED_IPV6_OKWe have an IPv6 transport enabled and a public IPv6 address. |
static short | STATUS_IPV4_FIREWALLED_IPV6_UNKNOWNWe have an IPv6 transport enabled and a public IPv6 address. |
static short | STATUS_IPV4_OK_IPV6_FIREWALLEDWe have an IPv6 transport enabled and a public IPv6 address. |
static short | STATUS_IPV4_OK_IPV6_UNKNOWNWe have an IPv6 transport enabled and a public IPv6 address. |
static short | STATUS_IPV4_SNAT_IPV6_OKWe 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 short | STATUS_IPV4_SNAT_IPV6_UNKNOWNWe 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 short | STATUS_IPV4_UNKNOWN_IPV6_FIREWALLEDWe have an IPv6 transport enabled and a public IPv6 address. |
static short | STATUS_IPV4_UNKNOWN_IPV6_OKWe have an IPv6 transport enabled and a public IPv6 address. |
static short | STATUS_OKThese must be increasing in "badness" (see TransportManager.java),
but UNKNOWN must be last. |
static short | STATUS_REJECT_UNSOLICITEDWe are able to talk to peers that we initiate communication with, but
cannot receive unsolicited connections, i.e. |
static short | STATUS_UNKNOWNOur reachability is unknown on all |
| Modifier | Constructor and Description |
|---|---|
protected | CommSystemFacade() |
| Modifier and Type | Method and Description |
|---|---|
abstract 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 five minutes. |
List<RouterAddress> | createAddresses()Create the list of RouterAddress structures based on the router's config |
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)Tell the comm system to disconnect from this peer with a reason. |
String | getCanonicalHostName(String ipAddress)Look up the canonical hostname for the given IP, blocking on DNS if necessary. |
String | getCanonicalHostNameSync(String ipAddress)Synchronous canonical hostname lookup for the given IP. |
Map<String,String> | getCountries()Get the country code map |
String | getCountry(Hash peer)Get the two-letter country code for the given peer's IP address. |
String | getCountry(String ip)Get the two-letter country code for the given IP address. |
String | getCountryName(String code)Resolve a two-letter country code to its full country name. |
abstract 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 dest)Get the IP address associated with the given destination. |
String | getLocalHostName(String ipAddress)Fast hostname lookup that never blocks on network DNS. |
String | getLocalizedStatusString()Localized reachability status string. |
Long | getMedianPeerClockSkew()Median clock skew of connected peers in seconds, or null if we cannot answer. |
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. |
CommSystemFacade.Status | getStatus()Determine under what conditions we are remotely reachable. |
SortedMap<String,Transport> | getTransports()Registered transports by style name. |
X25519KeyFactory | getXDHFactory()Factory for making X25519 key pairs. |
boolean | haveHighOutboundCapacity()Report whether outbound bandwidth is operating well below its limit. |
boolean | haveInboundCapacity(int pct)Report whether inbound bandwidth has capacity for the given percentage load. |
boolean | haveOutboundCapacity(int pct)Report whether outbound bandwidth has capacity for the given percentage load. |
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()Whether this is a dummy implementation with no real transports. |
abstract 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()Whether country blocking is enabled at all. |
boolean | isInStrictCountry(Hash peer)Whether the given peer's country is blocked. |
boolean | isInStrictCountry(RouterInfo ri)Whether the given router's country is blocked. |
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 address)Tell other transports our address changed |
abstract void | processMessage(OutNetMessage msg)Queue an outbound message for delivery through the appropriate transport. |
void | queueLookup(byte[] ip)Queue a reverse-DNS lookup for the given IP address. |
void | registerTransport(Transport t)Register a transport for use by the comm system. |
void | removeExemption(String ip)Remove this IP from the exemptions |
String | renderPeerCaps(Hash peer,
boolean inline)Render the peer's capabilities as HTML, optionally inline. |
String | renderPeerFlag(Hash peer)Render the country flag for the given peer as HTML. |
String | renderPeerHTML(Hash peer,
boolean extended)Render an HTML snippet identifying the given peer, optionally with extended details. |
void | renderStatusHTML(Writer out)Render the transport status section of the router console page with default flags. |
void | renderStatusHTML(Writer out,
String urlBase,
int sortFlags)Render the transport status section of the router console page. |
void | unregisterTransport(Transport t)Unregister a transport from the comm system. |
boolean | wasUnreachable(Hash peer)Check whether the given peer was recently unreachable. |
protected static final String ROUTER_BUNDLE_NAME
public static final short STATUS_DIFFERENT
public static final short STATUS_DISCONNECTED
public static final short STATUS_HOSED
public static final short STATUS_IPV4_DISABLED_IPV6_FIREWALLED
public static final short STATUS_IPV4_DISABLED_IPV6_OK
public static final short STATUS_IPV4_DISABLED_IPV6_UNKNOWN
public static final short STATUS_IPV4_FIREWALLED_IPV6_OK
public static final short STATUS_IPV4_FIREWALLED_IPV6_UNKNOWN
public static final short STATUS_IPV4_OK_IPV6_FIREWALLED
public static final short STATUS_IPV4_OK_IPV6_UNKNOWN
public static final short STATUS_IPV4_SNAT_IPV6_OK
public static final short STATUS_IPV4_SNAT_IPV6_UNKNOWN
public static final short STATUS_IPV4_UNKNOWN_IPV6_FIREWALLED
public static final short STATUS_IPV4_UNKNOWN_IPV6_OK
public static final short STATUS_OK
public static final short STATUS_REJECT_UNSOLICITED
public static final short STATUS_UNKNOWN
public abstract int countActivePeers()
public List<RouterAddress> createAddresses()
public void exemptIncoming(Hash peer)
public void forceDisconnect(Hash peer)
public void forceDisconnect(Hash peer, String reason)
peer - the peerreason - reason for disconnection (for logging), may be nullpublic String getCanonicalHostName(String ipAddress)
ipAddress - the IP address to look uppublic String getCanonicalHostNameSync(String ipAddress)
ipAddress - the IP address to look uppublic Map<String,String> getCountries()
public String getCountry(Hash peer)
peer - the peerpublic String getCountry(String ip)
ip - the IP address to look uppublic String getCountryName(String code)
code - two-letter country codepublic abstract List<Hash> getEstablished()
public long getFramedAveragePeerClockSkew(int percentToInclude)
percentToInclude - percentage of peers to include in the framepublic byte[] getIP(Hash dest)
dest - destination hashpublic String getLocalHostName(String ipAddress)
public String getLocalizedStatusString()
public Long getMedianPeerClockSkew()
public List<String> getMostRecentErrorMessages()
public String getOurCountry()
public CommSystemFacade.Status getStatus()
public SortedMap<String,Transport> getTransports()
public X25519KeyFactory getXDHFactory()
public boolean haveHighOutboundCapacity()
public boolean haveInboundCapacity(int pct)
pct - percentage of bandwidth currently in usepublic boolean haveOutboundCapacity(int pct)
pct - percentage of bandwidth currently in usepublic void initGeoIP()
public boolean isBacklogged(Hash peer)
peer - the peerpublic boolean isConnecting(Hash peer)
peer - hash of the peer to checkpublic boolean isDummy()
public abstract boolean isEstablished(Hash peer)
peer - the peerpublic boolean isExemptIncoming(String ip)
public boolean isInStrictCountry()
public boolean isInStrictCountry(Hash peer)
peer - peer to checkpublic boolean isInStrictCountry(RouterInfo ri)
ri - router info to checkpublic boolean isRunning()
public void mayDisconnect(Hash peer)
public void notifyRemoveAddress(boolean ipv6)
public void notifyRemoveAddress(RouterAddress address)
public void notifyReplaceAddress(RouterAddress address)
public abstract void processMessage(OutNetMessage msg)
msg - the message to sendpublic void queueLookup(byte[] ip)
ip - IP address bytes to look uppublic void registerTransport(Transport t)
public void removeExemption(String ip)
public String renderPeerCaps(Hash peer, boolean inline)
peer - the peerinline - if true render inlinepublic String renderPeerFlag(Hash peer)
peer - the peerpublic String renderPeerHTML(Hash peer, boolean extended)
peer - the peerextended - if true include extended informationpublic void renderStatusHTML(Writer out) throws IOException
renderStatusHTML in interface Serviceout - destination writerIOException - on write errorpublic void renderStatusHTML(Writer out, String urlBase, int sortFlags) throws IOException
out - destination writerurlBase - base URL for links, may be nullsortFlags - flags controlling sort orderIOException - on write errorpublic void unregisterTransport(Transport t)
public boolean wasUnreachable(Hash peer)
peer - the peer