l2ethernet 0.3.0 l2ethernet: ^0.3.0 copied to clipboard
Sending raw Ethernet frames in Dart via FFI. Usable for generating WOL packets or non-standard protocols running on Ethernet. Sending only. Linux only.
Examples #
I added two examples:
- send_packet.dart which shows a simple example to send a raw Ethernet frame. Use
tcpdump -i $nic 'ether proto 0xbeef
to see it being sent out. - colorlight.dart sends several frames for a Colorlight card. Used to test this package.
Notes #
- Both examples need an environment variable
nic
to contain the network interface name to use. - Both need to run either as root or the binary has to have the needed capabilities to use a raw socket:
setcap 'cap_net_admin,cap_net_raw+ep' BINARY
- Because of the requirement to run as root, I highly recommend to compile stand-alone executables (via
dart compile exe
) which can get above capabilities added. This avoids having to run dart as root.