{"id":47185049,"url":"https://github.com/danpodeanu/udp-redirect","last_synced_at":"2026-03-13T09:01:22.655Z","repository":{"id":197568017,"uuid":"698902820","full_name":"danpodeanu/udp-redirect","owner":"danpodeanu","description":"A simple yet flexible and very fast UDP redirector. Supports IPv4 and IPv6.","archived":false,"fork":false,"pushed_at":"2026-03-12T16:03:52.000Z","size":1246,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-12T17:35:56.141Z","etag":null,"topics":["c","udp-client-server","udp-ports","udp-redirect","udp-relay"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danpodeanu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-10-01T10:33:48.000Z","updated_at":"2026-03-12T16:03:56.000Z","dependencies_parsed_at":"2024-03-23T11:19:32.181Z","dependency_job_id":"12142222-6890-45ea-b504-8c3c265bad0a","html_url":"https://github.com/danpodeanu/udp-redirect","commit_stats":null,"previous_names":["danpodeanu/udp-redirect"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/danpodeanu/udp-redirect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danpodeanu%2Fudp-redirect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danpodeanu%2Fudp-redirect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danpodeanu%2Fudp-redirect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danpodeanu%2Fudp-redirect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danpodeanu","download_url":"https://codeload.github.com/danpodeanu/udp-redirect/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danpodeanu%2Fudp-redirect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30463549,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T06:34:02.089Z","status":"ssl_error","status_checked_at":"2026-03-13T06:33:49.182Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","udp-client-server","udp-ports","udp-redirect","udp-relay"],"created_at":"2026-03-13T09:00:57.606Z","updated_at":"2026-03-13T09:01:22.641Z","avatar_url":"https://github.com/danpodeanu.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# udp-redirect\nA simple yet flexible and very fast UDP redirector. Supports IPv4 and IPv6. Tested on Linux x64 and MacOS / Darwin arm64.\n\nUseful for redirecting UDP traffic (e.g., Wireguard VPN, DNS, etc.) when doing it at a different layer (e.g., from a firewall) is difficult. Does not modify the redirected packets.\n\nSingle file source code for convenience. Offers both C and Rust versions.\n\n![C CI](https://github.com/danpodeanu/udp-redirect/actions/workflows/c-cpp.yml/badge.svg)\n![Rust CI](https://github.com/danpodeanu/udp-redirect/actions/workflows/rust.yml/badge.svg)\n![CodeQL](https://github.com/danpodeanu/udp-redirect/actions/workflows/codeql.yml/badge.svg)\n![Docs](https://github.com/danpodeanu/udp-redirect/actions/workflows/docs.yml/badge.svg)\n[![License: GPL v2](https://img.shields.io/badge/License-GPL_v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)\n\n**Community contributions are welcome.**\n\n# Documentation\n\nDoxygen generated documentation: [https://danpodeanu.github.io/udp-redirect/](https://danpodeanu.github.io/udp-redirect/)\n\n## Security\n\nBy default, the listener accepts packets from any source and forwards replies to the most recently seen source. This makes the process an unauthenticated UDP relay. If the listen port is reachable by untrusted networks, lock it down with `--listen-address-strict` and/or `--listen-sender-address` + `--listen-sender-port`, and consider firewalling the listen port to expected sources only.\n\n## Compile\n\n```# make```\n\nor\n\n```# gcc udp-redirect.c -o udp-redirect -Wall -O3```\n\n## Run\n\n```\n./udp-redirect \\\n    --listen-port 51821 \\\n    --connect-host example.endpoint.net --connect-port 51822\n```\n\n```\n./udp-redirect \\\n    --debug \\\n    --listen-address 192.168.1.32 --listen-port 51821 --listen-interface en0 \\\n        --listen-address-strict \\\n    --connect-host example.endpoint.net --connect-port 51822 \\\n        --connect-address-strict \\\n    --send-interface utun5 \\\n    --listen-sender-address 192.168.1.1 --listen-sender-port 51820\n```\n\n```mermaid\ngraph TD\n    A[\"--------------------\u003cbr/\u003eWireguard Client\u003cbr/\u003e--------------------\u003cbr/\u003eSend from:\u003cbr/\u003e---------------\u003cbr/\u003eIP: 192.168.1.1\u003cbr/\u003ePort: 51820\"] \u003c--\u003e B(\"--------------------\u003cbr/\u003eUDP Redirector\u003cbr/\u003e--------------------\u003cbr/\u003eReceive on:\u003cbr/\u003e---------------\u003cbr/\u003eIP: 192.168.1.32 (--listen-address) (optional)\u003cbr/\u003ePort: 51821 (--listen-port)\u003cbr/\u003eInterface: en0 (--listen-interface) (optional)\u003cbr/\u003e---------------\u003cbr/\u003eReceive from: (optional)\u003cbr/\u003e---------------\u003cbr/\u003eIP: 192.168.1.1 (--listen-sender-address) (optional)\u003cbr/\u003ePort: 51820 (--listen-sender-port) (optional)\u003cbr/\u003eOnly receive from Wireguard Client (--listen-address-strict) (optional)\u003cbr/\u003e---------------\u003cbr/\u003eSend to:\u003cbr/\u003e---------------\u003cbr/\u003eHost: example.endpoint.net (--connect-host)\u003c/br\u003ePort: 51822 (--connect-port)\u003cbr/\u003eOnly receive from Wireguard Server (--connect-address-strict) (optional)\u003cbr/\u003e---------------\u003cbr/\u003eSend from:\u003cbr/\u003e---------------\u003cbr/\u003eInterface: utun5 (--sender-interface) (optional)\u003cbr/\u003e\u003cbr/\u003e\")\n    B \u003c--\u003e C[\"--------------------\u003cbr/\u003eWireguard Server\u003cbr/\u003e--------------------\u003cbr/\u003eListen on:\u003cbr/\u003e---------------\u003cbr/\u003eHost: example.endpoint.net\u003cbr/\u003ePort: 51822\"]\n```\n\nSample statistics output when invoked with ```--stats```:\n```\n---- STATS 60s ----\nlisten:receive:packets: 7.5K (122.4 /s), listen:receive:bytes: 3.6M (59.4K/s)\nlisten:send:packets: 12.8K (210.2 /s), listen:send:bytes: 13.8M (225.4K/s)\nconnect:receive:packets: 12.8K (210.2 /s), connect:receive:bytes: 13.8M (225.4K/s)\nconnect:send:packets: 7.5K (122.4 /s), connect:send:bytes: 3.6M (59.4K/s)\n---- STATS TOTAL ----\nlisten:receive:packets: 45.8K (250.0 /s), listen:receive:bytes: 13.2M (72.4K/s)\nlisten:send:packets: 98.3K (537.1 /s), listen:send:bytes: 122.9M (671.4K/s)\nconnect:receive:packets: 98.3K (537.1 /s), connect:receive:bytes: 122.9M (671.4K/s)\nconnect:send:packets: 45.8K (250.0 /s), connect:send:bytes: 13.2M (72.4K/s)\n```\n\n# Command Line Arguments\n\n```udp-redirect [arguments]```\n\nRuns in foreground and expects external process control (svscan, nohup, etc.)\n\n## Debug\n\n| Argument | Parameters | Req/Opt | Description |\n| --- | --- | --- | --- |\n| ```--stats``` | | *optional* | Display sent/received bytes statistics every 60 seconds. |\n| ```--verbose``` | | *optional* | Verbose mode, can be specified multiple times. |\n| ```--debug``` | | *optional* | Debug mode (e.g., very verbose). |\n| ```--version``` | | *optional* | Display the version and exit. |\n\n## Listener\n\nThe UDP sender (e.g., wireguard client) sends packets to the UDP redirector specified below.\n\n| Argument | Parameters | Req/Opt | Description |\n| --- | --- | --- | --- |\n| ```--listen-address``` | address | *optional* | Listen address (IPv4 or IPv6), defaults to INADDR_ANY / IN6ADDR_ANY. |\n| ```--listen-port``` | port | **required** | Listen port. |\n| ```--listen-interface``` | interface | *optional* | Listen interface name. |\n| ```--listen-address-strict``` | | *optional* | **Security:** By default, packets received from the connect endpoint will be sent to the source of the last packet received on the listener endpoint. In ```listen-address-strict``` mode, only accept packets from the same source as the first packet, or the source specified by ```listen-sender-address``` and ```listen-sender-port```. |\n\n## Connect\n\nThe UDP redirector sends packets to the endpoint specified below.\n\n| Argument | Parameters | Req/Opt | Description |\n| --- | --- | --- | --- |\n| ```--connect-address``` | address | *optional if `--connect-host` is specified* | Connect address (IPv4 or IPv6). |\n| ```--connect-host``` | hostname | *optional if `--connect-address` is specified* | Connect host; overwrites `--connect-address` if both are specified. |\n| ```--connect-port``` | port | **required** | Connect port. |\n| ```--connect-address-strict``` | | *optional* | **Security**: Only accept packets from ```connect-host``` and ```connect-port```, otherwise accept from all sources. |\n\n# Sender\n\nThe UDP redirector sends packets from the local endpoint specified below. If any arguments are missing, it will be selected by the operating system (usually INADDR_ANY, random port, default interface).\n\n| Argument | Parameters | Req/Opt | Description |\n| --- | --- | --- | --- |\n| ```--send-address``` | address | *optional* | Send packets from this address (IPv4 or IPv6). |\n| ```--send-port``` | port | *optional* | Send packets from this port. |\n| ```--send-interface``` | interface | *optional* | Send packets from this interface name. |\n\n# Listener security\n\nBoth must be specified; listener drops packets if they do not arrive from this address / port.\n\n| Argument | Parameters | Req/Opt | Description |\n| --- | --- | --- | --- |\n| ```--listen-sender-address``` | address | *optional* | Listen endpoint only accepts packets from this source address (IPv4 or IPv6). |\n| ```--listen-sender-port``` | port | *optional* | Listen endpoint only accepts packets from this source port (must be set together, ```--listen-address-strict``` is implied). |\n\n# Miscellaneous\n\n| Argument | Parameters | Req/Opt | Description |\n| --- | --- | --- | --- |\n| ```--ignore-errors``` | | *optional* | Ignore most receive or send errors (host / network unreachable, etc.) instead of exiting. *(default)* |\n| ```--stop-errors``` | | *optional* | Stop on most receive or send errors (host / network unreachable, etc.) |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanpodeanu%2Fudp-redirect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanpodeanu%2Fudp-redirect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanpodeanu%2Fudp-redirect/lists"}