|
@@ -106,6 +106,12 @@ var CommonFlags []cli.Flag = []cli.Flag{
|
|
Usage: "Changes the default rate limiting configured in helping other peers determine their reachability status",
|
|
Usage: "Changes the default rate limiting configured in helping other peers determine their reachability status",
|
|
EnvVar: "EDGEVPNNATRATELIMIT",
|
|
EnvVar: "EDGEVPNNATRATELIMIT",
|
|
},
|
|
},
|
|
|
|
+ &cli.IntFlag{
|
|
|
|
+ Name: "max-connections",
|
|
|
|
+ Usage: "Max connections",
|
|
|
|
+ EnvVar: "EDGEVPNMAXCONNS",
|
|
|
|
+ Value: 100,
|
|
|
|
+ },
|
|
&cli.StringFlag{
|
|
&cli.StringFlag{
|
|
Name: "ledger-state",
|
|
Name: "ledger-state",
|
|
Usage: "Specify a ledger state directory",
|
|
Usage: "Specify a ledger state directory",
|
|
@@ -151,6 +157,11 @@ var CommonFlags []cli.Flag = []cli.Flag{
|
|
Usage: "Enable low profile. Lowers connections usage",
|
|
Usage: "Enable low profile. Lowers connections usage",
|
|
EnvVar: "EDGEVPNLOWPROFILE",
|
|
EnvVar: "EDGEVPNLOWPROFILE",
|
|
},
|
|
},
|
|
|
|
+ &cli.BoolFlag{
|
|
|
|
+ Name: "low-profile-vpn",
|
|
|
|
+ Usage: "Enable low profile on vpn. Doesn't keep open connections",
|
|
|
|
+ EnvVar: "EDGEVPNVPNLOWPROFILE",
|
|
|
|
+ },
|
|
&cli.StringFlag{
|
|
&cli.StringFlag{
|
|
Name: "log-level",
|
|
Name: "log-level",
|
|
Usage: "Specify loglevel",
|
|
Usage: "Specify loglevel",
|
|
@@ -260,6 +271,10 @@ func cliToOpts(c *cli.Context) ([]node.Option, []vpn.Option, *logger.Logger) {
|
|
|
|
|
|
libp2pOpts := []libp2p.Option{libp2p.UserAgent("edgevpn")}
|
|
libp2pOpts := []libp2p.Option{libp2p.UserAgent("edgevpn")}
|
|
|
|
|
|
|
|
+ if c.Bool("low-profile-vpn") {
|
|
|
|
+ vpnOpts = append(vpnOpts, vpn.LowProfile)
|
|
|
|
+ }
|
|
|
|
+
|
|
if c.Bool("autorelay") {
|
|
if c.Bool("autorelay") {
|
|
libp2pOpts = append(libp2pOpts, libp2p.EnableAutoRelay())
|
|
libp2pOpts = append(libp2pOpts, libp2p.EnableAutoRelay())
|
|
}
|
|
}
|
|
@@ -272,6 +287,17 @@ func cliToOpts(c *cli.Context) ([]node.Option, []vpn.Option, *logger.Logger) {
|
|
))
|
|
))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ cm, err := connmanager.NewConnManager(
|
|
|
|
+ 20,
|
|
|
|
+ c.Int("max-connections"),
|
|
|
|
+ connmanager.WithGracePeriod(80*time.Second),
|
|
|
|
+ )
|
|
|
|
+ if err != nil {
|
|
|
|
+ llger.Fatal("could not create connection manager")
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ libp2pOpts = append(libp2pOpts, libp2p.ConnectionManager(cm))
|
|
|
|
+
|
|
if c.Bool("low-profile") {
|
|
if c.Bool("low-profile") {
|
|
cm := connmanager.NewConnManager(20, 100, 80*time.Second)
|
|
cm := connmanager.NewConnManager(20, 100, 80*time.Second)
|
|
libp2pOpts = append(libp2pOpts, libp2p.ConnectionManager(cm))
|
|
libp2pOpts = append(libp2pOpts, libp2p.ConnectionManager(cm))
|