Bluefin
is an experimental, P2P, transport-layer protocol.
![Latest Version]
![Documentation]
```rust use bluefin::hosts::pack_leader::BluefinPackLeaderBuilder;
async fn main() { // Bind and construct a pack-leader over an TUN device let mut packleader = BluefinPackLeader::builder() .name("utun3".tostring()) .bindaddress("192.168.55.2".tostring()) .netmask("255.255.255.0".tostring()) .sourceid([1, 3, 1, 8]) .build();
loop {
let mut buf = vec![0; 1504];
let connection_res = pack_leader.accept(&mut buf).await;
tokio::spawn(async move {
match connection_res {
Ok(mut conn) => conn.process().await,
Err(err) => eprintln!("\nConnection attempt failed: {:?}", err),
}
});
}
} ```
```rust
async fn main() -> std::io::Result<()> { let mut client = BluefinClient::builder() .name("testclient".tostring()) .source_id([1, 2, 3, 4]) .build();
let port = rand::thread_rng().gen_range(10000..50000);
client
.bind("0.0.0.0", port)
.expect("Failed to bind client socket");
let mut conn = client
.connect("192.168.55.2", 31416)
.await
.expect("Failed to connect to host");
Ok(())
} ```