https://github.com/ccakes/bmp-client-rs
Async BMP client for Rust
https://github.com/ccakes/bmp-client-rs
Last synced: about 1 year ago
JSON representation
Async BMP client for Rust
- Host: GitHub
- URL: https://github.com/ccakes/bmp-client-rs
- Owner: ccakes
- License: mit
- Created: 2020-03-12T18:03:11.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-29T16:09:17.000Z (about 6 years ago)
- Last Synced: 2025-06-02T00:24:37.681Z (about 1 year ago)
- Language: Rust
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bmp-client
This is a simple BMP (BGP Monitoring Protocol) client for Rust. The heavy lifting is done within the bmp-protocol crate, this just provides a simple wrapper with some convenience functions.
### Usage
```toml
# Cargo.toml
[dependencies]
bmp-client = "^0.1"
```
```rust
#[tokio::main]
async fn main() {
let mut tcp = TcpListener::bind("0.0.0.0:1790").await.unwrap();
loop {
let (stream, peer) = tcp.accept().await.unwrap();
println!("Client {} connected", peer);
tokio::spawn(async move {
let mut client = BmpClient::new(stream);
while let Some(message) = client.recv().await {
match message {
Ok(message) => println!("Received a {} message", message.kind),
Err(error) => {
eprintln!("{}", error);
std::process::exit(1);
}
};
}
});
}
}
```
## Contributing
Contributions are welcome, the library is still very barebones.