2.12.ipv8.messaging.anonymization.tunnel
Module Contents
Classes
Attributes
- 2.12.ipv8.messaging.anonymization.tunnel.ORIGINATOR = 0
- 2.12.ipv8.messaging.anonymization.tunnel.EXIT_NODE = 1
- 2.12.ipv8.messaging.anonymization.tunnel.ORIGINATOR_SALT = 2
- 2.12.ipv8.messaging.anonymization.tunnel.EXIT_NODE_SALT = 3
- 2.12.ipv8.messaging.anonymization.tunnel.ORIGINATOR_SALT_EXPLICIT = 4
- 2.12.ipv8.messaging.anonymization.tunnel.EXIT_NODE_SALT_EXPLICIT = 5
- 2.12.ipv8.messaging.anonymization.tunnel.PEER_SOURCE_UNKNOWN = 0
- 2.12.ipv8.messaging.anonymization.tunnel.PEER_SOURCE_DHT = 1
- 2.12.ipv8.messaging.anonymization.tunnel.PEER_SOURCE_PEX = 2
- 2.12.ipv8.messaging.anonymization.tunnel.PEER_FLAG_RELAY = 1
- 2.12.ipv8.messaging.anonymization.tunnel.PEER_FLAG_EXIT_BT = 2
- 2.12.ipv8.messaging.anonymization.tunnel.PEER_FLAG_EXIT_IPV8 = 4
- 2.12.ipv8.messaging.anonymization.tunnel.PEER_FLAG_SPEED_TEST = 8
- 2.12.ipv8.messaging.anonymization.tunnel.CIRCUIT_TYPE_DATA = 'DATA'
- 2.12.ipv8.messaging.anonymization.tunnel.CIRCUIT_TYPE_IP_SEEDER = 'IP_SEEDER'
- 2.12.ipv8.messaging.anonymization.tunnel.CIRCUIT_TYPE_RP_SEEDER = 'RP_SEEDER'
- 2.12.ipv8.messaging.anonymization.tunnel.CIRCUIT_TYPE_RP_DOWNLOADER = 'RP_DOWNLOADER'
- 2.12.ipv8.messaging.anonymization.tunnel.CIRCUIT_STATE_READY = 'READY'
- 2.12.ipv8.messaging.anonymization.tunnel.CIRCUIT_STATE_EXTENDING = 'EXTENDING'
- 2.12.ipv8.messaging.anonymization.tunnel.CIRCUIT_STATE_CLOSING = 'CLOSING'
- 2.12.ipv8.messaging.anonymization.tunnel.CIRCUIT_ID_PORT = 1024
- 2.12.ipv8.messaging.anonymization.tunnel.PING_INTERVAL = 7.5
- 2.12.ipv8.messaging.anonymization.tunnel.DESTROY_REASON_UNKNOWN = 1
- 2.12.ipv8.messaging.anonymization.tunnel.DESTROY_REASON_SHUTDOWN = 2
- 2.12.ipv8.messaging.anonymization.tunnel.DESTROY_REASON_UNNEEDED = 4
- 2.12.ipv8.messaging.anonymization.tunnel.DESTROY_REASON_LEAVE_SWARM = 5
- class 2.12.ipv8.messaging.anonymization.tunnel.DataChecker
Class to verify that only IPv8-allowed traffic is being forwarded.
- static could_be_utp(data: bytes) bool
Check if this data could be uTP (see also https://www.bittorrent.org/beps/bep_0029.html).
Packets should be 20 bytes or larger.
- The type should be 0..4:
0: ST_DATA
1: ST_FIN
2: ST_STATE
3: ST_RESET
4: ST_SYN
The version should be 1.
- The extension should be 0..3:
0: No extension
1: Selective ACK
2: Deprecated
3: Close reason
- 2.12.ipv8.messaging.anonymization.tunnel.PT
- class 2.12.ipv8.messaging.anonymization.tunnel.Tunnel(circuit_id: int, peer: PT)
Bases:
Generic
[PT
]Statistics for a tunnel to a peer over a circuit (base class for circuits, exit sockets, and relay routes).
- property peer: PT
The peer on the other end of this tunnel, if it exists.
- class 2.12.ipv8.messaging.anonymization.tunnel.TunnelExitSocket(circuit_id: int, peer: 2.12.ipv8.peer.Peer, overlay: 2.12.ipv8.messaging.anonymization.community.TunnelCommunity)
Bases:
Tunnel
[2.12.ipv8.peer.Peer
],asyncio.DatagramProtocol
,2.12.ipv8.taskmanager.TaskManager
Socket for exit nodes that communicates with the outside world.
- enable() None
Allow data to be sent.
This creates the datagram endpoint that allows us to send messages.
- sendto(data: bytes, destination: 2.12.ipv8.types.Address) None
Send o message over our datagram transporter.
- async resolve(host: str) str
Using asyncio’s getaddrinfo since the aiodns resolver seems to have issues. Returns [(family, type, proto, canonname, sockaddr)].
- datagram_received(data: bytes, source: 2.12.ipv8.types.Address) None
Callback for when data is received by the socket.
- class 2.12.ipv8.messaging.anonymization.tunnel.Circuit(circuit_id: int, goal_hops: int = 0, ctype: str = CIRCUIT_TYPE_DATA, required_exit: 2.12.ipv8.peer.Peer | None = None, info_hash: bytes | None = None)
Bases:
Tunnel
[Optional
[2.12.ipv8.peer.Peer
]]A peer-to-peer encrypted communication channel, consisting of 0 or more hops (intermediate peers).
- property peer: 2.12.ipv8.peer.Peer | None
Get the gateway peer for this tunnel, if it already exists.
- property state: str
The circuit state.
- This can be either:
CIRCUIT_STATE_CLOSING
CIRCUIT_STATE_EXTENDING
CIRCUIT_STATE_READY
- class 2.12.ipv8.messaging.anonymization.tunnel.Hop(peer: 2.12.ipv8.peer.Peer, flags: list[int] | None = None)
Circuit Hop containing the address, its public key and the first part of the Diffie-Hellman handshake.
- property public_key: 2.12.ipv8.keyvault.public.libnaclkey.LibNaCLPK
Get the public key instance of the hop.
- class 2.12.ipv8.messaging.anonymization.tunnel.RelayRoute(circuit_id: int, peer: 2.12.ipv8.peer.Peer, rendezvous_relay: bool = False)
Bases:
Tunnel
[2.12.ipv8.peer.Peer
]Relay object containing the destination circuit, socket address and whether it is online or not.
- class 2.12.ipv8.messaging.anonymization.tunnel.RendezvousPoint(circuit: Circuit, cookie: bytes)
Rendezvous for circuits to link up.
- class 2.12.ipv8.messaging.anonymization.tunnel.IntroductionPoint(peer: 2.12.ipv8.peer.Peer, seeder_pk: bytes, source: int = PEER_SOURCE_UNKNOWN, last_seen: float | None = None)
A point of introduction, available for linking up.
- class 2.12.ipv8.messaging.anonymization.tunnel.Swarm(info_hash: bytes, hops: int, lookup_func: Callable[[bytes, IntroductionPoint | None, int], asyncio.Future[list[IntroductionPoint]]], seeder_sk: 2.12.ipv8.keyvault.private.libnaclkey.LibNaCLSK | None = None, max_ip_age: float = 180.0, min_dht_lookup_interval: float = 300.0, max_dht_lookup_interval: float = 120.0)
A group of circuit exits that organizes around a SHA-1.
- add_connection(rp_circuit: Circuit, intro_point_used: IntroductionPoint) None
Add a newly known circuit to this swarm.
- remove_connection(rp_circuit: Circuit) bool
Remove the given circuit from this swarm, if we manage it.
This does not close the circuit.
- get_num_connections_incomplete() int
Get the number of circuits we don’t have yet, but know of, in this swarm.
- add_intro_point(ip: IntroductionPoint) IntroductionPoint
Add an available introduction point to this swarm.
Returns the introduction point we should use (not necessarily the one we just added).
- remove_intro_point(ip: IntroductionPoint) None
Remove the given introduction point from this swarm.
- async lookup(target: IntroductionPoint | None = None) list[IntroductionPoint] | None
Lookup introduction points, possibly those that match the given introduction point.