Skip to content
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

Try using DHTClient mode instead of DHT #6

Merged
merged 3 commits into from
May 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ require (
github.com/gorilla/mux v1.7.1
github.com/hsanjuan/ipfs-lite v0.0.3
github.com/ipfs/go-cid v0.0.2
github.com/ipfs/go-datastore v0.0.4
github.com/ipfs/go-ipld-format v0.0.2
github.com/ipfs/go-log v0.0.1
github.com/ipfs/go-unixfs v0.0.5
github.com/libp2p/go-libp2p v0.0.23
github.com/libp2p/go-libp2p v0.0.24
github.com/libp2p/go-libp2p-connmgr v0.0.4
github.com/libp2p/go-libp2p-crypto v0.0.2
github.com/libp2p/go-libp2p-host v0.0.3
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ github.com/jbenet/go-temp-err-catcher v0.0.0-20150120210811-aac704a3f4f2/go.mod
github.com/jbenet/goprocess v0.0.0-20160826012719-b497e2f366b8/go.mod h1:Ly/wlsjFq/qrU3Rar62tu1gASgGw6chQbSh/XgIIXCY=
github.com/jbenet/goprocess v0.1.2 h1:TfvRwwUfgT/umj/REz2B8IxAKzUEX84+xdRAQ+eF2B8=
github.com/jbenet/goprocess v0.1.2/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4=
github.com/jbenet/goprocess v0.1.3 h1:YKyIEECS/XvcfHtBzxtjBBbWK+MbvA6dG8ASiqwvr10=
github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4=
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE=
Expand Down Expand Up @@ -212,6 +214,8 @@ github.com/libp2p/go-libp2p v0.0.3/go.mod h1:Qu8bWqFXiocPloabFGUcVG4kk94fLvfC8mW
github.com/libp2p/go-libp2p v0.0.12/go.mod h1:l8kmLMc4DToz2TtA0aWEaE4/jVMALRKw8Kv2WTR0LHc=
github.com/libp2p/go-libp2p v0.0.23 h1:r/LrjFWHVBTikzCTfNi8AG+7TilnoazAZcGq2a1IeK0=
github.com/libp2p/go-libp2p v0.0.23/go.mod h1:LCZG1r7NRqnBKxrA9sU4KR7cAzze0DgL9j1GxyBFRyg=
github.com/libp2p/go-libp2p v0.0.24 h1:72B9/OrdGLNfzrM8ap9A9WnLx3Wfj1/GQshIerK2Ogw=
github.com/libp2p/go-libp2p v0.0.24/go.mod h1:Tud6jI4LYXihNWiVMoG7YMwVO2XUwoP9vd40i5/B2EA=
github.com/libp2p/go-libp2p-autonat v0.0.2/go.mod h1:fs71q5Xk+pdnKU014o2iq1RhMs9/PMaG5zXRFNnIIT4=
github.com/libp2p/go-libp2p-autonat v0.0.4 h1:cZzdB9KW1ZkHnSjLCB6aFNw47XS4r+SecCVMuVB1xgo=
github.com/libp2p/go-libp2p-autonat v0.0.4/go.mod h1:fs71q5Xk+pdnKU014o2iq1RhMs9/PMaG5zXRFNnIIT4=
Expand Down
13 changes: 4 additions & 9 deletions p2p/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (

humanize "github.com/dustin/go-humanize"
ipfslite "github.com/hsanjuan/ipfs-lite"
ds "github.com/ipfs/go-datastore"
ds_sync "github.com/ipfs/go-datastore/sync"
golog "github.com/ipfs/go-log"
libp2p "github.com/libp2p/go-libp2p"
connmgr "github.com/libp2p/go-libp2p-connmgr"
Expand Down Expand Up @@ -118,15 +120,8 @@ func SetupLibp2p(
}
}()

idht, err := dht.New(ctx, h)
if err != nil {
nerr := h.Close()
if nerr != nil {
return nil, nil, nerr
}
return nil, nil, err
}

dstore := ds_sync.MutexWrap(ds.NewMapDatastore())
idht := dht.NewDHTClient(ctx, h, dstore)
rHost := routedhost.Wrap(h, idht)
return rHost, idht, nil
}
Expand Down