public class ProfileOrganizer extends Object
| Modifier and Type | Class and Description |
|---|---|
static class | ProfileOrganizer.SliceDefines peer selection slicing modes for tier-based peer organization. |
| Modifier and Type | Field and Description |
|---|---|
static int | _defaultMaxFastPeers_defaultMaxFastPeers. |
static int | _defaultMaxHighCapPeers_defaultMaxHighCapPeers. |
static int | _defaultMaxProfilesRuntime-adjustable default max profile count. |
static int | _defaultMinFastPeers_defaultMinFastPeers. |
static int | _defaultMinHighCapPeers_defaultMinHighCapPeers. |
static int | ABSOLUTE_MAX_PROFILESABSOLUTE_MAX_PROFILES. |
static double | ATTACK_THRESHOLDThreshold below which the network is considered under attack |
static int | DEFAULT_LOSSY_MIN_PACKETSDefault minimum packet sample size (20 = full 5% bucket resolution). |
static int | DEFAULT_MAX_ROUTERINFO_AGE_HOURSDEFAULT_MAX_ROUTERINFO_AGE_HOURS. |
static int | DEFAULT_MINIMUM_HIGH_CAPACITY_PEERSDEFAULT_MINIMUM_HIGH_CAPACITY_PEERS. |
static int | MIN_MAX_PROFILESMIN_MAX_PROFILES. |
static String | PROP_LOSSY_MIN_PACKETSConfig property for the minimum number of transmitted packets before a loss ratio is reported. |
static String | PROP_LOSSY_MODERATE_THRESHOLDConfig property for the decayed loss score above which a peer is
de-prioritized in tier selection (soft signal, below the demotion
threshold). |
static String | PROP_LOSSY_THRESHOLDConfig property for the loss ratio above which a peer is demoted from fast/high-cap tiers. |
static String | PROP_LOSSY_WINDOWConfig property for how long a reported loss ratio stays fresh. |
static String | PROP_MAX_PROFILESConfig property for the maximum number of peer profiles. |
static String | PROP_MAX_ROUTERINFO_AGE_HOURSPROP_MAX_ROUTERINFO_AGE_HOURS. |
static String | PROP_MAXIMUM_FAST_PEERSPROP_MAXIMUM_FAST_PEERS. |
static String | PROP_MAXIMUM_HIGH_CAPACITY_PEERSPROP_MAXIMUM_HIGH_CAPACITY_PEERS. |
static String | PROP_MINIMUM_FAST_PEERSPROP_MINIMUM_FAST_PEERS. |
static String | PROP_MINIMUM_HIGH_CAPACITY_PEERSPROP_MINIMUM_HIGH_CAPACITY_PEERS. |
| Constructor and Description |
|---|
ProfileOrganizer(RouterContext context)Creates a profile organizer with empty tier maps and registers
performance tracking statistics for peer classification. |
| Modifier and Type | Method and Description |
|---|---|
PeerProfile | addProfile(PeerProfile profile)Insert a fully-constructed profile into the organizer. |
(package private) static double | buildSuccessRatio(Rate er,
Rate rr,
Rate sr,
Rate erC,
Rate rrC,
Rate srC)Build-success ratio from the six TEN_MINUTES rates, 1.0 when any rate
is missing or the window is empty. |
(package private) static int | clampMaxProfiles(int maxProfiles)Clamps the configured max-profiles value into [100, ABSOLUTE_MAX_PROFILES]. |
(package private) void | clearProfiles()Remove all profiles and clear all tier maps. |
int | countActivePeers()Count peers with any send or hear activity in the last 4 hours. |
int | countActivePeersInLastHour()Count peers with activity (send, receive, or failure) within the last hour. |
int | countFastPeers()Number of peers classified as fast tier. |
int | countHighCapacityPeers()Number of peers classified as high-capacity tier. |
int | countNotFailingPeers()Total number of peer profiles in memory (all tiers). |
void | demoteIfCongested(Hash peer)Immediately demote a peer from fast/high-cap tiers if it has a congestion cap (D/E). |
void | demoteIfHighLatency(Hash peer)Immediately demote a peer from fast/high-cap tiers if its capacityBonus is -30
(UI shows ✖ for high latency). |
(package private) void | demoteIfHighRTT(Hash peer,
long responseTimeMs)Immediately demote a peer from fast/high-cap tiers if its tunnel test RTT
exceeds the low-latency threshold (timeout * 2), matching the PeerTestJob metric. |
void | demoteIfLossy(Hash peer)Instantly remove a peer from the fast/high-capacity tiers when its decayed loss
score exceeds the threshold, and mark it for loss probation. |
void | demoteIfNoTunnel(Hash peer)Immediately demote a peer from fast/high-cap tiers if it has G cap (no tunnels). |
void | demoteIfStale(Hash peer)Immediately demote a peer from fast/high-cap tiers if its RouterInfo is stale
and it has no recent proof of life (fails isSelectable). |
void | demoteIfUnreachable(Hash peer)Immediately demote a peer from fast/high-cap tiers when our transport
connection to it failed during tunnel build (first hop unreachable). |
(package private) void | evictProfilesNotInNetdb()Evict profiles for peers no longer in the network database. |
boolean | exportProfile(Hash profile,
OutputStream out)Write a peer profile to the given output stream for persistence. |
float | getAverageLossRatio()Average loss ratio across the fast and high-capacity tiers with a fresh
measurement, as a fraction (0.0 - 1.0). |
double | getCapacityThreshold()Current minimum capacity value for the high-capacity peer tier. |
static int | getDefaultMaxFastPeers() |
static int | getDefaultMaxHighCapPeers() |
static int | getDefaultMaxProfilesValue() |
static int | getDefaultMinFastPeers() |
float | getFastAverageLossRatio()Average loss ratio across the fast tier with a fresh measurement, as a
fraction (0.0 - 1.0); 0.0 if none. |
double | getFastRTTThreshold()Average tunnel test time (RTT in ms) of the peer at the fast-tier speed
boundary from the last reorganize, or 0.0 if never reorganized. |
float | getHighCapAverageLossRatio()Average loss ratio across the high-capacity tier with a fresh measurement,
as a fraction (0.0 - 1.0); 0.0 if none. |
double | getIntegrationThreshold()Current minimum integration value for the well-integrated peer tier. |
protected int | getMaximumFastPeers()Maximum number of peers to keep in the fast tier, capped by active peers. |
protected int | getMaximumHighCapPeers()Maximum number of peers to keep in the high-capacity tier, capped by active peers. |
float | getMedianLossRatio()Median loss ratio of the union of the fast and high-capacity tiers with a
fresh measurement, as a fraction (0.0 - 1.0); 0.0 if none. |
static int | getMinHighCapacityPeers() |
protected int | getMinimumFastPeers()Minimum number of peers to keep in the fast tier. |
protected int | getMinimumHighCapacityPeers()Minimum number of peers to keep in the high-capacity tier. |
PeerProfile | getOrCreateProfileNonblocking(Hash peer)Retrieve an existing profile or create a new one, without blocking on contention. |
PeerProfile | getProfile(Hash peer)Retrieve the profile for a peer, or null if unknown. |
PeerProfile | getProfileNonblocking(Hash peer)Retrieve the profile for a peer without blocking. |
double | getSpeedThreshold()Current minimum speed value for the fast peer tier. |
int | getStoredProfileCount()Last known number of profiles stored on disk, from the most recent load,
cleanup, or purge in the persistence helper. |
double | getTunnelBuildSuccess()Recent tunnel build success ratio, from router statistics. |
Hash | getUs()Self-exclusion hash for this router instance. |
(package private) static boolean | hasRecentProofOfLife(PeerProfile profile,
long now)True if the peer has shown proof of life within
PROOF_OF_LIFE_WINDOW_MS: a successful send, heard-from, or
heard-about within the last hour. |
(package private) static boolean | hasRecentTierActivity(PeerProfile profile,
long activeCutoff)True if the peer showed recent activity within the given cutoff: a
heard-from or successful send at or after the cutoff. |
(package private) static boolean | isEvictable(PeerProfile profile,
Map<Hash,PeerProfile> fastPeers,
Map<Hash,PeerProfile> highCapPeers,
long activeThreshold,
int fastPeerLimit,
int highCapacityLimit)Whether a profile is eligible for eviction under the profile cap:
not protected by a fast/high-cap tier slot that still has room below
its limit, and no send or heard-from activity within the active window. |
(package private) boolean | isExcludedFromProfiling(Hash peer)Check if a peer should be excluded from profiling. |
(package private) static boolean | isExpiredProfile(PeerProfile profile,
long now,
long expireActive,
long expirePassive,
long expireGossip,
long expireUntracked)Whether a profile has expired from its activity tier and should be
purged: no activity (send/heard/heard-about) within the tier's
expiration window. |
boolean | isFast(Hash peer)Check whether a peer is classified in the fast tier. |
boolean | isHighCapacity(Hash peer)Check whether a peer is classified in the high-capacity tier. |
(package private) boolean | isLowBandwidthTier(Hash peer)Check if a peer is in a low bandwidth tier (K, L, M, or Unknown). |
boolean | isLowBuildSuccess()Whether recent tunnel build success is below the attack threshold. |
(package private) static boolean | isReliableBandwidthPeer(PeerProfile profile,
long now,
boolean established)Reliability gate for high-bandwidth (O/P/X tier) selection: the peer
must show a tunnel acceptance ratio of at least 0.3 AND evidence of
recent activity — a successful peer test within 10 minutes, a heard-
from/send-success within 30 minutes, or an established commSystem
connection. |
boolean | isSelectable(Hash peer)Whether the given peer is eligible for selection. |
(package private) static boolean | isStaleAbsentPeer(PeerProfile profile,
long now,
long absentThreshold)Whether the peer's last activity (send, heard-from, or heard-about)
is older than the absent threshold — i.e. |
boolean | isWellIntegrated(Hash peer)Check whether a peer is classified in the well-integrated tier. |
static void | main(String[] args)Command-line entry point; reads profile dump files and prints thresholds. |
(package private) static boolean | needsTierRestore(int currentSize,
int oldSize)Whether a shrunken tier needs restoration: below half its old size
and the old size was substantial. |
(package private) boolean | passesTierGates(PeerProfile profile,
double buildSuccess,
long now)Common gate for fast/high-cap tier fill passes: the peer must be
selectable, have acceptable tunnel acceptance, no recent tunnel
failures, and not be in loss probation. |
boolean | peerSendsBadReplies(Hash peer)Check whether a peer sends an excessive rate of invalid or failed
netDb lookup replies (potential misbehavior indicator). |
void | purgeStaleProfileFiles()Remove stale profile files for peers outside the active set when over the cap. |
(package private) void | reorganize()Run a standard reorganize round without coalescing or decay. |
(package private) void | reorganize(boolean shouldCoalesce,
boolean shouldDecay)Reorganizes peer profiles into performance-based tiers (fast, high-capacity, etc.) and expires stale entries. |
void | selectActiveNotFailingPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches)Select from currently connected (established) not-failing peers. |
void | selectActiveNotFailingPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches,
int mask,
MaskedIPSet ipSet)Select from currently connected peers with IP-subnet diversity. |
void | selectAllNotFailingPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches,
boolean onlyNotFailing)Select from all not-failing peers randomly, falling through to general
peers if the not-failing set is insufficient. |
Set<Hash> | selectAllPeers()Gather the union of all peers from fast, high-capacity, and not-failing tiers. |
void | selectFastPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches)Select up to howMany fast-tier peers, filling shortfalls from high-capacity. |
void | selectFastPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches,
int mask,
MaskedIPSet ipSet)Select fast-tier peers with IP-subnet diversity constraints. |
void | selectFastPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches,
SessionKey randomKey,
ProfileOrganizer.Slice subTierMode,
int mask,
MaskedIPSet ipSet)Select fast-tier peers deterministically sliced by a random key. |
void | selectHighBandwidthPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches)Select up to howMany peers from O/P/X bandwidth tiers (high shared bandwidth)
that are not failing. |
void | selectHighBandwidthPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches,
boolean onlyNotFailing,
int mask,
MaskedIPSet ipSet)Select high-bandwidth peers with tier-exclusion and IP-subnet diversity. |
void | selectHighCapacityPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches)Select high-capacity peers, filling shortfalls from not-failing peers. |
void | selectHighCapacityPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches,
int mask,
MaskedIPSet ipSet)Select high-capacity peers with IP-subnet diversity. |
void | selectNotFailingPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches)Select from not-failing peers, excluding high-capacity tier if requested. |
void | selectNotFailingPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches,
boolean onlyNotFailing)Select from not-failing peers, optionally excluding the high-capacity tier. |
void | selectNotFailingPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches,
boolean onlyNotFailing,
int mask,
MaskedIPSet ipSet)Full-parameter select from not-failing peers. |
void | selectNotFailingPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches,
int mask,
MaskedIPSet ipSet)Select from not-failing peers with IP-subnet diversity. |
static void | setDefaultMaxFastPeers(int val) |
static void | setDefaultMaxHighCapPeers(int val) |
static void | setDefaultMaxProfiles(int val) |
static void | setDefaultMinFastPeers(int val) |
static void | setMinHighCapacityPeers(int val) |
void | setUs(Hash us)Store the local router hash for self-exclusion from peer selection. |
(package private) boolean | skipsPromotion(PeerProfile profile,
Hash peer,
double buildSuccess)Whether the peer should be skipped for tier promotion: not selectable,
in a strict country, low tunnel acceptance, high-latency penalty,
congested, or in loss probation. |
void | writeProfile(PeerProfile profile)Persist the given profile to disk. |
public static volatile int _defaultMaxFastPeers
public static volatile int _defaultMaxHighCapPeers
public static volatile int _defaultMaxProfiles
public static volatile int _defaultMinFastPeers
public static volatile int _defaultMinHighCapPeers
public static final int ABSOLUTE_MAX_PROFILES
public static final double ATTACK_THRESHOLD
public static final int DEFAULT_LOSSY_MIN_PACKETS
public static final int DEFAULT_MAX_ROUTERINFO_AGE_HOURS
public static final int DEFAULT_MINIMUM_HIGH_CAPACITY_PEERS
public static final int MIN_MAX_PROFILES
public static final String PROP_LOSSY_MIN_PACKETS
public static final String PROP_LOSSY_MODERATE_THRESHOLD
public static final String PROP_LOSSY_THRESHOLD
public static final String PROP_LOSSY_WINDOW
public static final String PROP_MAX_PROFILES
public static final String PROP_MAX_ROUTERINFO_AGE_HOURS
public static final String PROP_MAXIMUM_FAST_PEERS
public static final String PROP_MAXIMUM_HIGH_CAPACITY_PEERS
public static final String PROP_MINIMUM_FAST_PEERS
public static final String PROP_MINIMUM_HIGH_CAPACITY_PEERS
public ProfileOrganizer(RouterContext context)
context - the router context providing config, stats, and log accesspublic PeerProfile addProfile(PeerProfile profile)
profile - the profile to addstatic double buildSuccessRatio(Rate er, Rate rr, Rate sr, Rate erC, Rate rrC, Rate srC)
er - exploratory expire raterr - exploratory reject ratesr - exploratory success rateerC - client expire raterrC - client reject ratesrC - client success ratestatic int clampMaxProfiles(int maxProfiles)
Pure decision — no context access, safe for unit tests.
maxProfiles - the configured or default valuevoid clearProfiles()
public int countActivePeers()
public int countActivePeersInLastHour()
public int countFastPeers()
public int countHighCapacityPeers()
public int countNotFailingPeers()
public void demoteIfCongested(Hash peer)
public void demoteIfHighLatency(Hash peer)
void demoteIfHighRTT(Hash peer, long responseTimeMs)
public void demoteIfLossy(Hash peer)
peer - the peerpublic void demoteIfNoTunnel(Hash peer)
public void demoteIfStale(Hash peer)
public void demoteIfUnreachable(Hash peer)
void evictProfilesNotInNetdb()
public boolean exportProfile(Hash profile, OutputStream out) throws IOException
profile - the router hash identifying the profile to exportout - the destination stream for the serialized profileIOException - on write errorspublic float getAverageLossRatio()
PROP_LOSSY_WINDOW are skipped; 0.0 if no fresh data. The tiers are
the baseline because the threshold governs demotion FROM them: as lossy peers
are evicted the average drops and the bar tightens. Used by the Tuner to
adapt PROP_LOSSY_THRESHOLD to the network.public double getCapacityThreshold()
public static int getDefaultMaxFastPeers()
public static int getDefaultMaxHighCapPeers()
public static int getDefaultMaxProfilesValue()
public static int getDefaultMinFastPeers()
public float getFastAverageLossRatio()
getAverageLossRatio().public double getFastRTTThreshold()
public float getHighCapAverageLossRatio()
getAverageLossRatio().public double getIntegrationThreshold()
protected int getMaximumFastPeers()
protected int getMaximumHighCapPeers()
public float getMedianLossRatio()
getAverageLossRatio().public static int getMinHighCapacityPeers()
protected int getMinimumFastPeers()
protected int getMinimumHighCapacityPeers()
public PeerProfile getOrCreateProfileNonblocking(Hash peer)
peer - the router hash to look up or create a profile forpublic PeerProfile getProfile(Hash peer)
peer - the router hash to look uppublic PeerProfile getProfileNonblocking(Hash peer)
peer - the router hash to look uppublic double getSpeedThreshold()
public int getStoredProfileCount()
public double getTunnelBuildSuccess()
TEN_MINUTES window: a short window reacts quickly to network health changes, so the attack-mode gates below track the current situation instead of lifetime averages. When no data is available (stats not yet created at boot, or an empty window), the ratio is 1.0 — no data means neutral, not "under attack"; a missing-stat 0.0 put the router into permanent attack mode before stats existed.
public Hash getUs()
static boolean hasRecentProofOfLife(PeerProfile profile, long now)
PROOF_OF_LIFE_WINDOW_MS: a successful send, heard-from, or
heard-about within the last hour. A null profile (never seen) is not
evidence of life. Used to trust a RouterInfo that is older than the
maximum age — the RouterInfo alone is not enough, the peer must have
been active recently.Pure decision — no context access, safe for unit tests.
profile - the peer profile, null if nonenow - current time in msstatic boolean hasRecentTierActivity(PeerProfile profile, long activeCutoff)
Pure decision — no context access, safe for unit tests.
profile - the profileactiveCutoff - earliest allowed activity timestamp in msstatic boolean isEvictable(PeerProfile profile, Map<Hash,PeerProfile> fastPeers, Map<Hash,PeerProfile> highCapPeers, long activeThreshold, int fastPeerLimit, int highCapacityLimit)
Pure decision — no context access, safe for unit tests.
profile - the profile under considerationfastPeers - the current fast tier maphighCapPeers - the current high-cap tier mapactiveThreshold - the activity window cutoff (now - 48h)fastPeerLimit - fast tier size threshold for protectionhighCapacityLimit - high-cap tier size threshold for protectionboolean isExcludedFromProfiling(Hash peer)
static boolean isExpiredProfile(PeerProfile profile, long now, long expireActive, long expirePassive, long expireGossip, long expireUntracked)
Pure decision — no context access, safe for unit tests.
profile - the profilenow - current time in msexpireActive - active-tier window in msexpirePassive - passive-tier window in msexpireGossip - gossip-tier window in msexpireUntracked - untracked window in mspublic boolean isFast(Hash peer)
peer - the router hash to checkpublic boolean isHighCapacity(Hash peer)
peer - the router hash to checkboolean isLowBandwidthTier(Hash peer)
public boolean isLowBuildSuccess()
static boolean isReliableBandwidthPeer(PeerProfile profile, long now, boolean established)
Pure decision — no context access, safe for unit tests.
profile - the peer profile (non-null)now - current time in msestablished - whether commSystem has an established connectionpublic boolean isSelectable(Hash peer)
isSelectable(Hash, double) with a value fetched once per scan.static boolean isStaleAbsentPeer(PeerProfile profile, long now, long absentThreshold)
Pure decision — no context access, safe for unit tests.
profile - the profilenow - current time in msabsentThreshold - stale threshold in mspublic boolean isWellIntegrated(Hash peer)
peer - the router hash to checkpublic static void main(String[] args)
static boolean needsTierRestore(int currentSize,
int oldSize)Pure decision — no context access, safe for unit tests.
currentSize - current tier sizeoldSize - pre-reorganize tier sizeboolean passesTierGates(PeerProfile profile, double buildSuccess, long now)
No side effects — safe to evaluate without holding locks.
profile - the candidate profilebuildSuccess - the build success ratio in [0.0, 1.0]now - current time in mspublic boolean peerSendsBadReplies(Hash peer)
peer - the router hash to checkpublic void purgeStaleProfileFiles()
void reorganize()
void reorganize(boolean shouldCoalesce,
boolean shouldDecay)This method:
Memory Safety: To prevent unbounded memory growth (e.g., OOM after 8+ hours), this method ensures that expired profiles are removed from all data structures—even if the full reorganization is skipped due to lock contention. A best-effort expiration pass runs outside the write lock to mitigate leaks during high contention.
shouldCoalesce - if true, coalesce statistics for active profilesshouldDecay - if true and coalescing is performed, apply decay to historical statspublic void selectActiveNotFailingPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches)howMany - target number of peersexclude - peers to exclude (may be null)matches - output set populated with selected peer hashespublic void selectActiveNotFailingPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches,
int mask,
MaskedIPSet ipSet)howMany - target number of peersexclude - peers to exclude (may be null)matches - output set populated with selected peer hashesmask - bitmask length for /n diversity restriction (0 to disable)ipSet - mutable set tracking already-selected subnetspublic void selectAllNotFailingPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches,
boolean onlyNotFailing)howMany - target number of peersexclude - peers to exclude (may be null)matches - output set populated with selected peer hashesonlyNotFailing - if true, exclude peers already in high-capacity tierpublic Set<Hash> selectAllPeers()
public void selectFastPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches)howMany - target number of peersexclude - peers to exclude (may be null)matches - output set populated with selected peer hashespublic void selectFastPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches,
int mask,
MaskedIPSet ipSet)howMany - target number of peersexclude - peers to exclude (may be null)matches - output set populated with selected peer hashesmask - bitmask length for /n diversity restriction (0 to disable)ipSet - mutable set tracking already-selected subnetspublic void selectFastPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches,
SessionKey randomKey,
ProfileOrganizer.Slice subTierMode,
int mask,
MaskedIPSet ipSet)howMany - target number of peersexclude - peers to exclude (may be null)matches - output set populated with selected peer hashesrandomKey - key for deterministic sub-tier assignmentsubTierMode - slicing mode (SLICE_ALL to skip slicing)mask - bitmask length for /n diversity restriction (0 to disable)ipSet - mutable set tracking already-selected subnetspublic void selectHighBandwidthPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches)howMany - target number of peersexclude - peers to exclude (may be null)matches - output set populated with selected peer hashespublic void selectHighBandwidthPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches,
boolean onlyNotFailing,
int mask,
MaskedIPSet ipSet)howMany - target number of peersexclude - peers to exclude (may be null)matches - output set populated with selected peer hashesonlyNotFailing - if true, exclude peers already in high-capacity tiermask - bitmask length for /n diversity restriction (0 to disable)ipSet - mutable set tracking already-selected subnetspublic void selectHighCapacityPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches)howMany - target number of peersexclude - peers to exclude (may be null)matches - output set populated with selected peer hashespublic void selectHighCapacityPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches,
int mask,
MaskedIPSet ipSet)howMany - target number of peersexclude - peers to exclude (may be null)matches - output set populated with selected peer hashesmask - bitmask length for /n diversity restriction (0 to disable)ipSet - mutable set tracking already-selected subnetspublic void selectNotFailingPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches)howMany - target number of peersexclude - peers to exclude (may be null)matches - output set populated with selected peer hashespublic void selectNotFailingPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches,
boolean onlyNotFailing)howMany - target number of peersexclude - peers to exclude (may be null)matches - output set populated with selected peer hashesonlyNotFailing - if true, exclude peers already in high-capacity tierpublic void selectNotFailingPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches,
boolean onlyNotFailing,
int mask,
MaskedIPSet ipSet)howMany - target number of peersexclude - peers to exclude (may be null)matches - output set populated with selected peer hashesonlyNotFailing - if true, exclude peers already in high-capacity tiermask - bitmask length for /n diversity restriction (0 to disable)ipSet - mutable set tracking already-selected subnetspublic void selectNotFailingPeers(int howMany,
Set<Hash> exclude,
Set<Hash> matches,
int mask,
MaskedIPSet ipSet)howMany - target number of peersexclude - peers to exclude (may be null)matches - output set populated with selected peer hashesmask - bitmask length for /n diversity restriction (0 to disable)ipSet - mutable set tracking already-selected subnetspublic static void setDefaultMaxFastPeers(int val)
public static void setDefaultMaxHighCapPeers(int val)
public static void setDefaultMaxProfiles(int val)
public static void setDefaultMinFastPeers(int val)
public static void setMinHighCapacityPeers(int val)
public void setUs(Hash us)
boolean skipsPromotion(PeerProfile profile, Hash peer, double buildSuccess)
No side effects — safe to evaluate without holding locks.
profile - the profile under considerationpeer - the peer hashbuildSuccess - the tunnel build success ratio in [0.0, 1.0]public void writeProfile(PeerProfile profile)