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.
This commit is contained in:
22
tests/test_proto.py
Normal file
22
tests/test_proto.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""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"
|
||||
Reference in New Issue
Block a user