8000 GitHub - Maxime2/libtransport-tcp
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Maxime2/libtransport-tcp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libtransport-tcp

Rust: nightly License: MIT Build Status

libtransport-tcp in Rust.

Description

This crate provides a TCP-based implementation of the libtransport crate. Other data structures such as the Peer, PeerId, PeerList and Data must be defined by the developer for their individual use case.

Example

A simple example of a method which can use this trait is the common_test method in libtransport:

// Create data type to be sent over TCP stream
struct data (pub u8);

// Create a set of peers with associated addresses and sockets
let a: Vec<String> = vec![
    String::from("127.0.0.1:9000"),
    String::from("127.0.0.1:9001"),
    String::from("127.0.0.1:9002"),
];

// Call the method, using the transport type, with the peers inputted.
common_test::<TCPtransport<data>>(a);

When implementing this yourself, you would obviously need to implement more features and traits. This is just a general idea of how it could work. For a more specific example, refer to the common_test method in libtransport/generic_tests.


RFCs

https://github.com/Fantom-foundation/fantom-rfcs

Developer guide

Install the latest version of Rust. We tend to use nightly versions. CLI tool for installing Rust.

We use rust-clippy linters to improve code quality.

There are plenty of IDEs and other Rust development tools to consider.

CLI instructions

# Install Rust (nightly)
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain nightly
# Install cargo-make (cross-platform feature-rich reimplementation of Make)
$ cargo install --force cargo-make
# Install rustfmt (Rust formatter)
$ rustup component add rustfmt
# Install clippy (Rust linter)
$ rustup component add clippy
# Clone this repo
$ git clone https://github.com/Fantom-foundation/libtransport-tcp && cd libtransport-tcp
# Run tests
$ cargo test
# Format, build and test
$ cargo make

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%
0