{"id":23988796,"url":"https://github.com/gloryofnight/udp-relay","last_synced_at":"2026-05-21T10:32:44.474Z","repository":{"id":228209965,"uuid":"765421779","full_name":"GloryOfNight/udp-relay","owner":"GloryOfNight","description":"Relay server for connecting two peers behind NAT","archived":false,"fork":false,"pushed_at":"2026-04-02T21:28:57.000Z","size":308,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-03T07:58:23.083Z","etag":null,"topics":["cpp23","networking","relay","server","udp"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GloryOfNight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"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},"funding":{"github":"GloryOfNight","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2024-02-29T22:13:33.000Z","updated_at":"2026-04-02T21:29:03.000Z","dependencies_parsed_at":"2024-06-10T13:38:58.758Z","dependency_job_id":"f3af82b7-3147-45d7-adce-f8733c05ce4f","html_url":"https://github.com/GloryOfNight/udp-relay","commit_stats":null,"previous_names":["gloryofnight/udp-relay"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/GloryOfNight/udp-relay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GloryOfNight%2Fudp-relay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GloryOfNight%2Fudp-relay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GloryOfNight%2Fudp-relay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GloryOfNight%2Fudp-relay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GloryOfNight","download_url":"https://codeload.github.com/GloryOfNight/udp-relay/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GloryOfNight%2Fudp-relay/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33297519,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T02:57:32.698Z","status":"ssl_error","status_checked_at":"2026-05-21T02:57:31.990Z","response_time":62,"last_error":"SSL_read: 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":["cpp23","networking","relay","server","udp"],"created_at":"2025-01-07T16:15:56.561Z","updated_at":"2026-05-21T10:32:44.469Z","avatar_url":"https://github.com/GloryOfNight.png","language":"C++","funding_links":["https://github.com/sponsors/GloryOfNight"],"categories":[],"sub_categories":[],"readme":"# UDP Relay\nSimple UDP packet relay that relays packets between two peers.\n\nAllows client peers anonymously connect with each other, should they known common relay address and 128-bit guid value.\n\nRelay doesn't wrap packets in data-types, it uses handshake process to identify clients and establish channel between them.\n\nIt's recommended to modify the relay to tailor for your specific handshake process.\n\nRelay doesn't support more then 2 clients per channel. Multiple relay instances may solve that for you.\n\nRelay automatically closes established channels after certain period of no communication between peers has passed.\n\nThis project is single-threaded by design.\n\nYou can find all available command-line arguments with `--help`.\n\n[![Windows](https://github.com/GloryOfNight/udp-relay/actions/workflows/windows.yml/badge.svg)](https://github.com/GloryOfNight/udp-relay/actions/workflows/windows.yml)\n[![Linux](https://github.com/GloryOfNight/udp-relay/actions/workflows/linux.yml/badge.svg)](https://github.com/GloryOfNight/udp-relay/actions/workflows/linux.yml)\n\n# How it works\n\n`peer A |NAT| \u003c-\u003e relay \u003c-\u003e |NAT| peer B.`\n\nTo start communication, first you need to agree on the following between peers:\n- IP address of the relay\n- Unique GUID (128-bit) value\n\nThen you can start sending handshake packets every second or so until your client receives a packet back from the relay. This means a connection has been established, and you can proceed to send other packet data.\n\nThis process looks like this:\n```\n// peer A and B start sending handshake values to relay using the same GUID value\nPeer A -- handshake packet with GUID (1,2,3,4) --\u003e  Relay *acknowledges handshake packet*\nPeer B -- handshake packet with GUID (1,2,3,4) --\u003e  Relay *creates mapping between Peer A and Peer B*\n\n// when you start to receive handshake packets on peers, that means relay is established\nPeer A -- handshake packet with GUID (1,2,3,4) --\u003e  Relay *Peer A has mapping for Peer B*\nPeer B \u003c-- handshake packet with GUID (1,2,3,4) --  Relay *Peer A has mapping for Peer B*\n\nPeer B -- handshake packet with GUID (1,2,3,4) --\u003e  Relay *Peer B has mapping for Peer A*\nPeer A \u003c-- handshake packet with GUID (1,2,3,4) --  Relay *Peer B has mapping for Peer A*\n\n// now you can start communication freely via relay.\n// it's crucial to use the same socket or bind the same port values while you want to utilize the relay.\n// note that if communication between peers stops for ~30 seconds - relay will clear the mapping for addresses.\n```\n\nBy default, the relay expects the following header for the handshake. `magicNumber` used to identify handshake packets and `guid` can't be null. Relay expects network byte order.\n\n```c++\n// code from - include/udp-relay/relay.hxx\n\n// MUST override here or use UDP_RELAY_SECRET_KEY env var\nconstexpr std::string_view handshake_secret_key_base64 = \"Zkw2SThGM2VndjZBcEMxNWZrSk85VTd4S2VERDZYdXI=\";\n\n// override if you feel like it or you want break compatability\nconstexpr uint32_t handshake_magic_number_host = 0x4B28000;\nconstexpr uint32_t handshake_magic_number_hton = ur::net::hton32(handshake_magic_number_host);\n\nstruct alignas(8) handshake_header\n{\n\tuint32_t m_magicNumber{handshake_magic_number_be}; // relay packet identifier\n\tuint16_t m_length{};\t\t\t\t\t\t\t   // support handhsake extensions\n\tuint16_t m_flags{};\t\t\t\t\t\t\t\t   // support handhsake extensions\n\tguid m_guid{};\t\t\t\t\t\t\t\t\t   // channel identifier\n\thmac_sha256 m_mac{};\t\t\t\t\t\t\t   // hmac_sha256 generated from whole packet (assuming mac at the moment of generation is null)\n};\nstatic_assert(sizeof(handshake_header) == 56);\n```\n\n# Build\n\n\u003e [!WARNING]\n\u003e AVOID downloading source code from main branch directly since it might contain in-progress code. Only do that from tags or releases page!\n\nProject depends on `OpenSSL::Crypto` component for additional packet validation.\n\nProject uses certain C++23 features, like `\u003cprint\u003e` and `\u003cstacktrace\u003e`. Expected to be compiled without issue using Clang \u003e= 18.1.3 or MSVC \u003e= 19.44.\n\n### List all available presets:\n```\ncmake --list-presets\ncmake --build --list-presets\n```\n\n### Start building\n```\ncmake --preset \u003cpreset\u003e\ncmake --build --preset \u003cbuild-preset\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgloryofnight%2Fudp-relay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgloryofnight%2Fudp-relay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgloryofnight%2Fudp-relay/lists"}