https://github.com/xor-bits/eznet
a simple net lib
https://github.com/xor-bits/eznet
asynchronous network-programming
Last synced: 12 months ago
JSON representation
a simple net lib
- Host: GitHub
- URL: https://github.com/xor-bits/eznet
- Owner: xor-bits
- License: apache-2.0
- Created: 2022-02-04T12:47:50.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T05:38:57.000Z (over 3 years ago)
- Last Synced: 2025-06-11T22:03:10.795Z (about 1 year ago)
- Topics: asynchronous, network-programming
- Language: Rust
- Homepage:
- Size: 159 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# eznet
easy net lib
[](https://deps.rs/repo/github/Overpeek/eznet)
[](https://github.com/Overpeek/eznet/actions)
[](https://crates.io/crates/eznet)
[](https://docs.rs/eznet/)
[ENet](http://enet.bespin.org/)/[laminar](https://github.com/TimonPost/laminar)
style, [Quinn](https://github.com/quinn-rs/quinn) ([QUIC](https://en.wikipedia.org/wiki/QUIC))
based, simple to use and async net lib with configurable reliability and ordering.
## Features:
- Packets are encrypted (but not really securely [TODO](#todo): 1)
- Reliable ordered, reliable sequenced, reliable unordered, unreliable sequenced and unreliable unordered packets
- Easy to use
- Async/await
## Example:
```rust
// examples/simple-server.rs
let mut listener = Listener::bind("127.0.0.1:13331".parse().unwrap()).unwrap();
while let Ok(socket) = listener.next().await {
socket
.send(Packet::ordered(format!("Hello {}!", socket.remote()), None))
.await
.unwrap();
}
// examples/simple-client.rs
let mut socket = Socket::connect("127.0.0.1:13331".parse().unwrap())
.await
.unwrap();
println!(
"{}",
std::str::from_utf8(&socket.recv().await.unwrap().bytes[..]).unwrap()
);
```
## TODO:
- [ ] Encryption doesn't protect
from MITM attacks at the moment.
Only self signed server side
certificates are used and clients
accept everything. Add certificates,
private keys, server names and DNS. (1)
- [x] Open socket magic byte test to
filter out random scanners and
'accidental' connections. (2)
- [ ] Disconnect message when closing. (3)
- [ ] Configurable buffer capacity. (4)
- [x] if packets are sent slightly faster
than once per millisecond, none of them
get actually sent, all of them are buffered. (5)
- [x] actually drop 'old' sequenced packets (6)
- [ ] list of breaking versions and
testing it when filtering (7)
- [ ] More unit tests
- [ ] Socket events. (Disconnect, Timeout, Packet, ...)
## License
Licensed under either of [MIT license](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE) license.
I am not a lawyer.
## MSRV
Currently the Minimum Supported Rust Version is **1.58**.
I do not care to 'minimize' this and it is what it is.