Package net.i2p.router.transport
Class CommSystemFacadeImpl
java.lang.Object
net.i2p.router.CommSystemFacade
net.i2p.router.transport.CommSystemFacadeImpl
- All Implemented Interfaces:
Service
-
Nested Class Summary
Nested classes/interfaces inherited from class net.i2p.router.CommSystemFacade
CommSystemFacade.Status -
Field Summary
Fields inherited from class net.i2p.router.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_UNKNOWN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintHow many peers are we currently connected to, that we have sent a message to or received a message from in the last five minutes.intHow many peers are we currently connected to, that we have sent a message to in the last minute.Create the list of RouterAddress structures based on the router's configvoidforceDisconnect(Hash peer) Tell the comm system to disconnect from this peer.Get the country code mapgetCountry(Hash peer) Uses the transport IP first because that lookup is fast, then the IP from the netDb.full name for a country code, or the code if we don't know the nameHook for pluggable transport creation.Get all the peers we are connected to.longgetFramedAveragePeerClockSkew(int percentToInclude) Return framed average clock skew of connected peers in seconds, or null if we cannot answer.byte[]getStatus().toStatusString(), translated if available.Determine under what conditions we are remotely reachable.Factory for making X25519 key pairs.booleanbooleanhaveInboundCapacity(int pct) booleanhaveOutboundCapacity(int pct) voidRouter must call after netdb is initializedbooleanisBacklogged(Hash peer) booleanisDummy()Is everything disabled for testing?booleanisEstablished(Hash peer) booleanAre we in a strict countrybooleanisInStrictCountry(Hash peer) Are they in a strict country.booleanAre they in a strict countrybooleanvoidmayDisconnect(Hash peer) Tell the comm system that we may disconnect from this peer.voidnotifyRemoveAddress(boolean ipv6) Tell other transports our address changedvoidnotifyRemoveAddress(RouterAddress address) Tell other transports our address changedvoidnotifyReplaceAddress(RouterAddress udpAddr) UDP changed addresses, tell NTCP and restart All the work moved to NTCPTransport.externalAddressReceived()voidSend the message outvoidqueueLookup(byte[] ip) voidDeprecated.unusedvoidPluggable transports.renderPeerHTML(Hash peer) Provide a consistent "look" for displaying router IDs in the consolevoidrenderStatusHTML(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.voidrestart()Perform a soft restart.voidshutdown()Cannot be restarted after calling this.voidstartup()Instruct the service that it should start normal operation.voidPluggable transports.booleanwasUnreachable(Hash peer) Methods inherited from class net.i2p.router.CommSystemFacade
getMedianPeerClockSkew, getReachabilityStatus, renderStatusHTML
-
Constructor Details
-
CommSystemFacadeImpl
-
-
Method Details
-
startup
public void startup()Description copied from interface:ServiceInstruct the service that it should start normal operation. This call DOES block until the service is ready. -
shutdown
public void shutdown()Cannot be restarted after calling this. Use restart() for that. -
restart
public void restart()Description copied from interface:ServicePerform a soft restart. -
isRunning
public boolean isRunning()- Overrides:
isRunningin classCommSystemFacade- Since:
- 0.9.53
-
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 five minutes.- Specified by:
countActivePeersin classCommSystemFacade
-
countActiveSendPeers
public int countActiveSendPeers()How many peers are we currently connected to, that we have sent a message to in the last minute. Unused for anything, to be removed.- Specified by:
countActiveSendPeersin classCommSystemFacade
-
haveInboundCapacity
public boolean haveInboundCapacity(int pct) - Overrides:
haveInboundCapacityin classCommSystemFacade
-
haveOutboundCapacity
public boolean haveOutboundCapacity(int pct) - Overrides:
haveOutboundCapacityin classCommSystemFacade
-
haveHighOutboundCapacity
public boolean haveHighOutboundCapacity()- Overrides:
haveHighOutboundCapacityin classCommSystemFacade
-
getFramedAveragePeerClockSkew
public long getFramedAveragePeerClockSkew(int percentToInclude) Description copied from class:CommSystemFacadeReturn framed average clock skew of connected peers in seconds, or null if we cannot answer. CommSystemFacadeImpl overrides this.- Overrides:
getFramedAveragePeerClockSkewin classCommSystemFacade- Parameters:
percentToInclude- 1-100- Returns:
- 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. A positive number means our clock is ahead of theirs. Todo: change List to milliseconds
-
processMessage
Send the message out- Specified by:
processMessagein classCommSystemFacade
-
isBacklogged
- Overrides:
isBackloggedin classCommSystemFacade
-
isEstablished
- Specified by:
isEstablishedin classCommSystemFacade
-
getEstablished
Description copied from class:CommSystemFacadeGet all the peers we are connected to. This should be more efficient than repeated calls to isEstablished() if you have to check a lot.- Specified by:
getEstablishedin classCommSystemFacade- Returns:
- a new set, may be modified
- Since:
- 0.9.34
-
wasUnreachable
- Overrides:
wasUnreachablein classCommSystemFacade
-
getIP
- Overrides:
getIPin classCommSystemFacade
-
mayDisconnect
Tell the comm system that we may disconnect from this peer. This is advisory only.- Overrides:
mayDisconnectin classCommSystemFacade- Since:
- 0.9.24
-
forceDisconnect
Tell the comm system to disconnect from this peer.- Overrides:
forceDisconnectin classCommSystemFacade- Since:
- 0.9.38
-
getMostRecentErrorMessages
- Overrides:
getMostRecentErrorMessagesin classCommSystemFacade
-
getStatus
Description copied from class:CommSystemFacadeDetermine under what conditions we are remotely reachable.- Overrides:
getStatusin classCommSystemFacade- Since:
- 0.9.20
-
getLocalizedStatusString
getStatus().toStatusString(), translated if available.- Overrides:
getLocalizedStatusStringin classCommSystemFacade- Since:
- 0.9.45
-
recheckReachability
Deprecated.unused- Overrides:
recheckReachabilityin classCommSystemFacade
-
renderStatusHTML
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- Throws:
IOException
-
getTransports
- Overrides:
getTransportsin classCommSystemFacade- Returns:
- SortedMap of style to Transport (a copy)
- Since:
- 0.9.31
-
createAddresses
Description copied from class:CommSystemFacadeCreate the list of RouterAddress structures based on the router's config- Overrides:
createAddressesin classCommSystemFacade- Returns:
- non-null, possibly empty
-
notifyReplaceAddress
UDP changed addresses, tell NTCP and restart All the work moved to NTCPTransport.externalAddressReceived()- 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- Since:
- 0.9.20
-
notifyRemoveAddress
public void notifyRemoveAddress(boolean ipv6) Tell other transports our address changed- Overrides:
notifyRemoveAddressin classCommSystemFacade- Since:
- 0.9.20
-
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- Since:
- 0.9.16
-
unregisterTransport
Pluggable transports. Not for NTCP or SSU. Following transport methods will be called: setListener(null) stoptListening();- Overrides:
unregisterTransportin classCommSystemFacade- Since:
- 0.9.16
-
getDHFactory
Hook for pluggable transport creation.- Overrides:
getDHFactoryin classCommSystemFacade- Since:
- 0.9.16
-
getXDHFactory
Factory for making X25519 key pairs.- Overrides:
getXDHFactoryin classCommSystemFacade- Since:
- 0.9.46
-
initGeoIP
public void initGeoIP()Router must call after netdb is initialized- Overrides:
initGeoIPin classCommSystemFacade- Since:
- 0.9.41
-
queueLookup
public void queueLookup(byte[] ip) - Overrides:
queueLookupin classCommSystemFacade- Parameters:
ip- ipv4 or ipv6
-
getOurCountry
- Overrides:
getOurCountryin classCommSystemFacade- Returns:
- two-letter lower-case country code or null
- Since:
- 0.8.11
-
isInStrictCountry
public boolean isInStrictCountry()Are we in a strict country- Overrides:
isInStrictCountryin classCommSystemFacade- Since:
- 0.8.13
-
isInStrictCountry
Are they in a strict country. 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.- Overrides:
isInStrictCountryin classCommSystemFacade- Parameters:
peer- non-null- Since:
- 0.9.16
-
isInStrictCountry
Are they in a strict country- Overrides:
isInStrictCountryin classCommSystemFacade- Parameters:
ri- non-null- Since:
- 0.9.16
-
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 - use getOurCountry() for that- Returns:
- two-letter lower-case country code or null
-
getCountryName
full name for a country code, or the code if we don't know the name- Overrides:
getCountryNamein classCommSystemFacade
-
getCountries
Get the country code map- Overrides:
getCountriesin classCommSystemFacade- Returns:
- Map of two-letter lower case code to untranslated country name, unmodifiable
- Since:
- 0.9.53
-
renderPeerHTML
Provide a consistent "look" for displaying router IDs in the console- Overrides:
renderPeerHTMLin classCommSystemFacade
-
isDummy
public boolean isDummy()Is everything disabled for testing?- Overrides:
isDummyin classCommSystemFacade- Since:
- 0.8.13
-