Skip to content

Secure Scuttlebutt RPC "packet stream" protocol (rust library)

License

Notifications You must be signed in to change notification settings

sunrise-choir/ssb-packetstream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Packet Stream

Documentation Build Status

An implementation of the packet-stream protocol used by Secure Scuttlebutt.

use futures::prelude::{SinkExt, StreamExt};
use packetstream::*;

let p = Packet {
    is_stream: IsStream::Yes,
    is_end: IsEnd::No,
    body_type: BodyType::Binary,
    id: 12345,
    body: vec![1,2,3,4,5]
};

let (writer, reader) = async_ringbuffer::ring_buffer(64);

let mut sink = PacketSink::new(writer);
let mut stream = PacketStream::new(reader);

async {
    sink.send(p).await;
    let r = stream.next().await.unwrap().unwrap();
    assert_eq!(&r.body, &[1,2,3,4,5]);
    assert_eq!(r.id, 12345);
};

About

Secure Scuttlebutt RPC "packet stream" protocol (rust library)

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages