tribler.core.tunnel.discovery

Classes

GoldenRatioStrategy

Strategy for removing peers once we have too many in the TunnelCommunity.

Module Contents

class tribler.core.tunnel.discovery.GoldenRatioStrategy(overlay: tribler.core.tunnel.community.TriblerTunnelCommunity, golden_ratio: float = 9 / 16, target_peers: int = 23)

Bases: ipv8.peerdiscovery.discovery.DiscoveryStrategy

Strategy for removing peers once we have too many in the TunnelCommunity.

This strategy will remove a “normal” peer if the current ratio of “normal” peers to exit node peers is larger than the set golden ratio. This strategy will remove an exit peer if the current ratio of “normal” peers to exit node peers is smaller than the set golden ratio.

golden_ratio = 0.5625
target_peers = 23
intro_sent: dict[ipv8.peer.Peer, float]
take_step() None

We are asked to update, see if we have enough peers to start culling them. If we do have enough peers, select a suitable peer to remove.