public class TransportManager extends Object implements TransportEventListener
Modifier and Type | Class and Description |
---|---|
(package private) static class |
TransportManager.Port |
Modifier and Type | Field and Description |
---|---|
static String |
PROP_ENABLE_NTCP
default true
|
static String |
PROP_ENABLE_UDP
default true
|
static String |
PROP_ENABLE_UPNP
default true
|
Constructor and Description |
---|
TransportManager(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 five minutes.
|
int |
countActiveSendPeers()
How many peers are we currently connected to, that we have
sent a message to in the last minute.
|
void |
externalAddressReceived(Transport.AddressSource source,
byte[] ip,
int port)
Initialize from interfaces, and callback from UPnP or SSU.
|
void |
externalAddressRemoved(Transport.AddressSource source,
boolean ipv6)
Remove all ipv4 or ipv6 addresses.
|
void |
forwardPortStatus(String style,
byte[] ip,
int port,
int externalPort,
boolean success,
String reason)
callback from UPnP
|
List<RouterAddress> |
getAddresses()
This forces a rebuild
|
TransportBid |
getBid(OutNetMessage msg) |
List<TransportBid> |
getBids(OutNetMessage msg) |
Vector<Long> |
getClockSkews()
Return our peer clock skews on all transports.
|
(package private) DHSessionKeyBuilder.Factory |
getDHFactory()
Hook for pluggable transport creation.
|
byte[] |
getIP(Hash peer)
IP of the peer from the last connection (in or out, any transport).
|
List<String> |
getMostRecentErrorMessages() |
TransportBid |
getNextBid(OutNetMessage msg) |
CommSystemFacade.Status |
getReachabilityStatus()
Previously returned short, now enum as of 0.9.20
|
Transport |
getTransport(String style) |
(package private) int |
getTransportCount() |
boolean |
haveHighOutboundCapacity()
Are all transports well below their outbound connection limit
Use for throttling in the router.
|
boolean |
haveInboundCapacity(int pct)
Is at least one transport below its inbound connection limit + some margin
Use for throttling in the router.
|
boolean |
haveOutboundCapacity(int pct)
Is at least one transport below its outbound connection limit + some margin
Use for throttling in the router.
|
boolean |
isBacklogged(Hash peer) |
boolean |
isEstablished(Hash peer) |
static boolean |
isNTCPEnabled(RouterContext ctx) |
void |
mayDisconnect(Hash peer)
Tell the transports that we may disconnect from this peer.
|
void |
messageReceived(I2NPMessage message,
RouterIdentity fromRouter,
Hash fromRouterHash)
Message received
|
void |
recheckReachability()
Deprecated.
unused
|
(package private) void |
registerAndStart(Transport t)
Pluggable transports.
|
void |
renderStatusHTML(Writer out,
String urlBase,
int sortFlags)
Warning - blocking, very slow, queries the active UPnP router,
will take many seconds if it has vanished.
|
void |
restart() |
void |
shutdown()
Cannot be restarted.
|
void |
startListening() |
(package private) void |
stopAndUnregister(Transport t)
Pluggable transports.
|
void |
stopListening()
Can be restarted.
|
void |
transportAddressChanged() |
boolean |
wasUnreachable(Hash peer)
Was the peer UNreachable (outbound only) on any transport,
based on the last time we tried it for each transport?
This is NOT reset if the peer contacts us.
|
public static final String PROP_ENABLE_UDP
public static final String PROP_ENABLE_NTCP
public static final String PROP_ENABLE_UPNP
public TransportManager(RouterContext context)
void registerAndStart(Transport t)
void stopAndUnregister(Transport t)
DHSessionKeyBuilder.Factory getDHFactory()
public static boolean isNTCPEnabled(RouterContext ctx)
public void externalAddressReceived(Transport.AddressSource source, byte[] ip, int port)
public void externalAddressRemoved(Transport.AddressSource source, boolean ipv6)
public void forwardPortStatus(String style, byte[] ip, int port, int externalPort, boolean success, String reason)
public void startListening()
public void restart()
public void stopListening()
public void shutdown()
int getTransportCount()
public int countActivePeers()
public int countActiveSendPeers()
public boolean haveOutboundCapacity(int pct)
pct
- percent of limit 0-100public boolean haveHighOutboundCapacity()
public boolean haveInboundCapacity(int pct)
pct
- percent of limit 0-100public Vector<Long> getClockSkews()
public CommSystemFacade.Status getReachabilityStatus()
@Deprecated public void recheckReachability()
public boolean isBacklogged(Hash peer)
public boolean isEstablished(Hash peer)
public void mayDisconnect(Hash peer)
public boolean wasUnreachable(Hash peer)
public byte[] getIP(Hash peer)
public List<RouterAddress> getAddresses()
public TransportBid getBid(OutNetMessage msg)
public List<TransportBid> getBids(OutNetMessage msg)
public TransportBid getNextBid(OutNetMessage msg)
public void messageReceived(I2NPMessage message, RouterIdentity fromRouter, Hash fromRouterHash)
messageReceived
in interface TransportEventListener
message
- non-nullfromRouter
- may be nullfromRouterHash
- may be null, calculated from fromRouter if nullpublic void transportAddressChanged()
transportAddressChanged
in interface TransportEventListener
public void renderStatusHTML(Writer out, String urlBase, int sortFlags) throws IOException
IOException