Guide
UDP Proxy Guide: SOCKS5 UDP Support for Speed and Real-Time Applications
HTTP proxies only build TCP tunnels. Games, VoIP, QUIC and UDP DNS need SOCKS5 UDP ASSOCIATE; we explain the flow, the NAT impact and how to test UDP through a proxy.
Key takeaways
- The HTTP proxy `CONNECT` method only builds a TCP tunnel; it does not carry UDP datagrams.
- In SOCKS5, UDP is the optional `UDP ASSOCIATE` (`0x03`) command, and a server without it replies `0x07`.
- A UDP association ends as soon as the TCP control connection it was requested on closes.
- The clearest way to verify a UDP proxy is to send a DNS query over UDP through it and get an answer.
- On WeProxy Static Residential IPv4, UDP ASSOCIATE is available outside Türkiye; Türkiye packages run HTTP and SOCKS5 without UDP.
A UDP proxy is a proxy that relays UDP datagrams between a client and a destination, and in practice it means the SOCKS5 UDP ASSOCIATE command. HTTP proxies only set up TCP tunnels; game traffic, VoIP, QUIC and DNS over UDP pass through a proxy only with a SOCKS5 server that supports UDP ASSOCIATE and a client that uses that command.
Not every package labelled “SOCKS5” carries UDP. In the SOCKS5 standard, UDP is an optional command, and a server can reject it with reply 0x07 (command not supported). This guide walks through the flow as defined in RFC 1928 section 7, explains the NAT and firewall impact, gives a Python example that tests UDP with a real DNS query, and shows which WeProxy products and locations offer UDP.
What is a UDP proxy and why is it a separate feature?
TCP is connection-oriented: it has a three-way handshake, ordered delivery, acknowledgements and retransmission. UDP (RFC 768) does none of this. Each datagram stands alone; if it is lost, the application decides what to do. The cost is possible packet loss; the gain is low latency and predictable jitter.
For a proxy, carrying TCP means accepting a connection and copying a byte stream to the other side. UDP has no stream. The proxy has to read the destination of each datagram, forward the packet and map the reply back to the right client. That needs a separate relay process, a separate port and a separate state table. This is why UDP is a feature providers should state explicitly per product.
Why can’t an HTTP proxy carry UDP?
An HTTP proxy handles HTTPS with the CONNECT method (RFC 9110). The client sends CONNECT example.com:443, the proxy opens a TCP connection to the origin and copies bytes between two TCP sockets. The method is defined for a TCP tunnel; it has no field for opening a UDP port or preserving datagram boundaries.
There is a separate standard for carrying UDP over HTTP: RFC 9298 (CONNECT-UDP, part of the MASQUE family). In practice it runs over HTTP/3 and QUIC, and both client and proxy must support it explicitly. A classic http://host:port proxy setting does not speak this protocol. So when commercial proxy use needs UDP, SOCKS5 is where to look.
Some solutions wrap UDP inside TCP and call it “UDP support”. TCP’s ordered delivery and retransmission then come back. When one packet is lost, the packets behind it wait too (head-of-line blocking); in a voice call this shows up as dropouts, in a game as sudden ping spikes. The application thinks it opened a UDP socket, but the network behaves like TCP.
How does SOCKS5 UDP ASSOCIATE work?
RFC 1928 defines three commands: CONNECT (0x01), BIND (0x02) and UDP ASSOCIATE (0x03). The UDP flow is described in section 7 and has three steps.
Step 1: TCP control connection and authentication
The client first connects to the proxy port over TCP. In the greeting it lists the methods it supports; username/password is method 0x02, and authentication follows RFC 1929. There is no separate authentication for UDP. Datagrams are authorised by the authentication done on this TCP session.
Step 2: UDP ASSOCIATE request and BND.ADDR/BND.PORT
On the same TCP connection, the client sends CMD=0x03. The DST.ADDR and DST.PORT fields state the address and port the client will send UDP datagrams from. If the client does not know this yet, for example behind NAT, the RFC says to send an all-zero address and port.
If the server accepts with REP=0x00, the BND.ADDR and BND.PORT in the reply are the relay address the client sends its datagrams to. This port is usually dynamic and can change with each association. Some servers return 0.0.0.0 in BND.ADDR; in that case the client usually uses the IP of the proxy that the control connection goes to. If the server does not support UDP, the reply is REP=0x07.
Step 3: UDP request header (RSV, FRAG, ATYP)
Every datagram the client sends to the relay carries a header before the application data:
| Field | Size | Value |
|---|---|---|
RSV | 2 bytes | 0x0000 (reserved) |
FRAG | 1 byte | Fragment number; 0x00 = not fragmented |
ATYP | 1 byte | 0x01 IPv4, 0x03 domain name, 0x04 IPv6 |
DST.ADDR | variable | Destination address |
DST.PORT | 2 bytes | Destination port |
DATA | variable | Application data |
The relay reads the header and sends the DATA part to the destination as plain UDP. It wraps the destination’s reply in the same header structure and sends it back to the client. Fragmentation support is optional; per RFC 1928, a server that does not support it must drop any datagram whose FRAG is not zero. In practice clients use FRAG=0x00 and fit the data into a single datagram. The header adds 10 bytes for an IPv4 destination and 22 bytes for IPv6; for applications sending packets close to the MTU, that difference matters.
Why must the TCP control connection stay open?
RFC 1928 is explicit: a UDP association terminates when the TCP connection that the UDP ASSOCIATE request arrived on terminates. The control channel is not only for setup; it defines the lifetime of the association. If the client closes this socket, or an idle timeout or a firewall in the path drops it, the relay port closes and datagrams disappear silently.
So watch two things in a UDP application. First, keep the control socket open for the whole session. Second, in long, quiet sessions, TCP keepalive or periodic application traffic stops middleboxes from forgetting the connection. This is a common cause of the “audio drops after a few minutes” complaint.
How do proxy types compare for UDP?
| Method | Transport | UDP datagram | Typical use |
|---|---|---|---|
HTTP proxy (CONNECT) | TCP tunnel | No | Browser, scraping, APIs |
SOCKS5, CONNECT only | TCP | No (0x07) | TCP apps, remote DNS with socks5h |
SOCKS5 + UDP ASSOCIATE | TCP control + UDP relay | Native UDP | Games, VoIP, UDP DNS, QUIC |
| UDP wrapped in TCP | TCP | Apparently yes | Latency and jitter rise on loss |
| CONNECT-UDP (RFC 9298) | Over HTTP/3 | Yes | Both sides must support it |
For protocol detail, the HTTP vs SOCKS5 comparison covers the TCP side, and this guide covers the UDP side. If you want all of a device’s UDP traffic in a tunnel with one setting, that is a job for a VPN; the proxy vs VPN comparison covers how a per-app proxy differs from a system-wide VPN.
Which applications need UDP?
Instead of guessing whether an application uses UDP, look at the sockets it opens. ss -uanp on Linux and netstat -ano -p UDP on Windows list UDP sockets per process. If the application only uses TCP, you do not need UDP support.
- Online games: Many real-time games send position and state updates over UDP. Some games use TCP only. Check the game’s sockets to see which applies.
- VoIP and WebRTC: RTP media and ICE/STUN candidates are UDP. If UDP is blocked, WebRTC can fall back to TCP or TLS through a TURN server; the call connects, but latency rises.
- QUIC and HTTP/3: QUIC runs over UDP. When QUIC cannot be established, browsers fall back to HTTP/2 or HTTP/1.1 over TCP; the page loads, HTTP/3 is simply not used.
- DNS: Classic DNS uses UDP/53. Remote DNS does not require UDP ASSOCIATE;
socks5hcarries the hostname over the TCP control channel. Details are in the DNS leak guide. - Live streaming: SRT and RTP-based streaming protocols use UDP. HLS and DASH run over HTTP, so TCP is enough.
WebRTC bypassing the proxy in a browser is a separate issue. A UDP-capable proxy does not by itself pull ICE candidates into the tunnel; a browser policy is required.
How do NAT and firewalls affect a UDP proxy?
UDP ASSOCIATE needs a two-way network path. Because the control channel is TCP, reaching the proxy port is not enough. The client must be able to send UDP to the relay port given as BND.PORT and receive the reply.
Typical obstacles:
- Outbound UDP blocked. Corporate networks and some cloud security groups block outbound UDP other than DNS. Symptom: UDP ASSOCIATE is accepted with
0x00, but no datagram reply ever arrives. - NAT mapping timeout. Home routers and CGNAT forget UDP mappings much sooner than TCP ones. The timeout varies by device. In a quiet session the reply datagram cannot get back; a small periodic packet keeps the mapping alive.
- Source address matching. The server may compare the
DST.ADDRin the UDP ASSOCIATE request with the source of incoming datagrams. If a client behind NAT writes its private IP, datagrams can be rejected; that is why zeros are sent when the address is unknown. - Dynamic relay port. If the relay port is not fixed, opening a single port in the firewall is not enough. The egress rule should allow UDP to the proxy IP across a wide port range.
Separate the TCP side first. The port checker tool shows whether the gateway port is reachable over TCP; the test below verifies the UDP relay path. For TCP connection errors and SOCKS reply codes, see the proxy error codes guide.
How do you test a UDP proxy?
The most reliable test is to send a real UDP request through the proxy and get a reply. DNS fits well: the query is small and the answer can be verified. curl uses SOCKS5 for TCP only, and DNS tools such as dig do not speak SOCKS. So the example below implements the RFC 1928 flow directly with the Python standard library.
First verify the TCP path; do not move on to the UDP test until the tunnel works:
curl -sS --socks5-hostname "USER:[email protected]:8989" https://api.ipify.org
Then query an A record with UDP ASSOCIATE. For a UDP-enabled package, connection details are shown in the panel; replace the host and port with those values.
import socket
import struct
PROXY_HOST = "gw.weproxy.com.tr" # host shown in the panel for the UDP-enabled package
PROXY_PORT = 8989
USER, PASSWORD = "USER", "PASSWORD"
DNS_SERVER, DNS_PORT = "1.1.1.1", 53
QNAME = "example.com"
def recv_exact(sock, n):
data = b""
while len(data) < n:
chunk = sock.recv(n - len(data))
if not chunk:
raise ConnectionError("TCP control connection closed")
data += chunk
return data
def read_addr(sock, atyp):
if atyp == 0x01:
host = socket.inet_ntop(socket.AF_INET, recv_exact(sock, 4))
elif atyp == 0x04:
host = socket.inet_ntop(socket.AF_INET6, recv_exact(sock, 16))
else:
host = recv_exact(sock, recv_exact(sock, 1)[0]).decode()
return host, struct.unpack("!H", recv_exact(sock, 2))[0]
def build_dns_query(name):
header = struct.pack("!HHHHHH", 0x1234, 0x0100, 1, 0, 0, 0)
labels = b"".join(bytes([len(p)]) + p.encode() for p in name.split("."))
return header + labels + b"\x00" + struct.pack("!HH", 1, 1) # A, IN
def parse_a_records(msg):
pos = 12
while msg[pos] != 0: # QNAME
pos += msg[pos] + 1
pos += 5 # 0 + QTYPE + QCLASS
ips = []
for _ in range(struct.unpack("!H", msg[6:8])[0]):
pos += 2 if msg[pos] & 0xC0 == 0xC0 else msg.index(b"\x00", pos) + 1 - pos
rtype, _, _, rdlen = struct.unpack("!HHIH", msg[pos:pos + 10])
pos += 10
if rtype == 1 and rdlen == 4:
ips.append(socket.inet_ntoa(msg[pos:pos + 4]))
pos += rdlen
return ips
# 1) TCP control connection + username/password (RFC 1929)
ctrl = socket.create_connection((PROXY_HOST, PROXY_PORT), timeout=10)
ctrl.sendall(b"\x05\x01\x02")
if recv_exact(ctrl, 2) != b"\x05\x02":
raise SystemExit("Proxy did not accept username/password auth")
u, p = USER.encode(), PASSWORD.encode()
ctrl.sendall(bytes([1, len(u)]) + u + bytes([len(p)]) + p)
if recv_exact(ctrl, 2)[1] != 0x00:
raise SystemExit("Authentication rejected")
# 2) UDP ASSOCIATE (CMD=0x03), address and port set to zero
ctrl.sendall(b"\x05\x03\x00\x01" + b"\x00" * 6)
_, rep, _, atyp = recv_exact(ctrl, 4)
relay_host, relay_port = read_addr(ctrl, atyp)
if rep != 0x00:
raise SystemExit(f"UDP ASSOCIATE rejected, REP=0x{rep:02x}")
if relay_host in ("0.0.0.0", "::"):
relay_host = ctrl.getpeername()[0]
print("UDP relay:", relay_host, relay_port)
# 3) DNS query with UDP request header: RSV, FRAG=0, ATYP=IPv4, DST.ADDR, DST.PORT
family, _, _, _, relay = socket.getaddrinfo(relay_host, relay_port, type=socket.SOCK_DGRAM)[0]
udp = socket.socket(family, socket.SOCK_DGRAM)
udp.settimeout(5)
header = b"\x00\x00\x00\x01" + socket.inet_aton(DNS_SERVER) + struct.pack("!H", DNS_PORT)
udp.sendto(header + build_dns_query(QNAME), relay)
data, _ = udp.recvfrom(4096)
if data[2] != 0x00:
raise SystemExit("Fragmented datagram, dropped")
offset = 4 + {0x01: 4, 0x04: 16}.get(data[3], 1 + data[4]) + 2
print("A records:", parse_a_records(data[offset:]))
udp.close()
ctrl.close() # closing the TCP connection ends the UDP association
Read the results like this:
REP=0x07: The server does not support UDP ASSOCIATE. The package or location does not include UDP.REP=0x00followed by a timeout: The command was accepted, but the datagram path is closed. Check the outbound UDP rule on your local network first, then retry from a different network.- A records returned: The UDP relay works. To see which IP it exits from, send UDP to a server you control and read the source address with
tcpdump -n udp port <port>; it should be the proxy exit IP.
Run the same query without the proxy using dig @1.1.1.1 example.com. If the answers match and only the proxied path fails, the problem is on the relay side.
Which clients support SOCKS5 UDP?
A server supporting UDP ASSOCIATE is not enough; the client must also send the command. The table below summarises common tools conservatively. Verify version notes in your own setup.
| Client | SOCKS5 TCP | SOCKS5 UDP | Note |
|---|---|---|---|
| Proxifier | Yes | Yes | Routes application traffic to SOCKS5 by rules |
| curl | Yes | No | --socks5 and --socks5-hostname are TCP only |
| Chromium-based browsers | Yes | No | QUIC and WebRTC UDP do not enter the tunnel in a SOCKS5 profile |
Python requests | Yes (requests[socks]) | No | An HTTP client, TCP only |
Node.js socks package | Yes | associate command | The application builds the datagram frame |
| Your own code (example above) | Yes | Yes | Implements the RFC 1928 flow directly |
System-level redirection tools such as Proxifier are used for games and desktop applications that have no proxy setting of their own. When writing rules, exclude the gateway address itself from proxying; otherwise the connection loops.
Which WeProxy products and locations offer UDP?
At WeProxy, UDP support depends on product and location. Most products offer HTTP and SOCKS5; the mobile 5G product offers HTTP only. UDP ASSOCIATE is available only where the product page states it explicitly.
| Product | Protocol | UDP ASSOCIATE |
|---|---|---|
| Static Residential IPv4, locations outside Türkiye | HTTP / SOCKS5 | Yes |
| Static Residential IPv4, Türkiye | HTTP / SOCKS5 | No |
| Gaming Proxy | HTTP / SOCKS5 | Not stated on the product page |
| Other residential, datacenter, ISP and IPv6 products | HTTP / SOCKS5 | Not stated on the product page |
| Mobile 5G Proxy | HTTP | No |
For Static Residential IPv4, the UDP locations are the US, Germany, France, the Netherlands, Spain, Canada, the United Kingdom, Australia, Hong Kong and Italy. The product gives an ISP-sourced IPv4 that stays fixed for the period, with unlimited traffic per IP and p0f OS spoofing. Türkiye packages work with HTTP and SOCKS5 and do not include UDP ASSOCIATE. This does not prevent remote DNS with socks5h on Türkiye packages.
Gaming Proxy is a Türkiye-located product with a fixed IP and a low-latency target for games such as Metin2, Knight Online and Silkroad; its protocol is listed as HTTP / SOCKS5. If your game uses UDP, run the socket check and ask support before buying. The gaming proxy use case page is a general starting point for game scenarios. Starter packages are on each product page.
Checklist before choosing a UDP proxy
- Confirm that the application actually uses UDP with
ss -uanpornetstat -ano -p UDP. - Confirm from documentation or a test that the client can send SOCKS5 UDP ASSOCIATE.
- Check UDP support for the product and location on the product page; “SOCKS5” alone is not enough.
- Verify TCP gateway access with the port checker and the UDP relay path with the DNS test above, separately.
- In long sessions, keep the TCP control connection open and use keepalive during quiet periods.
- Read the game and platform rules. Some games’ terms of service restrict proxy or VPN use. Use must follow the target’s rules and the WeProxy acceptable use policy.
A UDP proxy is not a marketing badge but a specific protocol flow: a TCP control channel that stays open, a relay port, and a 10-byte header per datagram for an IPv4 destination. If all three work, game, voice and QUIC traffic passes through the proxy as native UDP. If one is missing, the application either falls back to TCP or silently loses packets.
Frequently asked questions
Can an HTTP proxy send UDP traffic?
A classic HTTP proxy cannot. The CONNECT method used for HTTPS builds a TCP tunnel and does not preserve datagram boundaries. CONNECT-UDP (RFC 9298), which carries UDP over HTTP, is a separate standard used with HTTP/3 and requires explicit support on both client and proxy. For commercial proxy use that needs UDP, choose SOCKS5 with UDP ASSOCIATE.
What is SOCKS5 UDP ASSOCIATE?
UDP ASSOCIATE is the SOCKS5 command (0x03) defined in RFC 1928. The client connects to the proxy over TCP, authenticates, then sends this command. The proxy replies with a relay address and port (BND.ADDR, BND.PORT). The client sends UDP datagrams to that relay with a header containing RSV, FRAG and ATYP fields, and the relay forwards them to the destination.
How do I test whether a proxy supports UDP?
First verify the TCP path with curl. Then use a client that sends UDP ASSOCIATE to make a DNS query through the proxy. A REP=0x07 reply means the server does not support UDP. If the command is accepted but no answer arrives, your local network may block outbound UDP. If A records come back, the UDP relay works; confirm the exit IP with tcpdump on your own server.
Why does my SOCKS5 UDP connection drop after a few minutes?
The most common cause is the TCP control connection closing. Under RFC 1928, a UDP association ends when the TCP connection that carried the UDP ASSOCIATE request ends. If a firewall or idle timeout drops that socket, the relay port closes too. The second cause is NAT mapping timeout: in quiet UDP sessions the router forgets the mapping. TCP keepalive and small periodic packets prevent this.
Can Proxifier route UDP traffic through a proxy?
Yes. Proxifier can route application UDP traffic to a SOCKS5 server if the server supports UDP ASSOCIATE. For this to work, the chosen proxy product and location must support UDP. When writing rules, exclude the gateway address from proxying, otherwise the connection loops. Test your version's UDP behaviour in your own setup.
Do WeProxy Türkiye packages support UDP?
No. In the Static Residential IPv4 product, Türkiye packages offer HTTP and SOCKS5 without UDP ASSOCIATE. UDP is available in the US, Germany, France, the Netherlands, Spain, Canada, the United Kingdom, Australia, Hong Kong and Italy. Remote DNS resolution with socks5h still works on Türkiye packages, because the hostname travels over the TCP control channel.









