From 963433357b51ead4447bc4e9e8b1e796ae5c4813 Mon Sep 17 00:00:00 2001 From: mhchaudhry3 Date: Mon, 27 May 2024 23:04:44 -0400 Subject: [PATCH 1/3] Added Dht --- cmd/run/run.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/run/run.go b/cmd/run/run.go index c975a9d..381ed3b 100644 --- a/cmd/run/run.go +++ b/cmd/run/run.go @@ -12,6 +12,8 @@ import ( "github.com/urfave/cli/v2" ww "github.com/wetware/go" "github.com/wetware/go/util" + "github.com/libp2p/go-libp2p-kad-dht" + ) func Command() *cli.Command { @@ -60,6 +62,12 @@ func run() cli.ActionFunc { } defer h.Close() + dht, err := dht.New(c, h) + if err != nil { + return err + } + defer dht.Close() + wetware := suture.New("ww", suture.Spec{ EventHook: util.EventHook, }) @@ -69,7 +77,7 @@ func run() cli.ActionFunc { NS: s, IPFS: node, Host: routedhost.Wrap(h, node.Routing()), - // Router: /* TODO: assign DHT here */, + Router: dht, }.Build(c.Context)) } From 6ef1e33216c75811c7646c948de9650a1b606a3e Mon Sep 17 00:00:00 2001 From: mhchaudhry3 Date: Mon, 27 May 2024 23:05:34 -0400 Subject: [PATCH 2/3] removed extra line --- cmd/run/run.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/run/run.go b/cmd/run/run.go index 381ed3b..602540b 100644 --- a/cmd/run/run.go +++ b/cmd/run/run.go @@ -13,7 +13,6 @@ import ( ww "github.com/wetware/go" "github.com/wetware/go/util" "github.com/libp2p/go-libp2p-kad-dht" - ) func Command() *cli.Command { From 3c8178527007b29ea3e5f2006befe85afbaa6528 Mon Sep 17 00:00:00 2001 From: mhchaudhry3 Date: Tue, 28 May 2024 00:05:31 -0400 Subject: [PATCH 3/3] pass in context --- cmd/run/run.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/run/run.go b/cmd/run/run.go index 602540b..a65cff1 100644 --- a/cmd/run/run.go +++ b/cmd/run/run.go @@ -1,18 +1,19 @@ package run import ( + "context" "net/http" "github.com/ipfs/kubo/client/rpc" iface "github.com/ipfs/kubo/core/coreiface" "github.com/libp2p/go-libp2p" + "github.com/libp2p/go-libp2p-kad-dht" routedhost "github.com/libp2p/go-libp2p/p2p/host/routed" ma "github.com/multiformats/go-multiaddr" "github.com/thejerf/suture/v4" "github.com/urfave/cli/v2" ww "github.com/wetware/go" "github.com/wetware/go/util" - "github.com/libp2p/go-libp2p-kad-dht" ) func Command() *cli.Command { @@ -61,7 +62,7 @@ func run() cli.ActionFunc { } defer h.Close() - dht, err := dht.New(c, h) + dht, err := dht.New(context.Background(), h) if err != nil { return err }