Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 8.8% on proxy.golang.org
Top 4.2% dependent packages on proxy.golang.org
Top 2.9% dependent repos on proxy.golang.org

proxy.golang.org : github.com/hujun-open/etherconn

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; For example, with etherconn, a program could send/recive a UDP or IP packet with a source MAC address and VLAN tags don't exists/provisioned in any of OS interfaces; Another benefit is since etherconn bypasses "normal" OS kernel routing and IP stack, in scale setup like tens of thousands conns no longer subject to linux kernel limitation like # of socket/fd limitations, UDP buffer size...etc; Lastly etherconn.RUDPConn implements the net.PacketConn interface, so it could be easily integrated into existing code; Usage: 1. Create a PacketRelay instance and bound to an interface.PacketRelay is the "forward engine" that does actual packet sending/receiving for all EtherConn instances registered with it; PacketRelay send/receive Ethernet packet; PacketRelay is a GO interface, currently there are two implementations: 2. Create one EtherConn for each source MAC+VLAN(s)+EtherType(s) combination needed, and register with the PacketRelay instance. EtherConn send/receive Ethernet payload like IP packet; 3. Create one RUDPConn instance for each UDP endpoint (IP+Port) needed, with a EtherConn. RUDPConn send/receive UDP payload. 4. RUDPConn and EtherConn is 1:1 mapping, while EtherConn and PacketRelay is N:1 mapping; since EtherConn and RUDPConn is 1:1 mapping, which means EtherConn will forward all received UDP pkts to RUDPConn even when its IP/UDP port is different from RUDPConn's endpoint, and RUDPConn could either only accept correct pkt or accept any UDP packet; Egress direction: Ingress direction: Note: PacketRelay parse pkt for Ethernet payload based on following rules: * PacketRelay has default BPFilter set to only allow IPv4/ARP/IPv6 packet * If Ethernet pkt doesn't have VLAN tag, dstMAC + EtherType in Ethernet header is used to locate registered EtherConn * else, dstMAC + VLANs + EtherType in last VLAN tag is used Limitations: Example: XDPRelay uses Linux AF_XDP socket as the underlying forwarding mechinism, so it achives higher performance than RawSocketRelay in multi-core setup, XDPRelay usage notes:

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/hujun-open/etherconn
Keywords: ebpf, ethernet, golang, vlan
License: BSD-2-Clause
Latest release: about 1 year ago
First release: almost 4 years ago
Namespace: github.com/hujun-open
Dependent packages: 2
Dependent repositories: 3
Stars: 12 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 20 days ago

    Loading...
    Readme
    Loading...