{"id":18361232,"url":"https://github.com/hujun-open/etherconn","last_synced_at":"2026-03-27T02:18:02.105Z","repository":{"id":57536719,"uuid":"284397556","full_name":"hujun-open/etherconn","owner":"hujun-open","description":"Package etherconn is a golang pkg that allow user to send/receive Ethernet payload (like IP pkt) or UDP packet ,with custom Ethernet encapsulation like MAC address, VLAN tags, without creating corresponding interface in OS;","archived":false,"fork":false,"pushed_at":"2024-10-14T02:12:48.000Z","size":159,"stargazers_count":20,"open_issues_count":3,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-06T14:37:12.577Z","etag":null,"topics":["ebpf","ethernet","golang","vlan"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hujun-open.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":"2020-08-02T05:29:02.000Z","updated_at":"2024-10-14T02:05:22.000Z","dependencies_parsed_at":"2024-11-05T22:34:34.844Z","dependency_job_id":null,"html_url":"https://github.com/hujun-open/etherconn","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/hujun-open/etherconn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hujun-open%2Fetherconn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hujun-open%2Fetherconn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hujun-open%2Fetherconn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hujun-open%2Fetherconn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hujun-open","download_url":"https://codeload.github.com/hujun-open/etherconn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hujun-open%2Fetherconn/sbom","scorecard":{"id":473126,"data":{"date":"2025-08-11","repo":{"name":"github.com/hujun-open/etherconn","commit":"efe7f7bd3ee2b6a2d1a7b8fa070bbd9f83b1348c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/20 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: xdpethfilter_kern.o:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/hujun-open/etherconn/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/hujun-open/etherconn/main.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 goCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 2-Clause \"Simplified\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 10 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":3,"reason":"7 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2023-1988 / GHSA-2wrh-6pvc-2jm9","Warn: Project is vulnerable to: GO-2023-2102 / GHSA-4374-p667-p6c8","Warn: Project is vulnerable to: GHSA-qppj-fm5r-hxr3","Warn: Project is vulnerable to: GO-2024-2687 / GHSA-4v7x-pqxf-cx7m","Warn: Project is vulnerable to: GO-2024-3333","Warn: Project is vulnerable to: GO-2025-3503 / GHSA-qxp5-gwg8-xv66","Warn: Project is vulnerable to: GO-2025-3595 / GHSA-vvgc-356p-c3xw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T14:29:10.330Z","repository_id":57536719,"created_at":"2025-08-19T14:29:10.330Z","updated_at":"2025-08-19T14:29:10.330Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31009858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-27T01:56:05.093Z","status":"online","status_checked_at":"2026-03-27T02:00:08.055Z","response_time":164,"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":["ebpf","ethernet","golang","vlan"],"created_at":"2024-11-05T22:32:49.458Z","updated_at":"2026-03-27T02:18:02.077Z","avatar_url":"https://github.com/hujun-open.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# etherconn\n[![CI](https://github.com/hujun-open/etherconn/actions/workflows/main.yml/badge.svg)](https://github.com/hujun-open/etherconn/actions/workflows/main.yml)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/hujun-open/etherconn)](https://pkg.go.dev/github.com/hujun-open/etherconn)\n\nPackage etherconn is a golang pkg that allow user to send/receive Ethernet\npayload (like IP pkt) or UDP packet ,with custom Ethernet encapsulation like\nMAC address, VLAN tags, without creating corresponding interface in OS;\n\nFor example, with etherconn, a program could send/recive a UDP or IP packet\nwith a source MAC address and VLAN tags don't exists/provisioned in any of OS\ninterfaces;\n\nAnother benefit is since etherconn bypasses \"normal\" OS kernel routing and\nIP stack, in scale setup like tens of thousands conns no longer subject to\nkernel limitation like # of socket/fd limitations, UDP buffer size...etc;\n\nLastly etherconn.RUDPConn implements the net.PacketConn interface,\nso it could be easily integrated into existing code;\n\netherconn supports following types of fowarding engines:\n\n* RawSocketRelay: uses AF_PACKET socket, linux only\n* XDPRelay: uses xdp socket, linux only\n* RawSocketRelayPcap: uses libpcap, windows and linux\n\n\nXDPRelay could achieve higher performance than RawSocketRelay, specially in multi-queue, multi-core enviroment.\n\n## Performance\nTested in a KVM VM with 8 hyperthreading cores, and Intel 82599ES 10GE NIC, achieves 1Mpps with XDPRelay (1000B packet).\n\n## What's New\n\n1. add RawSocketRelayPcap, supports both windows and linux\n\n\n## Dependencies \netherconn require libpcap on linux, npcap on windows.\n\n## Usage\n\n\tinterface \u003c---\u003e PacketRelay \u003c----\u003e EtherConn \u003c---\u003e RUDPConn\n\t                            \u003c----\u003e EtherConn \u003c---\u003e RUDPConn\n\t                            \u003c----\u003e EtherConn \u003c---\u003e RUDPConn\n\n1. Create a PacketRelay instance and bound to an interface.PacketRelay is the\n\"forward engine\" that does actual packet sending/receiving for all EtherConn\ninstances registered with it; PacketRelay send/receive Ethernet packet;\n\n2. Create one EtherConn for each source MAC+VLAN(s)+EtherType(s) combination needed,\nand register with the PacketRelay instance. EtherConn send/receive Ethernet\npayload like IP packet;\n\n3. Create one RUDPConn instance for each UDP endpoint (IP+Port) needed, with a\nEtherConn. RUDPConn send/receive UDP payload.\n\n4. RUDPConn and EtherConn is 1:1 mapping, while EtherConn and PacketRelay is\nN:1 mapping; since EtherConn and RUDPConn is 1:1 mapping, which means EtherConn\nwill forward all received UDP pkts to RUDPConn even when its IP/UDP port is\ndifferent from RUDPConn's endpoint, and RUDPConn could either only accept correct\npkt or accept any UDP packet;\n\nEgress direction:\n\n\tUDP_payload -\u003e RUDPConn(add UDP\u0026IP header) -\u003e EtherConn(add Ethernet header) -\u003e PacketRelay\n\nIngress direction:\n\n\tEthernet_pkt -\u003e (BPFilter) PacketRelay (parse pkt) --- EtherPayload(e.g IP_pkt) --\u003e EtherConn\n\tEthernet_pkt -\u003e (BPFilter) PacketRelay (parse pkt) --- UDP_payload --\u003e RUDPConn (option to accept any UDP pkt)\n\nNote: PacketRelay parse pkt for Ethernet payload based on following rules:\n* PacketRelay has default BPFilter set to only allow IPv4/ARP/IPv6 packet\n* If Ethernet pkt doesn't have VLAN tag, dstMAC + EtherType in Ethernet header is used to locate registered EtherConn\n* else, dstMAC + VLANs +  EtherType in last VLAN tag is used\n\n### SharedEtherConn and SharingRUDPConn\nEtherConn and RUDPConn are 1:1 mapping,which means two RUDPConn can't share same MAC+VLAN+EtherType combination;\n\nSharedEtherConn and SharingRUDPConn solve this issue:\n\n\t                                    L2Endpointkey-1\n\tinterface \u003c---\u003e PacketRelay \u003c----\u003e SharedEtherConn \u003c---\u003e SharingRUDPConn (L4Recvkey-1)\n\t                                                   \u003c---\u003e SharingRUDPConn (L4Recvkey-2)\n\t                                                   \u003c---\u003e SharingRUDPConn (L4Recvkey-3)\n\t                                    L2Endpointkey-2\n\t                            \u003c----\u003e SharedEtherConn \u003c---\u003e SharingRUDPConn (L4Recvkey-4)\n\t                                                   \u003c---\u003e SharingRUDPConn (L4Recvkey-5)\n\t                                                   \u003c---\u003e SharingRUDPConn (L4Recvkey-6)\n\n\n## Example:\n```\n\t// This is an example of using RUDPConn, a DHCPv4 client\n\t// it also uses \"github.com/insomniacslk/dhcp/dhcpv4/nclient4\" for dhcpv4 client part\n\n\t// create PacketRelay for interface \"enp0s10\"\n\trelay, err := etherconn.NewRawSocketRelay(context.Background(), \"enp0s10\")\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create PacketRelay,%v\", err)\n\t}\n\tdefer relay.Stop()\n\tmac, _ := net.ParseMAC(\"aa:bb:cc:11:22:33\")\n\tvlanLlist := []*etherconn.VLAN{\n\t\t\u0026etherconn.VLAN{\n\t\t\tID:        100,\n\t\t\tEtherType: 0x8100,\n\t\t},\n\t}\n\t// create EtherConn, with src mac \"aa:bb:cc:11:22:33\" , VLAN 100 and DefaultEtherTypes,\n\t// with DOT1Q EtherType 0x8100, the mac/vlan doesn't need to be provisioned in OS\n\teconn := etherconn.NewEtherConn(mac, relay, etherconn.WithVLANs(vlanLlist))\n\t// create RUDPConn to use 0.0.0.0 and UDP port 68 as source, with option to accept any UDP packet\n\t// since DHCP server will send reply to assigned IP address\n\trudpconn, err := etherconn.NewRUDPConn(\"0.0.0.0:68\", econn, etherconn.WithAcceptAny(true))\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create RUDPConn,%v\", err)\n\t}\n\t// create DHCPv4 client with the RUDPConn\n\tclnt, err := nclient4.NewWithConn(rudpconn, mac, nclient4.WithDebugLogger())\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create dhcpv4 client for %v\", err)\n\t}\n\t// do DORA\n\t_, _, err = clnt.Request(context.Background())\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish DORA,%v\", err)\n\t}\n```\n\nThere is a more complicated example in [example](/example/) folder\n\n## Limitations:\n\n\t* linux and windows only\n\t* since etherconn bypassed OS IP stack, it is user's job to provide functions like:\n\t    * routing next-hop lookup\n\t    * IP -\u003e MAC address resolution\n\t* no IP packet fragementation/reassembly support\n\t* using of etherconn requires root privileges on linux\n\n## Built-in XDP Kernel Program\netherconn includes a built-in XDP kernel program binary, its source is in [etherconnkern](https://github.com/hujun-open/etherconnkern)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhujun-open%2Fetherconn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhujun-open%2Fetherconn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhujun-open%2Fetherconn/lists"}