Merge pull request #4849 from filecoin-project/feat/conngater
Connection Gater support
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user