Giter Site home page Giter Site logo

bluefin's Introduction

Bluefin

Bluefin is an experimental, P2P, transport-layer protocol.

Latest Version Documentation Github Workflow License: MIT

Example

Pack-leader

use bluefin::hosts::pack_leader::BluefinPackLeaderBuilder;

#[tokio::main]
async fn main() {
    // Bind and construct a pack-leader over an TUN device
    let mut pack_leader = BluefinPackLeader::builder()
        .name("utun3".to_string())
        .bind_address("192.168.55.2".to_string())
        .netmask("255.255.255.0".to_string())
        .build();

    loop {
        let connection_res = pack_leader.accept().await;

        tokio::spawn(async move {
            match connection_res {
                Ok(conn) => println!("Conn ready! {conn})"),
                Err(err) => eprintln!("\nConnection attempt failed: {:?}", err),
            }
        });

        sleep(Duration::from_secs(1)).await;
    }
}

Client

#[tokio::main]
async fn main() -> std::io::Result<()> {
    let mut client = BluefinClient::builder()
        .name("test_client".to_string())
        .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");

    eprintln!("Conn ready! {conn}");
    Ok(())
}

bluefin's People

Contributors

franklee26 avatar

Watchers

James Cloos avatar  avatar

bluefin's Issues

Handle close connection event

Goal:

A connection is closed when the logical Bluefin connection is in ERROR or CLOSED state OR when the socket is closed. The host with the closed connection should broadcast the closed-state to any connected parties. Currently, hosts do not know if the connected party is still connected and will continuously send bytes even if the connection is closed.

Multiplex over network socket/device

Bluefin is a connection-based protocol BUT it is built on top of UDP, which is connection less. We need an implementation that is able to multiplex over the single network interface and supports both read and write operations.

General performance improvements

Of course as part of MVP, we want to focus on core functionality eg. handshake, tls support, streaming and flow control. However, if the mvp implementation is under-performant then we need to make some investments to ensure this doesn't become a larger issue in the future.

The primary concern as of now is how the read workers operate. We will need to analyse some benchmarks and generate some flamegraphs to determine where our bottlenecks lie.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.