Commit 5458efe3 authored by tavit ohanian's avatar tavit ohanian

add support for dms3 protocol codec

parent 00e696ad
Pipeline #1353 passed with stages
in 1 minute and 40 seconds
This diff is collapsed.
......@@ -7,9 +7,9 @@ import (
"os/signal"
"syscall"
peerstore "github.com/libp2p/go-libp2p-core/peer"
multiaddr "github.com/multiformats/go-multiaddr"
libp2p "gitlab.dms3.io/p2p/go-p2p"
multiaddr "gitlab.dms3.io/mf/go-multiaddr"
p2p "gitlab.dms3.io/p2p/go-p2p"
peerstore "gitlab.dms3.io/p2p/go-p2p-core/peer"
"gitlab.dms3.io/p2p/go-p2p/p2p/protocol/ping"
)
......@@ -17,12 +17,12 @@ func main() {
// create a background context (i.e. one that never cancels)
ctx := context.Background()
// start a libp2p node that listens on TCP port 2000 on the IPv4
// start a p2p node that listens on TCP port 2000 on the IPv4
// loopback interface
node, err := libp2p.New(ctx,
// libp2p.ListenAddrStrings("/ip4/127.0.0.1/tcp/2000"),
libp2p.ListenAddrStrings("/ip4/127.0.0.1/tcp/0"),
libp2p.Ping(false),
node, err := p2p.New(ctx,
// p2p.ListenAddrStrings("/ip4/127.0.0.1/tcp/2000"),
p2p.ListenAddrStrings("/ip4/127.0.0.1/tcp/0"),
p2p.Ping(false),
)
if err != nil {
panic(err)
......@@ -38,9 +38,9 @@ func main() {
Addrs: node.Addrs(),
}
addrs, err := peerstore.AddrInfoToP2pAddrs(&peerInfo)
fmt.Println("libp2p node address:", addrs[0])
fmt.Println("libp2p node ID:", node.ID())
fmt.Println("libp2p node Host:", node.Mux())
fmt.Println("p2p node address:", addrs[0])
fmt.Println("p2p node ID:", node.ID())
fmt.Println("p2p node Host:", node.Mux())
// if a remote peer has been passed on the command line, connect to it
// and send it 5 ping messages, otherwise wait for a signal to stop
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment