| Crates.io | icmp-socket |
| lib.rs | icmp-socket |
| version | 0.2.0 |
| created_at | 2021-01-31 14:19:22.648002+00 |
| updated_at | 2022-02-09 23:58:57.652091+00 |
| description | ICMP sockets for both IPv4 and IPv6 |
| homepage | |
| repository | https://github.com/zaphar/icmp-socket |
| max_upload_size | |
| id | 348890 |
| size | 63,480 |
An implementation of ICMP Sockets for both IPv4 and IPv6.
Sockets can be created from IP addresses. IPv4 addresses will construct ICMP4 sockets. IPv6 will construct ICMP6 sockets.
let parsed_addr = "127.0.0.1".parse::<Ipv4Addr>().unwrap();
let socket = IcmpSocket4::try_from(parsed_addr).unwrap();
It can construct and parse the common ICMP packets for both ICMP4 and ICMP6.
let packet4 = Icmpv4Packet::with_echo_request(42, 1, "payload".to_bytes());
let packet6 = Icmpv6Packet::with_echo_request(42, 1, "payload".to_bytes());