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 |
---|---|
void |
addTransport(Transport transport) |
int |
countActivePeers() |
int |
countActiveSendPeers() |
void |
externalAddressReceived(Transport.AddressSource source,
byte[] ip,
int port)
Initialize from interfaces, and callback from UPnP or SSU.
|
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.
|
byte[] |
getIP(Hash dest)
IP of the peer from the last connection (in or out, any transport).
|
List<String> |
getMostRecentErrorMessages() |
TransportBid |
getNextBid(OutNetMessage msg) |
short |
getReachabilityStatus() |
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 dest) |
boolean |
isEstablished(Hash dest) |
static boolean |
isNTCPEnabled(RouterContext ctx) |
void |
messageReceived(I2NPMessage message,
RouterIdentity fromRouter,
Hash fromRouterHash)
Message received
|
void |
recheckReachability()
Deprecated.
unused
|
void |
removeTransport(Transport transport) |
void |
renderStatusHTML(Writer out,
String urlBase,
int sortFlags) |
void |
restart() |
void |
shutdown()
Cannot be restarted.
|
void |
startListening() |
void |
stopListening()
Can be restarted.
|
void |
transportAddressChanged() |
boolean |
wasUnreachable(Hash dest)
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)
public void addTransport(Transport transport)
public void removeTransport(Transport transport)
public static boolean isNTCPEnabled(RouterContext ctx)
public void externalAddressReceived(Transport.AddressSource source, byte[] ip, int port)
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 short getReachabilityStatus()
public void recheckReachability()
public boolean isBacklogged(Hash dest)
public boolean isEstablished(Hash dest)
public boolean wasUnreachable(Hash dest)
public byte[] getIP(Hash dest)
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