Bump urfave/cli to v2

Signed-off-by: Mauro Morales <contact@mauromorales.com>
This commit is contained in:
Mauro Morales
2024-04-23 17:22:56 +02:00
parent f7f8137684
commit 9cd56fc0a0
12 changed files with 358 additions and 340 deletions

View File

@@ -22,11 +22,11 @@ import (
"github.com/mudler/edgevpn/api"
"github.com/mudler/edgevpn/pkg/node"
"github.com/mudler/edgevpn/pkg/services"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)
func API() cli.Command {
return cli.Command{
func API() *cli.Command {
return &cli.Command{
Name: "api",
Usage: "Starts an http server to display network informations",
Description: `Start listening locally, providing an API for the network.
@@ -34,8 +34,8 @@ A simple UI interface is available to display network data.`,
UsageText: "edgevpn api",
Flags: append(CommonFlags,
&cli.BoolFlag{
Name: "enable-healthchecks",
EnvVar: "ENABLE_HEALTHCHECKS",
Name: "enable-healthchecks",
EnvVars: []string{"ENABLE_HEALTHCHECKS"},
},
&cli.BoolFlag{
Name: "debug",

View File

@@ -19,38 +19,39 @@ import (
"github.com/mudler/edgevpn/pkg/node"
"github.com/mudler/edgevpn/pkg/services"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)
func DNS() cli.Command {
return cli.Command{
func DNS() *cli.Command {
return &cli.Command{
Name: "dns",
Usage: "Starts a local dns server",
Description: `Start a local dns server which uses the blockchain to resolve addresses`,
UsageText: "edgevpn dns",
Flags: append(CommonFlags,
&cli.StringFlag{
Name: "listen",
Usage: "DNS listening address. Empty to disable dns server",
EnvVar: "DNSADDRESS",
Value: "",
Name: "listen",
Usage: "DNS listening address. Empty to disable dns server",
EnvVars: []string{"DNSADDRESS"},
Value: "",
},
&cli.BoolTFlag{
Name: "dns-forwarder",
Usage: "Enables dns forwarding",
EnvVar: "DNSFORWARD",
&cli.BoolFlag{
Name: "dns-forwarder",
Usage: "Enables dns forwarding",
EnvVars: []string{"DNSFORWARD"},
Value: true,
},
&cli.IntFlag{
Name: "dns-cache-size",
Usage: "DNS LRU cache size",
EnvVar: "DNSCACHESIZE",
Value: 200,
Name: "dns-cache-size",
Usage: "DNS LRU cache size",
EnvVars: []string{"DNSCACHESIZE"},
Value: 200,
},
&cli.StringSliceFlag{
Name: "dns-forward-server",
Usage: "List of DNS forward server, e.g. 8.8.8.8:53, 192.168.1.1:53 ...",
EnvVar: "DNSFORWARDSERVER",
Value: &cli.StringSlice{"8.8.8.8:53", "1.1.1.1:53"},
Name: "dns-forward-server",
Usage: "List of DNS forward server, e.g. 8.8.8.8:53, 192.168.1.1:53 ...",
EnvVars: []string{"DNSFORWARDSERVER"},
Value: cli.NewStringSlice("8.8.8.8:53", "1.1.1.1:53"),
},
),
Action: func(c *cli.Context) error {

View File

@@ -20,7 +20,7 @@ import (
"github.com/mudler/edgevpn/pkg/node"
"github.com/mudler/edgevpn/pkg/services"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)
func cliNamePath(c *cli.Context) (name, path string, err error) {
@@ -43,21 +43,21 @@ func cliNamePath(c *cli.Context) (name, path string, err error) {
return name, path, nil
}
func FileSend() cli.Command {
return cli.Command{
func FileSend() *cli.Command {
return &cli.Command{
Name: "file-send",
Aliases: []string{"fs"},
Usage: "Serve a file to the network",
Description: `Serve a file to the network without connecting over VPN`,
UsageText: "edgevpn file-send unique-id /src/path",
Flags: append(CommonFlags,
cli.StringFlag{
&cli.StringFlag{
Name: "name",
Required: true,
Usage: `Unique name of the file to be served over the network.
This is also the ID used to refer when receiving it.`,
},
cli.StringFlag{
&cli.StringFlag{
Name: "path",
Usage: `File to serve`,
Required: true,
@@ -103,19 +103,19 @@ This is also the ID used to refer when receiving it.`,
}
}
func FileReceive() cli.Command {
return cli.Command{
func FileReceive() *cli.Command {
return &cli.Command{
Name: "file-receive",
Aliases: []string{"fr"},
Usage: "Receive a file which is served from the network",
Description: `Receive a file from the network without connecting over VPN`,
UsageText: "edgevpn file-receive unique-id /dst/path",
Flags: append(CommonFlags,
cli.StringFlag{
&cli.StringFlag{
Name: "name",
Usage: `Unique name of the file to be received over the network.`,
},
cli.StringFlag{
&cli.StringFlag{
Name: "path",
Usage: `Destination where to save the file`,
},

View File

@@ -17,11 +17,11 @@ import (
"context"
"github.com/mudler/edgevpn/pkg/node"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)
func Start() cli.Command {
return cli.Command{
func Start() *cli.Command {
return &cli.Command{
Name: "start",
Usage: "Start the network without activating any interface",
Description: `Connect over the p2p network without establishing a VPN.

View File

@@ -30,7 +30,7 @@ import (
edgevpn "github.com/mudler/edgevpn/pkg/node"
"github.com/mudler/edgevpn/pkg/services"
"github.com/mudler/edgevpn/pkg/vpn"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)
const Copyright string = ` edgevpn Copyright (C) 2021-2022 Ettore Di Giacinto
@@ -63,82 +63,83 @@ func MainFlags() []cli.Flag {
Usage: "Starts API with pprof attached",
},
&cli.BoolFlag{
Name: "api",
Usage: "Starts also the API daemon locally for inspecting the network status",
EnvVar: "API",
Name: "api",
Usage: "Starts also the API daemon locally for inspecting the network status",
EnvVars: []string{"API"},
},
&cli.StringFlag{
Name: "api-listen",
Value: "127.0.0.1:8080",
Usage: "API listening port",
EnvVar: "APILISTEN",
Name: "api-listen",
Value: "127.0.0.1:8080",
Usage: "API listening port",
EnvVars: []string{"APILISTEN"},
},
&cli.BoolFlag{
Name: "dhcp",
Usage: "Enables p2p ip negotiation (experimental)",
EnvVar: "DHCP",
Name: "dhcp",
Usage: "Enables p2p ip negotiation (experimental)",
EnvVars: []string{"DHCP"},
},
&cli.BoolFlag{
Name: "transient-conn",
Usage: "Allow transient connections",
EnvVar: "TRANSIENTCONN",
Name: "transient-conn",
Usage: "Allow transient connections",
EnvVars: []string{"TRANSIENTCONN"},
},
&cli.StringFlag{
Name: "lease-dir",
Value: filepath.Join(basedir, ".edgevpn", "leases"),
Usage: "DHCP leases directory",
EnvVar: "DHCPLEASEDIR",
Name: "lease-dir",
Value: filepath.Join(basedir, ".edgevpn", "leases"),
Usage: "DHCP leases directory",
EnvVars: []string{"DHCPLEASEDIR"},
},
&cli.StringFlag{
Name: "address",
Usage: "VPN virtual address",
EnvVar: "ADDRESS",
Value: "10.1.0.1/24",
Name: "address",
Usage: "VPN virtual address",
EnvVars: []string{"ADDRESS"},
Value: "10.1.0.1/24",
},
&cli.StringFlag{
Name: "dns",
Usage: "DNS listening address. Empty to disable dns server",
EnvVar: "DNSADDRESS",
Value: "",
},
&cli.BoolTFlag{
Name: "dns-forwarder",
Usage: "Enables dns forwarding",
EnvVar: "DNSFORWARD",
Name: "dns",
Usage: "DNS listening address. Empty to disable dns server",
EnvVars: []string{"DNSADDRESS"},
Value: "",
},
&cli.BoolFlag{
Name: "egress",
Usage: "Enables nodes for egress",
EnvVar: "EGRESS",
Name: "dns-forwarder",
Usage: "Enables dns forwarding",
EnvVars: []string{"DNSFORWARD"},
Value: true,
},
&cli.BoolFlag{
Name: "egress",
Usage: "Enables nodes for egress",
EnvVars: []string{"EGRESS"},
},
&cli.IntFlag{
Name: "egress-announce-time",
Usage: "Egress announce time (s)",
EnvVar: "EGRESSANNOUNCE",
Value: 200,
Name: "egress-announce-time",
Usage: "Egress announce time (s)",
EnvVars: []string{"EGRESSANNOUNCE"},
Value: 200,
},
&cli.IntFlag{
Name: "dns-cache-size",
Usage: "DNS LRU cache size",
EnvVar: "DNSCACHESIZE",
Value: 200,
Name: "dns-cache-size",
Usage: "DNS LRU cache size",
EnvVars: []string{"DNSCACHESIZE"},
Value: 200,
},
&cli.StringSliceFlag{
Name: "dns-forward-server",
Usage: "List of DNS forward server, e.g. 8.8.8.8:53, 192.168.1.1:53 ...",
EnvVar: "DNSFORWARDSERVER",
Value: &cli.StringSlice{"8.8.8.8:53", "1.1.1.1:53"},
Name: "dns-forward-server",
Usage: "List of DNS forward server, e.g. 8.8.8.8:53, 192.168.1.1:53 ...",
EnvVars: []string{"DNSFORWARDSERVER"},
Value: cli.NewStringSlice("8.8.8.8:53", "1.1.1.1:53"),
},
&cli.StringFlag{
Name: "router",
Usage: "Sends all packets to this node",
EnvVar: "ROUTER",
Name: "router",
Usage: "Sends all packets to this node",
EnvVars: []string{"ROUTER"},
},
&cli.StringFlag{
Name: "interface",
Usage: "Interface name",
Value: "edgevpn0",
EnvVar: "IFACE",
Name: "interface",
Usage: "Interface name",
Value: "edgevpn0",
EnvVars: []string{"IFACE"},
}}, CommonFlags...)
}

View File

@@ -17,11 +17,11 @@ import (
"fmt"
"github.com/mudler/edgevpn/pkg/trustzone/authprovider/ecdsa"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)
func Peergate() cli.Command {
return cli.Command{
func Peergate() *cli.Command {
return &cli.Command{
Name: "peergater",
Usage: "peergater ecdsa-genkey",
Description: `Peergater auth utilities`,

View File

@@ -22,36 +22,36 @@ import (
"github.com/mudler/edgevpn/api"
"github.com/mudler/edgevpn/pkg/node"
"github.com/mudler/edgevpn/pkg/services"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)
func Proxy() cli.Command {
return cli.Command{
func Proxy() *cli.Command {
return &cli.Command{
Name: "proxy",
Usage: "Starts a local http proxy server to egress nodes",
Description: `Start a proxy locally, providing an ingress point for the network.`,
UsageText: "edgevpn proxy",
Flags: append(CommonFlags,
&cli.StringFlag{
Name: "listen",
Value: ":8080",
Usage: "Listening address",
EnvVar: "PROXYLISTEN",
Name: "listen",
Value: ":8080",
Usage: "Listening address",
EnvVars: []string{"PROXYLISTEN"},
},
&cli.BoolFlag{
Name: "debug",
},
&cli.IntFlag{
Name: "interval",
Usage: "proxy announce time interval",
EnvVar: "PROXYINTERVAL",
Value: 120,
Name: "interval",
Usage: "proxy announce time interval",
EnvVars: []string{"PROXYINTERVAL"},
Value: 120,
},
&cli.IntFlag{
Name: "dead-interval",
Usage: "interval (in seconds) wether detect egress nodes offline",
EnvVar: "PROXYDEADINTERVAL",
Value: 600,
Name: "dead-interval",
Usage: "interval (in seconds) wether detect egress nodes offline",
EnvVars: []string{"PROXYDEADINTERVAL"},
Value: 600,
},
),
Action: func(c *cli.Context) error {

View File

@@ -20,7 +20,7 @@ import (
"github.com/mudler/edgevpn/pkg/node"
"github.com/mudler/edgevpn/pkg/services"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)
func cliNameAddress(c *cli.Context) (name, address string, err error) {
@@ -43,8 +43,8 @@ func cliNameAddress(c *cli.Context) (name, address string, err error) {
return name, address, nil
}
func ServiceAdd() cli.Command {
return cli.Command{
func ServiceAdd() *cli.Command {
return &cli.Command{
Name: "service-add",
Aliases: []string{"sa"},
Usage: "Expose a service to the network without creating a VPN",
@@ -52,11 +52,11 @@ func ServiceAdd() cli.Command {
The host will act as a proxy between the service and the connection`,
UsageText: "edgevpn service-add unique-id ip:port",
Flags: append(CommonFlags,
cli.StringFlag{
&cli.StringFlag{
Name: "name",
Usage: `Unique name of the service to be server over the network.`,
},
cli.StringFlag{
&cli.StringFlag{
Name: "address",
Usage: `Remote address that the service is running to. That can be a remote webserver, a local SSH server, etc.
For example, '192.168.1.1:80', or '127.0.0.1:22'.`,
@@ -98,8 +98,8 @@ For example, '192.168.1.1:80', or '127.0.0.1:22'.`,
}
}
func ServiceConnect() cli.Command {
return cli.Command{
func ServiceConnect() *cli.Command {
return &cli.Command{
Aliases: []string{"sc"},
Usage: "Connects to a service in the network without creating a VPN",
Name: "service-connect",
@@ -108,11 +108,11 @@ Creates a local listener which connects over the service in the network without
`,
UsageText: "edgevpn service-connect unique-id (ip):port",
Flags: append(CommonFlags,
cli.StringFlag{
&cli.StringFlag{
Name: "name",
Usage: `Unique name of the service in the network.`,
},
cli.StringFlag{
&cli.StringFlag{
Name: "address",
Usage: `Address where to bind locally. E.g. ':8080'. A proxy will be created
to the service over the network`,

View File

@@ -37,319 +37,328 @@ import (
"github.com/mudler/edgevpn/pkg/logger"
node "github.com/mudler/edgevpn/pkg/node"
"github.com/mudler/edgevpn/pkg/vpn"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)
var CommonFlags []cli.Flag = []cli.Flag{
&cli.StringFlag{
Name: "config",
Usage: "Specify a path to a edgevpn config file",
EnvVar: "EDGEVPNCONFIG",
Name: "config",
Usage: "Specify a path to a edgevpn config file",
EnvVars: []string{"EDGEVPNCONFIG"},
},
&cli.StringFlag{
Name: "timeout",
Usage: "Specify a default timeout for connection stream",
EnvVar: "EDGEVPNTIMEOUT",
Value: "15s",
Name: "timeout",
Usage: "Specify a default timeout for connection stream",
EnvVars: []string{"EDGEVPNTIMEOUT"},
Value: "15s",
},
&cli.IntFlag{
Name: "mtu",
Usage: "Specify a mtu",
EnvVar: "EDGEVPNMTU",
Value: 1200,
},
&cli.BoolTFlag{
Name: "bootstrap-iface",
Usage: "Setup interface on startup (need privileges)",
EnvVar: "EDGEVPNBOOTSTRAPIFACE",
},
&cli.IntFlag{
Name: "packet-mtu",
Usage: "Specify a mtu",
EnvVar: "EDGEVPNPACKETMTU",
Value: 1420,
},
&cli.IntFlag{
Name: "channel-buffer-size",
Usage: "Specify a channel buffer size",
EnvVar: "EDGEVPNCHANNELBUFFERSIZE",
Value: 0,
},
&cli.IntFlag{
Name: "discovery-interval",
Usage: "DHT discovery interval time",
EnvVar: "EDGEVPNDHTINTERVAL",
Value: 720,
},
&cli.IntFlag{
Name: "ledger-announce-interval",
Usage: "Ledger announce interval time",
EnvVar: "EDGEVPNLEDGERINTERVAL",
Value: 10,
},
&cli.StringFlag{
Name: "autorelay-discovery-interval",
Usage: "Autorelay discovery interval",
EnvVar: "EDGEVPNAUTORELAYDISCOVERYINTERVAL",
Value: "5m",
Name: "mtu",
Usage: "Specify a mtu",
EnvVars: []string{"EDGEVPNMTU"},
Value: 1200,
},
&cli.BoolFlag{
Name: "autorelay-static-only",
Usage: "Use only defined static relays",
EnvVar: "EDGEVPNAUTORELAYSTATICONLY",
Name: "bootstrap-iface",
Usage: "Setup interface on startup (need privileges)",
EnvVars: []string{"EDGEVPNBOOTSTRAPIFACE"},
Value: true,
},
&cli.IntFlag{
Name: "ledger-syncronization-interval",
Usage: "Ledger syncronization interval time",
EnvVar: "EDGEVPNLEDGERSYNCINTERVAL",
Value: 10,
Name: "packet-mtu",
Usage: "Specify a mtu",
EnvVars: []string{"EDGEVPNPACKETMTU"},
Value: 1420,
},
&cli.IntFlag{
Name: "nat-ratelimit-global",
Usage: "Rate limit global requests",
EnvVar: "EDGEVPNNATRATELIMITGLOBAL",
Value: 10,
Name: "channel-buffer-size",
Usage: "Specify a channel buffer size",
EnvVars: []string{"EDGEVPNCHANNELBUFFERSIZE"},
Value: 0,
},
&cli.IntFlag{
Name: "nat-ratelimit-peer",
Usage: "Rate limit perr requests",
EnvVar: "EDGEVPNNATRATELIMITPEER",
Value: 10,
Name: "discovery-interval",
Usage: "DHT discovery interval time",
EnvVars: []string{"EDGEVPNDHTINTERVAL"},
Value: 720,
},
&cli.IntFlag{
Name: "nat-ratelimit-interval",
Usage: "Rate limit interval",
EnvVar: "EDGEVPNNATRATELIMITINTERVAL",
Value: 60,
},
&cli.BoolTFlag{
Name: "nat-ratelimit",
Usage: "Changes the default rate limiting configured in helping other peers determine their reachability status",
EnvVar: "EDGEVPNNATRATELIMIT",
},
&cli.IntFlag{
Name: "max-connections",
Usage: "Max connections",
EnvVar: "EDGEVPNMAXCONNS",
Value: 0,
Name: "ledger-announce-interval",
Usage: "Ledger announce interval time",
EnvVars: []string{"EDGEVPNLEDGERINTERVAL"},
Value: 10,
},
&cli.StringFlag{
Name: "ledger-state",
Usage: "Specify a ledger state directory",
EnvVar: "EDGEVPNLEDGERSTATE",
Name: "autorelay-discovery-interval",
Usage: "Autorelay discovery interval",
EnvVars: []string{"EDGEVPNAUTORELAYDISCOVERYINTERVAL"},
Value: "5m",
},
&cli.BoolTFlag{
Name: "mdns",
Usage: "Enable mDNS for peer discovery",
EnvVar: "EDGEVPNMDNS",
&cli.BoolFlag{
Name: "autorelay-static-only",
Usage: "Use only defined static relays",
EnvVars: []string{"EDGEVPNAUTORELAYSTATICONLY"},
},
&cli.BoolTFlag{
Name: "autorelay",
Usage: "Automatically act as a relay if the node can accept inbound connections",
EnvVar: "EDGEVPNAUTORELAY",
&cli.IntFlag{
Name: "ledger-syncronization-interval",
Usage: "Ledger syncronization interval time",
EnvVars: []string{"EDGEVPNLEDGERSYNCINTERVAL"},
Value: 10,
},
&cli.IntFlag{
Name: "nat-ratelimit-global",
Usage: "Rate limit global requests",
EnvVars: []string{"EDGEVPNNATRATELIMITGLOBAL"},
Value: 10,
},
&cli.IntFlag{
Name: "nat-ratelimit-peer",
Usage: "Rate limit perr requests",
EnvVars: []string{"EDGEVPNNATRATELIMITPEER"},
Value: 10,
},
&cli.IntFlag{
Name: "nat-ratelimit-interval",
Usage: "Rate limit interval",
EnvVars: []string{"EDGEVPNNATRATELIMITINTERVAL"},
Value: 60,
},
&cli.BoolFlag{
Name: "nat-ratelimit",
Usage: "Changes the default rate limiting configured in helping other peers determine their reachability status",
EnvVars: []string{"EDGEVPNNATRATELIMIT"},
Value: true,
},
&cli.IntFlag{
Name: "max-connections",
Usage: "Max connections",
EnvVars: []string{"EDGEVPNMAXCONNS"},
Value: 0,
},
&cli.StringFlag{
Name: "ledger-state",
Usage: "Specify a ledger state directory",
EnvVars: []string{"EDGEVPNLEDGERSTATE"},
},
&cli.BoolFlag{
Name: "mdns",
Usage: "Enable mDNS for peer discovery",
EnvVars: []string{"EDGEVPNMDNS"},
Value: true,
},
&cli.BoolFlag{
Name: "autorelay",
Usage: "Automatically act as a relay if the node can accept inbound connections",
EnvVars: []string{"EDGEVPNAUTORELAY"},
Value: true,
},
&cli.IntFlag{
Name: "concurrency",
Usage: "Number of concurrent requests to serve",
Value: runtime.NumCPU(),
},
&cli.BoolTFlag{
Name: "holepunch",
Usage: "Automatically try holepunching when possible",
EnvVar: "EDGEVPNHOLEPUNCH",
},
&cli.BoolTFlag{
Name: "natservice",
Usage: "Tries to determine reachability status of nodes",
EnvVar: "EDGEVPNNATSERVICE",
},
&cli.BoolTFlag{
Name: "natmap",
Usage: "Tries to open a port in the firewall via upnp",
EnvVar: "EDGEVPNNATMAP",
},
&cli.BoolTFlag{
Name: "dht",
Usage: "Enable DHT for peer discovery",
EnvVar: "EDGEVPNDHT",
&cli.BoolFlag{
Name: "holepunch",
Usage: "Automatically try holepunching when possible",
EnvVars: []string{"EDGEVPNHOLEPUNCH"},
Value: true,
},
&cli.BoolFlag{
Name: "low-profile",
Usage: "Enable low profile. Lowers connections usage",
EnvVar: "EDGEVPNLOWPROFILE",
Name: "natservice",
Usage: "Tries to determine reachability status of nodes",
EnvVars: []string{"EDGEVPNNATSERVICE"},
Value: true,
},
&cli.BoolFlag{
Name: "natmap",
Usage: "Tries to open a port in the firewall via upnp",
EnvVars: []string{"EDGEVPNNATMAP"},
Value: true,
},
&cli.BoolFlag{
Name: "dht",
Usage: "Enable DHT for peer discovery",
EnvVars: []string{"EDGEVPNDHT"},
Value: true,
},
&cli.BoolFlag{
Name: "low-profile",
Usage: "Enable low profile. Lowers connections usage",
EnvVars: []string{"EDGEVPNLOWPROFILE"},
Value: true,
},
&cli.IntFlag{
Name: "aliveness-healthcheck-interval",
Usage: "Healthcheck interval",
EnvVar: "HEALTHCHECKINTERVAL",
Value: 120,
Name: "aliveness-healthcheck-interval",
Usage: "Healthcheck interval",
EnvVars: []string{"HEALTHCHECKINTERVAL"},
Value: 120,
},
&cli.IntFlag{
Name: "aliveness-healthcheck-scrub-interval",
Usage: "Healthcheck scrub interval",
EnvVar: "HEALTHCHECKSCRUBINTERVAL",
Value: 600,
Name: "aliveness-healthcheck-scrub-interval",
Usage: "Healthcheck scrub interval",
EnvVars: []string{"HEALTHCHECKSCRUBINTERVAL"},
Value: 600,
},
&cli.IntFlag{
Name: "aliveness-healthcheck-max-interval",
Usage: "Healthcheck max interval. Threshold after a node is determined offline",
EnvVar: "HEALTHCHECKMAXINTERVAL",
Value: 900,
Name: "aliveness-healthcheck-max-interval",
Usage: "Healthcheck max interval. Threshold after a node is determined offline",
EnvVars: []string{"HEALTHCHECKMAXINTERVAL"},
Value: 900,
},
&cli.StringFlag{
Name: "log-level",
Usage: "Specify loglevel",
EnvVar: "EDGEVPNLOGLEVEL",
Value: "info",
Name: "log-level",
Usage: "Specify loglevel",
EnvVars: []string{"EDGEVPNLOGLEVEL"},
Value: "info",
},
&cli.StringFlag{
Name: "libp2p-log-level",
Usage: "Specify libp2p loglevel",
EnvVar: "EDGEVPNLIBP2PLOGLEVEL",
Value: "fatal",
Name: "libp2p-log-level",
Usage: "Specify libp2p loglevel",
EnvVars: []string{"EDGEVPNLIBP2PLOGLEVEL"},
Value: "fatal",
},
&cli.StringSliceFlag{
Name: "discovery-bootstrap-peers",
Usage: "List of discovery peers to use",
EnvVar: "EDGEVPNBOOTSTRAPPEERS",
Name: "discovery-bootstrap-peers",
Usage: "List of discovery peers to use",
EnvVars: []string{"EDGEVPNBOOTSTRAPPEERS"},
},
&cli.IntFlag{
Name: "connection-high-water",
Usage: "max number of connection allowed",
EnvVar: "EDGEVPN_CONNECTION_HIGH_WATER",
Value: 0,
Name: "connection-high-water",
Usage: "max number of connection allowed",
EnvVars: []string{"EDGEVPN_CONNECTION_HIGH_WATER"},
Value: 0,
},
&cli.IntFlag{
Name: "connection-low-water",
Usage: "low number of connection allowed",
EnvVar: "EDGEVPN_CONNECTION_LOW_WATER",
Value: 0,
Name: "connection-low-water",
Usage: "low number of connection allowed",
EnvVars: []string{"EDGEVPN_CONNECTION_LOW_WATER"},
Value: 0,
},
&cli.StringSliceFlag{
Name: "autorelay-static-peer",
Usage: "List of autorelay static peers to use",
EnvVar: "EDGEVPNAUTORELAYPEERS",
Name: "autorelay-static-peer",
Usage: "List of autorelay static peers to use",
EnvVars: []string{"EDGEVPNAUTORELAYPEERS"},
},
&cli.StringSliceFlag{
Name: "blacklist",
Usage: "List of peers/cidr to gate",
EnvVar: "EDGEVPNBLACKLIST",
Name: "blacklist",
Usage: "List of peers/cidr to gate",
EnvVars: []string{"EDGEVPNBLACKLIST"},
},
&cli.StringFlag{
Name: "token",
Usage: "Specify an edgevpn token in place of a config file",
EnvVar: "EDGEVPNTOKEN",
Name: "token",
Usage: "Specify an edgevpn token in place of a config file",
EnvVars: []string{"EDGEVPNTOKEN"},
},
&cli.BoolFlag{
Name: "limit-enable",
Usage: "Enable resource management",
EnvVar: "LIMITENABLE",
Name: "limit-enable",
Usage: "Enable resource management",
EnvVars: []string{"LIMITENABLE"},
},
&cli.StringFlag{
Name: "limit-file",
Usage: "Specify a resource limit config (json)",
EnvVar: "LIMITFILE",
Name: "limit-file",
Usage: "Specify a resource limit config (json)",
EnvVars: []string{"LIMITFILE"},
},
&cli.StringFlag{
Name: "limit-scope",
Usage: "Specify a limit scope",
EnvVar: "LIMITSCOPE",
Value: "system",
Name: "limit-scope",
Usage: "Specify a limit scope",
EnvVars: []string{"LIMITSCOPE"},
Value: "system",
},
&cli.IntFlag{
Name: "limit-config-streams",
Usage: "Streams resource limit configuration",
EnvVar: "LIMITCONFIGSTREAMS",
Value: 200,
Name: "limit-config-streams",
Usage: "Streams resource limit configuration",
EnvVars: []string{"LIMITCONFIGSTREAMS"},
Value: 200,
},
&cli.IntFlag{
Name: "limit-config-streams-inbound",
Usage: "Inbound streams resource limit configuration",
EnvVar: "LIMITCONFIGSTREAMSINBOUND",
Value: 30,
Name: "limit-config-streams-inbound",
Usage: "Inbound streams resource limit configuration",
EnvVars: []string{"LIMITCONFIGSTREAMSINBOUND"},
Value: 30,
},
&cli.IntFlag{
Name: "limit-config-streams-outbound",
Usage: "Outbound streams resource limit configuration",
EnvVar: "LIMITCONFIGSTREAMSOUTBOUND",
Value: 30,
Name: "limit-config-streams-outbound",
Usage: "Outbound streams resource limit configuration",
EnvVars: []string{"LIMITCONFIGSTREAMSOUTBOUND"},
Value: 30,
},
&cli.IntFlag{
Name: "limit-config-conn",
Usage: "Connections resource limit configuration",
EnvVar: "LIMITCONFIGCONNS",
Value: 200,
Name: "limit-config-conn",
Usage: "Connections resource limit configuration",
EnvVars: []string{"LIMITCONFIGCONNS"},
Value: 200,
},
&cli.IntFlag{
Name: "limit-config-conn-inbound",
Usage: "Inbound connections resource limit configuration",
EnvVar: "LIMITCONFIGCONNSINBOUND",
Value: 30,
Name: "limit-config-conn-inbound",
Usage: "Inbound connections resource limit configuration",
EnvVars: []string{"LIMITCONFIGCONNSINBOUND"},
Value: 30,
},
&cli.IntFlag{
Name: "limit-config-conn-outbound",
Usage: "Outbound connections resource limit configuration",
EnvVar: "LIMITCONFIGCONNSOUTBOUND",
Value: 30,
Name: "limit-config-conn-outbound",
Usage: "Outbound connections resource limit configuration",
EnvVars: []string{"LIMITCONFIGCONNSOUTBOUND"},
Value: 30,
},
&cli.IntFlag{
Name: "limit-config-fd",
Usage: "Max fd resource limit configuration",
EnvVar: "LIMITCONFIGFD",
Value: 30,
Name: "limit-config-fd",
Usage: "Max fd resource limit configuration",
EnvVars: []string{"LIMITCONFIGFD"},
Value: 30,
},
&cli.BoolFlag{
Name: "peerguard",
Usage: "Enable peerguard. (Experimental)",
EnvVar: "PEERGUARD",
Name: "peerguard",
Usage: "Enable peerguard. (Experimental)",
EnvVars: []string{"PEERGUARD"},
},
&cli.BoolFlag{
Name: "privkey-cache",
Usage: "Enable privkey caching. (Experimental)",
EnvVar: "EDGEVPNPRIVKEYCACHE",
Name: "privkey-cache",
Usage: "Enable privkey caching. (Experimental)",
EnvVars: []string{"EDGEVPNPRIVKEYCACHE"},
},
&cli.StringFlag{
Name: "privkey-cache-dir",
Usage: "Specify a directory used to store the generated privkey",
EnvVar: "EDGEVPNPRIVKEYCACHEDIR",
Value: stateDir(),
Name: "privkey-cache-dir",
Usage: "Specify a directory used to store the generated privkey",
EnvVars: []string{"EDGEVPNPRIVKEYCACHEDIR"},
Value: stateDir(),
},
&cli.StringSliceFlag{
Name: "static-peertable",
Usage: "List of static peers to use (in `ip:peerid` format)",
EnvVar: "EDGEVPNSTATICPEERTABLE",
Name: "static-peertable",
Usage: "List of static peers to use (in `ip:peerid` format)",
EnvVars: []string{"EDGEVPNSTATICPEERTABLE"},
},
&cli.StringSliceFlag{
Name: "whitelist",
Usage: "List of peers in the whitelist",
EnvVar: "EDGEVPNWHITELIST",
Name: "whitelist",
Usage: "List of peers in the whitelist",
EnvVars: []string{"EDGEVPNWHITELIST"},
},
&cli.BoolFlag{
Name: "peergate",
Usage: "Enable peergating. (Experimental)",
EnvVar: "PEERGATE",
Name: "peergate",
Usage: "Enable peergating. (Experimental)",
EnvVars: []string{"PEERGATE"},
},
&cli.BoolFlag{
Name: "peergate-autoclean",
Usage: "Enable peergating autoclean. (Experimental)",
EnvVar: "PEERGATE_AUTOCLEAN",
Name: "peergate-autoclean",
Usage: "Enable peergating autoclean. (Experimental)",
EnvVars: []string{"PEERGATE_AUTOCLEAN"},
},
&cli.BoolFlag{
Name: "peergate-relaxed",
Usage: "Enable peergating relaxation. (Experimental)",
EnvVar: "PEERGATE_RELAXED",
Name: "peergate-relaxed",
Usage: "Enable peergating relaxation. (Experimental)",
EnvVars: []string{"PEERGATE_RELAXED"},
},
&cli.StringFlag{
Name: "peergate-auth",
Usage: "Peergate auth",
EnvVar: "PEERGATE_AUTH",
Value: "",
Name: "peergate-auth",
Usage: "Peergate auth",
EnvVars: []string{"PEERGATE_AUTH"},
Value: "",
},
&cli.IntFlag{
Name: "peergate-interval",
Usage: "Peergater interval time",
EnvVar: "EDGEVPNPEERGATEINTERVAL",
Value: 120,
Name: "peergate-interval",
Usage: "Peergater interval time",
EnvVars: []string{"EDGEVPNPEERGATEINTERVAL"},
Value: 120,
},
}

3
go.mod
View File

@@ -37,6 +37,8 @@ require (
gopkg.in/yaml.v2 v2.4.0
)
require github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
@@ -136,6 +138,7 @@ require (
github.com/spf13/cast v1.5.0 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/numcpus v0.6.0 // indirect
github.com/urfave/cli/v2 v2.27.1
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 // indirect

4
go.sum
View File

@@ -507,6 +507,8 @@ github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtX
github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli v1.22.14 h1:ebbhrRiGK2i4naQJr+1Xj92HXZCrK7MsyTS/ob3HnAk=
github.com/urfave/cli v1.22.14/go.mod h1:X0eDS6pD6Exaclxm99NJ3FiCDRED7vIHpx2mDOHLvkA=
github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho=
github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
@@ -523,6 +525,8 @@ github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0 h1:GDDkbFiaK8jsSD
github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k=
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=

View File

@@ -18,7 +18,7 @@ import (
"fmt"
"os"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
"github.com/mudler/edgevpn/cmd"
internal "github.com/mudler/edgevpn/internal"
@@ -29,12 +29,12 @@ func main() {
app := &cli.App{
Name: "edgevpn",
Version: internal.Version,
Author: "Ettore Di Giacinto",
Authors: []*cli.Author{{Name: "Ettore Di Giacinto"}},
Usage: "edgevpn --config /etc/edgevpn/config.yaml",
Description: "edgevpn uses libp2p to build an immutable trusted blockchain addressable p2p network",
Copyright: cmd.Copyright,
Flags: cmd.MainFlags(),
Commands: []cli.Command{
Commands: []*cli.Command{
cmd.Start(),
cmd.API(),
cmd.ServiceAdd(),