基于区块链的毕业设计etherconn – 以太康

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计etherconn – 以太康 是一篇很好的国外资料

etherconn

etherconn - 以太康 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” Linux 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:

interface <---> PacketRelay <----> EtherConn <---> RUDPConn                             <----> EtherConn <---> RUDPConn                             <----> EtherConn <---> RUDPConn 
  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

  2. Create one EtherConn for each source MAC+VLAN(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:

UDP_payload -> RUDPConn(add UDP&IP header) -> EtherConn(add Ethernet header) -> PacketRelay 

Ingress direction:

Ethernet_pkt -> PacketRelay (parse pkt) --- EtherPayload(e.g IP_pkt) --> EtherConn Ethernet_pkt -> PacketRelay (parse pkt) --- UDP_payload --> RUDPConn (option to accept any UDP pkt) 

Note: PacketRelay parse pkt for Ethernet payload based on following rules:

  • PacketRelay has list of EtherTypes, by default are 0x0800 (IPv4) and 0x86dd (IPv6)
  • If Ethernet pkt doesn’t have VLAN tag, EtherType in Ethernet header is used to see if the pkt contains the interested payload
  • else, EtherType in last VLAN tag is used

Limitations:

  • linux only
  • since etherconn bypassed linux IP routing stack, it is user’s job to provide functions like:
    • routing next-hop lookup
    • IP -> MAC address resolution
  • no IP packet fragementation/reassembly support
  • using of etherconn requires to put interface in promiscuous mode, which requires root privileges

etherconn

<etherconn>>>

软件包etherconn是一个golang pkg,它允许用户发送/接收以太网负载(如IP pkt)或UDP包,具有自定义的以太网封装,如MAC地址、VLAN标记,而无需在操作系统中创建相应的接口;

例如,使用etherconn,程序可以发送/接收具有源MAC地址和VLAN标记的UDP或IP数据包在任何操作系统接口中都不存在/配置;

另一个好处是,由于etherconn绕过了“正常”的Linux内核路由和IP堆栈,在规模上类似于数万个连接的设置不再受Linux内核限制(如socket/fd限制),UDP缓冲区大小…等等;

最后以太网连接器实现净包装连接接口,因此它可以很容易地集成到现有代码中;

用法:

interface <---> PacketRelay <----> EtherConn <---> RUDPConn                             <----> EtherConn <---> RUDPConn                             <----> EtherConn <---> RUDPConn 
  1. 创建PacketRelay实例并绑定到接口.PacketRelay是“转发引擎”做真正的包发送/接收向其注册的所有EtherConn实例;PacketRelay发送/接收以太网数据包
  2. 为所需的每个源MAC+VLAN组合创建一个EtherConn,并向PacketRelay实例注册。EtherConn发送/接收类似于IP包的以太网负载;
  3. 使用EtherConn为所需的每个UDP端点(IP+端口)创建一个RUDPConn实例。RUDPConn发送/接收UDP负载。
  4. RUDPConn和EtherConn是1:1映射,而EtherConn和PacketRelay是N:1映射;由于EtherConn和RUDPConn是1:1映射,这意味着EtherConn会将所有接收到的UDP pkt转发给RUDPConn,即使其IP/UDP端口与RUDPConn的端点不同,RUDPConn只能接受正确的pkt或接受任何UDP包;

出口方向:

UDP_payload -> RUDPConn(add UDP&IP header) -> EtherConn(add Ethernet header) -> PacketRelay 

入口方向:

Ethernet_pkt -> PacketRelay (parse pkt) --- EtherPayload(e.g IP_pkt) --> EtherConn Ethernet_pkt -> PacketRelay (parse pkt) --- UDP_payload --> RUDPConn (option to accept any UDP pkt) 

注意:PacketRelay根据以下规则解析以太网负载的pkt:

  • PacketRelay有EtherType列表,默认为0x0800(IPv4)和0x86dd(IPv6)
  • 如果Ethernet pkt没有VLAN标记,则使用Ethernet报头中的EtherType来查看pkt是否包含感兴趣的有效负载
  • else,最后一个VLAN标记中的EtherType被使用

限制:

  • 仅限linux
  • 由于etherconn绕过了linux IP路由堆栈,用户的工作是提供如下功能:路由下一跳查找IP-&gt;MAC地址解析
  • 无IP数据包分解/重组支持
  • 使用etherconn需要将接口置于混杂模式,这需要根权限

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/16426.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 !
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计etherconn – 以太康

提供最优质的资源集合

立即查看 了解详情