5 unstable releases
Uses old Rust 2015
0.3.1 | Mar 12, 2018 |
---|---|
0.3.0 | Mar 11, 2018 |
0.2.1 | Mar 8, 2018 |
0.2.0 | Mar 8, 2018 |
0.1.0 | Mar 7, 2018 |
#14 in #secure-scuttlebutt
18KB
230 lines
SSB-Client
A client library for interfacing with a secure-scuttlebutt server.
lib.rs
:
A client library for interfacing with ssb.
sodiumoxide::init();
let addr = SocketAddr::new(Ipv6Addr::localhost().into(), DEFAULT_TCP_PORT);
current_thread::run(|_| {
current_thread::spawn(TcpStream::connect(&addr)
.and_then(|tcp| easy_ssb(tcp).unwrap().map_err(|err| panic!("{:?}", err)))
.map_err(|err| panic!("{:?}", err))
.map(|(mut client, receive, _)| {
current_thread::spawn(receive.map_err(|err| panic!("{:?}", err)));
let (send_request, response) = client.whoami();
current_thread::spawn(send_request.map_err(|err| panic!("{:?}", err)));
current_thread::spawn(response
.map(|res| println!("{:?}", res))
.map_err(|err| panic!("{:?}", err))
.and_then(|_| {
client.close().map_err(|err| panic!("{:?}", err))
}));
}))
});
Dependencies
~27MB
~254K SLoC