{"id":18892360,"url":"https://github.com/hf/dgrelay","last_synced_at":"2025-10-09T06:35:39.664Z","repository":{"id":143824582,"uuid":"418279024","full_name":"hf/dgrelay","owner":"hf","description":null,"archived":false,"fork":false,"pushed_at":"2021-10-31T12:22:35.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-24T04:43:46.378Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hf.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":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-17T23:16:28.000Z","updated_at":"2025-04-04T22:23:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"31bde82e-4323-4e2a-a6c1-6da062928cc1","html_url":"https://github.com/hf/dgrelay","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hf/dgrelay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hf%2Fdgrelay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hf%2Fdgrelay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hf%2Fdgrelay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hf%2Fdgrelay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hf","download_url":"https://codeload.github.com/hf/dgrelay/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hf%2Fdgrelay/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000835,"owners_count":26082951,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-08T08:01:33.668Z","updated_at":"2025-10-09T06:35:39.620Z","avatar_url":"https://github.com/hf.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Datagram Relay\n\nThis is a small Go library that allows transparent (and supposedly performant)\nrelays between a datagram-like file descriptor and a stream-like file\ndescriptor. It also supports relays between two datagram-like or two\nstream-like file descriptors, but assuming that datagrams are being\ntransported. It can be used with SEQPACKET type file descriptors too.\n\nIt's useful when you want to convert a UDP socket into a TCP socket, or\ntransport TUN/TAP packets or frames over a TCP socket... it can be useful with\nVSOCK type sockets too... or to transport QUIC over TCP.\n\nA datagram can't be larger than 65,536 bytes.\n\nOn the stream-side datagrams are prefixed by two-bytes that indicate the size\nof the datagram that follows, in big-endian order.\n\nThe relay can only forward in one direction when there is positive flow between\nthe sides (source can be read and sink can be written), or if there are\ndatagrams in the internal buffer and the sink side is ready to receive them.\nThis is useful because you can use the kernel's flow control algorithms on the\nfile descriptors (like in TCP, or UNIX sockets) to only relay when each side is\nready, allowing you to use minimal system resources and achieve maximal\nthroughput on the relayed link.\n\nNote that the datagram socket *must* be both *bound* and *connected* as this\nlibrary does not care about the source or destination of datagram file\ndescriptors. Also, it goes without mention that the file descriptors must be\nnon-blocking.\n\n## Example\n\n```go\ndgrelay.Forward(\n\tcontext.Background(),\n\t\u0026dgrelay.DatagramFD{\n\t\tFD: afd,\n\t},\n\t\u0026dgrelay.StreamFD{\n\t\tFD: bfd,\n\t},\n\t8,    /* buffers */\n\t2048, /* buffer size */\n)\n```\n\n## License\n\nCopyright © 2021 Stojan Dimitrovski. Some rights reserved.\n\nLicensed under the MIT License. You can get a copy of it in `LICENSE`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhf%2Fdgrelay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhf%2Fdgrelay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhf%2Fdgrelay/lists"}