public abstract class TunnelPeerSelector extends ConnectChecker
| Modifier and Type | Class and Description |
|---|---|
protected class |
TunnelPeerSelector.Excluder
Excluder that automatically adds peers to the set when they should be excluded.
|
protected class |
TunnelPeerSelector.HopChainValidator
Validates peer-to-peer connectivity in a tunnel hop chain.
|
ANY_V4, ctx, log| Modifier | Constructor and Description |
|---|---|
protected |
TunnelPeerSelector(RouterContext context) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
allowAsIBGW(Hash h)
Should we allow as IBGW?
This just checks for the "R" capability and IPv4 support.
|
protected boolean |
allowAsOBEP(Hash h)
Should we allow as OBEP?
This just checks for IPv4 support.
|
protected boolean |
checkTunnel(boolean isInbound,
boolean isExploratory,
List<Hash> tunnel)
Connectivity check.
|
protected boolean |
filterSlow(boolean isInbound,
boolean isExploratory)
do we want to skip peers that are slow?
|
protected Set<Hash> |
getClosestHopExclude(boolean isInbound,
Set<Hash> toAdd)
Pick peers that we want to avoid for the first OB hop or last IB hop.
|
protected Set<Hash> |
getExclude(boolean isInbound,
boolean isExploratory)
As of 0.9.58, this returns a set populated only by TunnelManager.selectPeersInTooManyTunnels(),
for passing to ProfileOrganizer.
|
protected int |
getLength(TunnelPoolSettings settings) |
protected int |
getPeerConnectMask(RouterInfo ri)
Get the connect mask for a peer's addresses.
|
protected boolean |
isDuplicateSequence(TunnelPoolSettings settings,
List<Hash> newPeers)
Check if the selected peer sequence matches an existing tunnel in the pool.
|
protected boolean |
isIPv6Only()
Are we IPv6 only?
|
protected void |
orderPeers(List<Hash> rv,
SessionKey key)
see HashComparator
|
protected List<Hash> |
regeneratePeers(TunnelPoolSettings settings,
List<Hash> peers)
Regenerate tunnel peers to avoid duplicate sequence.
|
protected List<Hash> |
selectExplicit(TunnelPoolSettings settings,
int length)
For debugging, also possibly for restricted routes.
|
abstract List<Hash> |
selectPeers(TunnelPoolSettings settings)
Which peers should go into the next tunnel for the given settings?
|
static boolean |
shouldExclude(RouterContext ctx,
RouterInfo peer)
Should the peer be excluded based on its published caps, crypto, and version?
|
protected boolean |
shouldSelectExplicit(TunnelPoolSettings settings)
For debugging, also possibly for restricted routes?
Needs analysis and testing
|
canConnect, canConnect, canConnect, getConnectMask, getInboundMask, getOutboundMask, isNTCPDisabled, isSSUDisabledprotected TunnelPeerSelector(RouterContext context)
protected boolean allowAsIBGW(Hash h)
protected boolean allowAsOBEP(Hash h)
protected boolean checkTunnel(boolean isInbound,
boolean isExploratory,
List<Hash> tunnel)
tunnel - ENDPOINT FIRST, GATEWAY LAST!!!!, length 2 or greaterprotected boolean filterSlow(boolean isInbound,
boolean isExploratory)
protected Set<Hash> getClosestHopExclude(boolean isInbound, Set<Hash> toAdd)
isInbound - protected Set<Hash> getExclude(boolean isInbound, boolean isExploratory)
protected int getLength(TunnelPoolSettings settings)
protected int getPeerConnectMask(RouterInfo ri)
protected boolean isDuplicateSequence(TunnelPoolSettings settings, List<Hash> newPeers)
settings - the tunnel pool settingsnewPeers - the newly selected peers (excluding self)protected boolean isIPv6Only()
protected void orderPeers(List<Hash> rv, SessionKey key)
protected List<Hash> regeneratePeers(TunnelPoolSettings settings, List<Hash> peers)
settings - the tunnel pool settingspeers - the peers to regenerateprotected List<Hash> selectExplicit(TunnelPoolSettings settings, int length)
settings - the tunnel pool settingslength - the desired length of the tunnelpublic abstract List<Hash> selectPeers(TunnelPoolSettings settings)
public static boolean shouldExclude(RouterContext ctx, RouterInfo peer)
ctx - Router context for peer count checkspeer - The peer to evaluateprotected boolean shouldSelectExplicit(TunnelPoolSettings settings)