Skip to content

Commit

Permalink
Add UDP associate functions to the Python wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
egbertbouman committed Jan 27, 2024
1 parent 6f8030f commit e4dcbbb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ipv8_rust_tunnels/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ def set_peer_flags(self, max_relay_early: int) -> None:
if self.is_open():
self.rust_ep.set_peer_flags(max_relay_early)

def create_udp_associate(self, port: int, hops: int) -> int:
"""
Create a SOCKS5 UDP associate socket using the given port and hop count.
Returns the port on which the socket was created (in case port 0 was given as argument).
"""
return self.rust_ep.create_udp_associate(port, hops)

def close_udp_associate(self, port: int) -> None:
"""
Close the SOCKS5 UDP associate socket that's bound to the given port.
"""
return self.rust_ep.close_udp_associate(port)

def datagram_received(self, ip: str, port: int, datagram: bytes) -> None:
"""
Process incoming data that's coming directly from the socket.
Expand Down

0 comments on commit e4dcbbb

Please sign in to comment.