Add UDP Check to the existing Online Proxy Checker
H
Healthy Pelican
def check_socks5_udp(host, port, username=None, password=None,
test_host='1.1.1.1', test_port=53, timeout=10):
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(timeout)
sock.connect((host, port))
auth = Socks5Auth(username, password)
conn = Socks5Connection(sock, auth)
conn.negotiate()
bind_addr, bind_port = conn.udp_associate()
print(f"UDP association established: {bind_addr}:{bind_port}")
header = struct.pack('!BBBB', 0x00, 0x00, 0x00, 0x01) # IPv4
header += socket.inet_aton(test_host)
header += struct.pack('!H', test_port)
dns_query = b'\x00\x00\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00\x07example\x03com\x00\x00\x01\x00\x01'
packet = header + dns_query
udp_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
udp_sock.settimeout(timeout)
udp_sock.sendto(packet, (bind_addr, bind_port))
data, addr = udp_sock.recvfrom(1024)
print(f"Received UDP response from {addr}")
return True
except Exception as e:
print("Error while checking UDP:", str(e))
return False
finally:
sock.close()
udp_sock.close()
Please add this simple logic to your proxy https://dashboard.marsproxies.com/tools/online-proxy-checker checker to check udp connection