Skip to content

Commit

Permalink
Merge pull request #246 from MaximKsh/master
Browse files Browse the repository at this point in the history
Add forceReachability parameter
  • Loading branch information
vyzo authored Mar 13, 2021
2 parents bfa207e + 54979c3 commit 2a7b233
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions p2pd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ func main() {
useSecio := flag.Bool("secio", false, "Enables SECIO channel security protocol")
useNoise := flag.Bool("noise", true, "Enables Noise channel security protocol")
useTls := flag.Bool("tls", true, "Enables TLS1.3 channel security protocol")
forceReachabilityPublic := flag.Bool("forceReachabilityPublic", false, "Set up ForceReachability as public for autonat")
forceReachabilityPrivate := flag.Bool("forceReachabilityPrivate", false, "Set up ForceReachability as private for autonat")

flag.Parse()

Expand Down Expand Up @@ -371,6 +373,14 @@ func main() {
}
opts = append(opts, securityOpts...)

if *forceReachabilityPrivate && *forceReachabilityPublic {
log.Fatal("forceReachability must be public or private, not both")
} else if *forceReachabilityPrivate {
opts = append(opts, libp2p.ForceReachabilityPrivate())
} else if *forceReachabilityPublic {
opts = append(opts, libp2p.ForceReachabilityPublic())
}

// start daemon
d, err := p2pd.NewDaemon(context.Background(), &c.ListenAddr, c.DHT.Mode, opts...)
if err != nil {
Expand Down

0 comments on commit 2a7b233

Please sign in to comment.