-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(p2p): implement connect
and lookup
#372
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable, but if you have some time I would like to try it out as well..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left a few comments focusing on the API and CLI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did some basic tests with this. Works on my machine 👍
iroh on ramfox/connect [$?] via 🦀 v1.63.0
❯ cargo run -p iroh -- p2p connect /ip4/192.168.100.126/tcp/4001/p2p/12D3KooWBK6nRXqdZBZW6UKQgV4M1nhJAewjkS3iqZqPkza9R8UN
Finished dev [unoptimized + debuginfo] target(s) in 0.18s
Running `target/debug/iroh p2p connect /ip4/192.168.100.126/tcp/4001/p2p/12D3KooWBK6nRXqdZBZW6UKQgV4M1nhJAewjkS3iqZqPkza9R8UN`
Connected!
iroh on ramfox/connect [$?] via 🦀 v1.63.0
❯ cargo run -p iroh -- p2p lookup
Finished dev [unoptimized + debuginfo] target(s) in 0.19s
Running `target/debug/iroh p2p lookup`
peer id: 12D3KooWCLb7tdXfUWSxNhqdFW2RunQTnXPyWaZN6uUguRenMfM2
listening addresses: ["/ip4/127.0.0.1/tcp/4444", "/ip4/192.168.100.17/tcp/4444", "/ip4/109.97.120.25/tcp/4444", "/ip6/64:ff9b::6d61:7819/tcp/4444", "/ip4/10.142.15.221/tcp/57264", "/ip4/109.97.120.25/tcp/57900/ws", "/ip4/100.121.168.64/tcp/4444"]
protocols: []
protocol version:
observed addresses: ["/ip4/109.97.120.25/tcp/4444", "/ip6/64:ff9b::6d61:7819/tcp/4444", "/ip4/10.142.15.221/tcp/57264", "/ip4/109.97.120.25/tcp/57900/ws", "/ip4/100.121.168.64/tcp/4444"]
iroh on ramfox/connect [$?] via 🦀 v1.63.0
❯ cargo run -p iroh -- p2p lookup 12D3KooWBK6nRXqdZBZW6UKQgV4M1nhJAewjkS3iqZqPkza9R8UN
Finished dev [unoptimized + debuginfo] target(s) in 0.17s
Running `target/debug/iroh p2p lookup 12D3KooWBK6nRXqdZBZW6UKQgV4M1nhJAewjkS3iqZqPkza9R8UN`
peer id: 12D3KooWBK6nRXqdZBZW6UKQgV4M1nhJAewjkS3iqZqPkza9R8UN
listening addresses: ["/ip4/192.168.100.126/udp/4001/quic", "/ip4/192.168.100.126/tcp/4001", "/ip4/109.97.120.25/tcp/4001", "/ip4/109.97.120.25/udp/20325/quic", "/ip4/109.97.120.25/tcp/20323"]
protocols: ["/p2p/id/delta/1.0.0", "/ipfs/id/1.0.0", "/ipfs/id/push/1.0.0", "/ipfs/ping/1.0.0", "/libp2p/circuit/relay/0.1.0", "/libp2p/circuit/relay/0.2.0/stop", "/ipfs/lan/kad/1.0.0", "/libp2p/autonat/1.0.0", "/ipfs/bitswap/1.2.0", "/ipfs/bitswap/1.1.0", "/ipfs/bitswap/1.0.0", "/ipfs/bitswap", "/x/", "/libp2p/circuit/relay/0.2.0/hop", "/ipfs/kad/1.0.0", "/libp2p/dcutr"]
protocol version: ipfs/0.1.0
observed addresses: ["/ip4/192.168.100.17/tcp/4444"]
It is a bit hard to figure out if it worked without ipfs p2p peers or something like htat, but I guess that would be the next thing...
Great point. I'll make an issue that can go into 0.1.1 |
43a4639
to
7aa8c02
Compare
a560260
to
d286ab7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smoke tested. Am excited. let's merge!
iroh/src/p2p.rs
Outdated
} | ||
P2pCommands::Connect { addr } => match p2p.connect(&addr.0).await { | ||
Ok(_) => { | ||
println!("Connected!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe print to what we connected? seems like it would be a bit clearer
8bebc5c
to
f68ceda
Compare
f68ceda
to
5d558fe
Compare
This PR cleans up a bunch of messy
connect
behaviourPeerId
kubo swarm connect
can connect toiroh-p2p
, butiroh-ctl p2p connect
does not connect to kubo beetle#214Adds
lookup
behaviourconnect
first attempting to find the peer on the dhtThis needs a follow-up PR to clean up:
iroh p2p lookup
success outputiroh p2p lookup
&iroh p2p connect
error output