lotus/node/modules/libp2p/nat.go
Łukasz Magiera 0779e7dc00 Build libp2p node
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
2019-07-01 23:11:33 +02:00

39 lines
1.0 KiB
Go

package libp2p
import (
"github.com/libp2p/go-libp2p"
)
/*import (
"github.com/libp2p/go-libp2p"
autonat "github.com/libp2p/go-libp2p-autonat-svc"
host "github.com/libp2p/go-libp2p-core/host"
libp2pquic "github.com/libp2p/go-libp2p-quic-transport"
"go.uber.org/fx"
"github.com/ipfs/go-ipfs/repo"
"github.com/filecoin-project/go-lotus/node/modules/helpers"
)
func AutoNATService(quic bool) func(repo repo.Repo, mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host) error {
return func(repo repo.Repo, mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host) error {
// collect private net option in case swarm.key is presented
opts, _, err := PNet(repo)
if err != nil {
// swarm key exists but was failed to decode
return err
}
if quic {
opts.Opts = append(opts.Opts, libp2p.DefaultTransports, libp2p.Transport(libp2pquic.NewTransport))
}
_, err = autonat.NewAutoNATService(helpers.LifecycleCtx(mctx, lc), host, opts.Opts...)
return err
}
}
*/
var NatPortMap = simpleOpt(libp2p.NATPortMap())