Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xpepermint/async-uninet
Unified types for asynchronous TCP & Unix sockets.
https://github.com/xpepermint/async-uninet
address cargo crate inet listener net rust stream tcp unix
Last synced: about 1 month ago
JSON representation
Unified types for asynchronous TCP & Unix sockets.
- Host: GitHub
- URL: https://github.com/xpepermint/async-uninet
- Owner: xpepermint
- License: mit
- Created: 2020-05-09T15:53:07.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-29T12:00:39.000Z (over 4 years ago)
- Last Synced: 2024-11-19T10:56:15.708Z (about 2 months ago)
- Topics: address, cargo, crate, inet, listener, net, rust, stream, tcp, unix
- Language: Rust
- Size: 12.7 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
> Unified types for asynchronous TCP & Unix sockets.
The types provided by this crate allow for writing socket-type-agnostic network applications that treat UNIX sockets in the same way as IPv4 and IPv6.
This package is built using [async-std](https://github.com/async-rs/async-std) and is inspired by the [multisock](https://crates.io/crates/multisock) crate.
## Example
```rs
use async_std::prelude::*;
use async_uninet::{Listener, SocketAddr};
...let address = SocketAddr::from_str("unix:/tmp/sock").await.unwrap(); // use unix socket
let address = SocketAddr::from_str("127.0.0.1:4445").await.unwrap(); // use tcp address
let listener = Listener::bind(&address).await.unwrap();while let Some(stream) = listener.incoming().next().await {
...
}
```