https://github.com/zaphar/icmp-socket
Rust ICMP sockets
https://github.com/zaphar/icmp-socket
Last synced: about 1 year ago
JSON representation
Rust ICMP sockets
- Host: GitHub
- URL: https://github.com/zaphar/icmp-socket
- Owner: zaphar
- License: apache-2.0
- Created: 2021-01-16T18:45:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-11-23T23:07:35.000Z (over 3 years ago)
- Last Synced: 2024-08-08T18:38:51.528Z (almost 2 years ago)
- Language: Rust
- Size: 57.6 KB
- Stars: 15
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ICMP Sockets for both IPv4 and IPv6
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.
```rust
let parsed_addr = "127.0.0.1".parse::().unwrap();
let socket = IcmpSocket4::try_from(parsed_addr).unwrap();
```
It can construct and parse the common ICMP packets for both ICMP4 and ICMP6.
```rust
let packet4 = Icmpv4Packet::with_echo_request(42, 1, "payload".to_bytes());
let packet6 = Icmpv6Packet::with_echo_request(42, 1, "payload".to_bytes());
```
# API Documentation
https://docs.rs/icmp-socket/0.2.0