java.lang.Object
net.i2p.router.tunnel.pool.ConnectChecker
- Direct Known Subclasses:
TunnelPeerSelector
Tools to check transport compatibility.
Field Summary
Modifier and TypeFieldDescriptionstatic final intAny IPv4 transport.protected final RouterContextThe router context.private static final String[]Prevent object churn.protected final LogThe logger.private static final intBit for an NTCP connection to an IPv4 address.private static final intBit for an NTCP connection to an IPv6 address.private static final intBit for an SSU connection to an IPv4 address.private static final intBit for an SSU connection to an IPv6 address.private static final intBit for an SSU2 connection to an IPv4 address.private static final intBit for an SSU2 connection to an IPv6 address.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionbooleancanConnect(int ourMask, RouterInfo to) Can we connect to "to" based on published addresses?booleancanConnect(Hash from, Hash to) Can "from" connect to "to" based on published addresses?booleancanConnect(RouterInfo from, int ourMask) Can "from" connect to us based on published addresses?private static intgetConnectMask(Collection<RouterAddress> addrs) The bitmask of supported transports for the given addresses.intOur inbound mask.intOur outbound mask.protected booleanIs NTCP disabled?private booleanIs SSU2 enabled?protected booleanIs SSU disabled?
Field Details
ctx
The router context.log
The logger.NTCP_V4
private static final int NTCP_V4Bit for an NTCP connection to an IPv4 address.- See Also:
NTCP_V6
private static final int NTCP_V6Bit for an NTCP connection to an IPv6 address.- See Also:
SSU_V4
private static final int SSU_V4Bit for an SSU connection to an IPv4 address.- See Also:
SSU_V6
private static final int SSU_V6Bit for an SSU connection to an IPv6 address.- See Also:
SSU2_V4
private static final int SSU2_V4Bit for an SSU2 connection to an IPv4 address.- See Also:
SSU2_V6
private static final int SSU2_V6Bit for an SSU2 connection to an IPv6 address.- See Also:
ANY_V4
IHOST
Prevent object churn.
Constructor Details
ConnectChecker
Create a new ConnectChecker.- Parameters:
context- the router context
Method Details
isNTCPDisabled
protected boolean isNTCPDisabled()Is NTCP disabled?- Returns:
- true if NTCP is disabled
isSSUDisabled
protected boolean isSSUDisabled()Is SSU disabled?- Returns:
- true if SSU is disabled
isSSU2Enabled
private boolean isSSU2Enabled()Is SSU2 enabled?- Returns:
- whether s s u2 enabled
canConnect
Can "from" connect to "to" based on published addresses?This is intended for tunnel candidates, where we already have the RI. Will not force RI lookups. Either from or to may be us.
This is best effort, as we can't know for sure. Published addresses or introducers may have changed. Even if a can't connect to b, they may already be connected as b connected to a.
- Parameters:
from- the source router hashto- the destination router hash- Returns:
- true if we don't have either RI
canConnect
Can we connect to "to" based on published addresses?This is intended for tunnel candidates, where we already have the RI. Will not force RI lookups.
This is best effort, as we can't know for sure. Does not check isEstablished(); do that first.
- Parameters:
ourMask- our connection maskto- the destination router info- Returns:
- true if we can connect
canConnect
Can "from" connect to us based on published addresses?This is intended for tunnel candidates, where we already have the RI. Will not force RI lookups.
This is best effort, as we can't know for sure. Does not check isEstablished(); do that first.
- Parameters:
from- the source router infoourMask- our connection mask- Returns:
- true if from can connect to us
getInboundMask
Our inbound mask. For most cases, we use what we published, i.e. getConnectMask().- Parameters:
us- our router info- Returns:
- bitmask for accepting connections
getOutboundMask
Our outbound mask. For most cases, we use our comm system status.- Parameters:
us- our router info- Returns:
- bitmask for initiating connections
getConnectMask
The bitmask of supported transports for the given addresses.- Parameters:
addrs- non-empty, set your own default if empty- Returns:
- bitmask of v4/v6 NTCP/SSU