remove the context from the libp2p and from the Host contructor

This commit is contained in:
Marten Seemann
2021-09-17 18:48:22 +02:00
parent 29da01af70
commit b7bee3855c
37 changed files with 128 additions and 234 deletions

View File

@@ -30,7 +30,7 @@ const Protocol = "/proxy-example/0.0.1"
// makeRandomHost creates a libp2p host with a randomly generated identity.
// This step is described in depth in other tutorials.
func makeRandomHost(port int) host.Host {
host, err := libp2p.New(context.Background(), libp2p.ListenAddrStrings(fmt.Sprintf("/ip4/127.0.0.1/tcp/%d", port)))
host, err := libp2p.New(libp2p.ListenAddrStrings(fmt.Sprintf("/ip4/127.0.0.1/tcp/%d", port)))
if err != nil {
log.Fatalln(err)
}