10个版本 (5个破坏性版本)
0.6.4 | 2023年8月11日 |
---|---|
0.6.3 | 2023年7月4日 |
0.6.2 | 2023年4月7日 |
0.6.1 | 2023年3月23日 |
0.2.0 | 2020年12月18日 |
#1926 in 网络编程
31KB
400 行
libp2p-lookup
一个小型辅助工具,它接受一个 对等方ID 或 地址 作为输入,并打印出 libp2p-identify 协议的输出。当提供对等方ID时,在连接到节点之前,将在DHT上查找地址。当提供地址时,立即建立连接。
安装
$ cargo install libp2p-lookup
用法
$ libp2p-lookup --help
libp2p-lookup 0.4.0
Lookup libp2p nodes.
USAGE:
libp2p-lookup <SUBCOMMAND>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
SUBCOMMANDS:
dht Lookup peer by its ID via the Kademlia DHT
direct Lookup peer by its address
help Prints this message or the help of the given subcommand(s)
通过 地址 查找对等方
$ libp2p-lookup direct --address /dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa
Lookup for peer with id PeerId("QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa") succeeded.
Protocol version: "ipfs/0.1.0"
Agent version: "go-ipfs/0.8.0/48f94e2"
Observed address: "/ip4/2.200.106.157/tcp/56136"
Listen addresses:
- "/ip4/147.75.77.187/tcp/4001"
- "/ip6/2604:1380:0:c100::1/tcp/4001"
- "/ip4/147.75.77.187/udp/4001/quic"
- "/ip6/2604:1380:0:c100::1/udp/4001/quic"
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"
- "/ipfs/kad/1.0.0"
- "/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/"
通过 对等方ID 查找对等方
$ libp2p-lookup dht --network kusama --peer-id 12D3KooWQKqane1SqWJNWMQkbia9qiMWXkcHtAdfW5eVF8hbwEDw
Lookup for peer with id PeerId("12D3KooWQKqane1SqWJNWMQkbia9qiMWXkcHtAdfW5eVF8hbwEDw") succeeded.
Protocol version: "/substrate/1.0"
Agent version: "Parity Polkadot/v0.8.26-1-803da90-x86_64-linux-gnu (kusama-bootnode-1)"
Observed address: "/ip4/84.189.93.68/tcp/55482"
Listen addresses:
- "/dns/kusama-bootnode-1.paritytech.net/tcp/30333"
- "/dns/kusama-bootnode-1.paritytech.net/tcp/30334/ws"
- "/ip4/51.79.17.206/tcp/30333"
- "/ip4/51.79.17.206/tcp/30334/ws"
- "/dns4/kusama-bootnode-1.paritytech.net/tcp/30333"
- "/dns4/kusama-bootnode-1.paritytech.net/tcp/30334/ws"
- "/ip4/127.0.0.1/tcp/30334/ws"
- "/ip4/127.0.0.1/tcp/30333"
- "/ip4/51.79.17.206/tcp/30334/ws"
- "/ip4/51.79.17.206/tcp/30333"
- "/ip4/10.1.1.56/tcp/30334/ws"
- "/ip4/10.1.1.56/tcp/30333"
- "/ip6/::1/tcp/30334/ws"
- "/ip6/::1/tcp/30333"
- "/ip6/2607:5300:203:51ce::/tcp/30334/ws"
- "/ip6/2607:5300:203:51ce::/tcp/30333"
Protocols:
- "/ksmcc3/block-announces/1"
- "/ksmcc3/transactions/1"
- "/substrate/ksmcc3/6"
- "/substrate/ksmcc3/5"
- "/substrate/ksmcc3/4"
- "/substrate/ksmcc3/3"
- "/ipfs/ping/1.0.0"
- "/ipfs/id/1.0.0"
- "/ksmcc3/kad"
- "/ksmcc3/sync/2"
- "/ksmcc3/finality-proof/1"
- "/ksmcc3/light/2"
依赖项
~33–68MB
~1M SLoC