Files
s5p/tests/test_proto.py
user 0710dda8da feat: initial SOCKS5 proxy with chain support
Asyncio-based SOCKS5 server that tunnels connections through
configurable chains of SOCKS5, SOCKS4/4a, and HTTP CONNECT proxies.
Tor integration via standard SOCKS5 hop.
2026-02-15 03:10:25 +01:00

23 lines
635 B
Python

"""Tests for protocol helpers."""
from s5p.proto import Socks5AddrType, encode_address
class TestEncodeAddress:
"""Test SOCKS5 address encoding."""
def test_ipv4(self):
atyp, data = encode_address("127.0.0.1")
assert atyp == Socks5AddrType.IPV4
assert data == b"\x7f\x00\x00\x01"
def test_ipv6(self):
atyp, data = encode_address("::1")
assert atyp == Socks5AddrType.IPV6
assert len(data) == 16
def test_domain(self):
atyp, data = encode_address("example.com")
assert atyp == Socks5AddrType.DOMAIN
assert data == bytes([11]) + b"example.com"