Skip to content

Commit

Permalink
chore: p2p.rs file refactored. docs: readme updated & demo gif added
Browse files Browse the repository at this point in the history
  • Loading branch information
Aviksaikat committed Jul 2, 2024
1 parent f1b0d31 commit d893492
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 15 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

A bee node implementation in Rust 🦀.

## Demo

![](media/demo.gif)

## Requirements

### 1. `protobuf-compiler`
Expand Down
33 changes: 33 additions & 0 deletions demo.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Output "media/demo.gif"
# Output "media/frames/"
Set Shell zsh
Set FontSize 16
Set Width 1280
Set Height 720
Set FontFamily "jetbrainsmono nfm"
Set Theme "Catppuccin Macchiato"
Set WindowBar Colorful
Set Framerate 60


Hide
Type "tmux -f /dev/null -L test new-session -- fish" Enter
Type "tmux set status && \" Enter
Type 'tmux setw pane-border-style "fg=0" && \' Enter
Type 'tmux setw pane-active-border-style "fg=0"' Enter
Sleep 0.5
Ctrl+L
Sleep 1
Show


Type "cargo run -q"
Enter 1
Sleep 2s
Ctrl+B
Type "["
Up 100
Sleep 10s

Hide
Ctrl+C
Binary file added media/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 1 addition & 15 deletions src/p2p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub async fn run() -> eyre::Result<()> {

const HANDSHAKE_PROTOCOL: StreamProtocol = StreamProtocol::new("/swarm/handshake/11.0.0/handshake");

/// A very simple, `async fn`-based connection handler for our custom echo protocol.
/// `async fn`-based connection handler for our custom echo protocol.
async fn connection_handler(
ma: Multiaddr,
mut control: stream::Control,
Expand Down Expand Up @@ -141,9 +141,6 @@ async fn send(mut stream: Stream, ma: Multiaddr, own_underlay: Multiaddr) -> io:
observed_underlay: ma.to_vec(),
};

// let mut buf = vec![0; syn.encode_length_delimited_to_vec()];
// syn.encode(&mut buf).unwrap();
// println!("{:?}", hex::encode(buf.as_slice()));
stream
.write_all(&syn.encode_length_delimited_to_vec())
.await?;
Expand Down Expand Up @@ -200,17 +197,6 @@ impl Behaviour {
"/ipfs/id/1.0.0".to_string(),
key.clone(),
)),
// auto_nat: autonat::Behaviour::new(
// key.to_peer_id(),
// autonat::Config {
// retry_interval: Duration::from_secs(10),
// refresh_interval: Duration::from_secs(30),
// boot_delay: Duration::from_secs(5),
// throttle_server_period: Duration::ZERO,
// only_global_ips: false,
// ..Default::default()
// },
// ),
ping: ping::Behaviour::default(),
handshake: stream::Behaviour::new(),
}
Expand Down

0 comments on commit d893492

Please sign in to comment.