Merge pull request #4849 from filecoin-project/feat/conngater

Connection Gater support
This commit is contained in:
Łukasz Magiera
2020-11-20 16:25:02 +01:00
committed by GitHub
10 changed files with 497 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
package lp2p
import (
"github.com/libp2p/go-libp2p"
"github.com/libp2p/go-libp2p/p2p/net/conngater"
"github.com/filecoin-project/lotus/node/modules/dtypes"
)
func ConnGater(ds dtypes.MetadataDS) (*conngater.BasicConnectionGater, error) {
return conngater.NewBasicConnectionGater(ds)
}
func ConnGaterOption(cg *conngater.BasicConnectionGater) (opts Libp2pOpts, err error) {
opts.Opts = append(opts.Opts, libp2p.ConnectionGater(cg))
return
}