diff --git a/README.md b/README.md index e6a8e62..b08a2e0 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,7 @@ All options can be passed either as command-line flags or environment variables: | `--no-etc-hosts` | WESHER_NO_ETC_HOSTS | whether to skip writing hosts entries for each node in mesh | `false` | | `--log-level LEVEL` | WESHER_LOG_LEVEL | set the verbosity (one of debug/info/warn/error) | `warn` | | `--keepalive-interval INTERVAL` | WESHER_KEEPALIVE_INTERVAL | interval for which to send keepalive packets | `30s` | -| `--rejoin INTERVAL` | WESHER_REJOIN | interval at which join nodes are joined again if away, 0 disables rejoining altogether | `0` | +| `--rejoin INTERVAL` | WESHER_KEEPALIVE_INTERVAL | interval at which join nodes are joined again if away, 0 disables rejoining altogether | `0` | ## Running multiple clusters diff --git a/cluster/cluster.go b/cluster/cluster.go index be6bbd1..c5e1b2f 100644 --- a/cluster/cluster.go +++ b/cluster/cluster.go @@ -31,7 +31,7 @@ type Cluster struct { // New is used to create a new Cluster instance // The returned instance is ready to be updated with the local node settings then joined -func New(name string, init bool, clusterKey []byte, bindAddr string, bindPort int, advertiseAddr string, advertisePort int, useIPAsName bool) (*Cluster, error) { +func New(name string, init bool, clusterKey []byte, bindAddr string, bindPort int, useIPAsName bool) (*Cluster, error) { state := &state{} if !init { loadState(state, name) @@ -47,8 +47,7 @@ func New(name string, init bool, clusterKey []byte, bindAddr string, bindPort in mlConfig.SecretKey = clusterKey mlConfig.BindAddr = bindAddr mlConfig.BindPort = bindPort - mlConfig.AdvertiseAddr = advertiseAddr - mlConfig.AdvertisePort = advertisePort + mlConfig.AdvertisePort = bindPort if useIPAsName && bindAddr != "0.0.0.0" { mlConfig.Name = bindAddr } diff --git a/config.go b/config.go index b9fd051..34528c3 100644 --- a/config.go +++ b/config.go @@ -6,7 +6,6 @@ import ( "github.com/costela/wesher/cluster" "github.com/hashicorp/go-sockaddr" - "github.com/mikioh/ipaddr" "github.com/pkg/errors" "github.com/stevenroose/gonfig" ) @@ -18,7 +17,6 @@ type config struct { Init bool `desc:"whether to explicitly (re)initialize the cluster; any known state from previous runs will be forgotten"` BindAddr string `id:"bind-addr" desc:"IP address to bind to for cluster membership traffic (cannot be used with --bind-iface)"` BindIface string `id:"bind-iface" desc:"Interface to bind to for cluster membership traffic (cannot be used with --bind-addr)"` - AdvertiseAddr string `id:"advertise-addr" desc:"IP address to advertise to other nodes for NAT traversal"` ClusterPort int `id:"cluster-port" desc:"port used for membership gossip traffic (both TCP and UDP); must be the same across cluster" default:"7946"` WireguardPort int `id:"wireguard-port" desc:"port used for wireguard traffic (UDP); must be the same across cluster" default:"51820"` BaseMtu int `id:"mtu" desc:"MTU of the underlying network, taking intermediary hops into account" default:"1500"` @@ -82,10 +80,6 @@ func loadConfig() (*config, error) { } } - if _, err := ipaddr.Parse(config.AdvertiseAddr); err != nil { - config.AdvertiseAddr = "" - } - return &config, nil } diff --git a/go.mod b/go.mod index d33d94b..3204755 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,6 @@ require ( github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/memberlist v0.2.2 github.com/mattn/go-isatty v0.0.12 - github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721 // indirect github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.7.0 github.com/stevenroose/gonfig v0.1.5 diff --git a/main.go b/main.go index 86ddb41..28c8fd3 100644 --- a/main.go +++ b/main.go @@ -35,7 +35,7 @@ func main() { logrus.SetLevel(logLevel) // Create the wireguard and cluster configuration - cluster, err := cluster.New(config.Interface, config.Init, config.ClusterKey, config.BindAddr, config.ClusterPort, config.AdvertiseAddr, config.ClusterPort, config.UseIPAsName) + cluster, err := cluster.New(config.Interface, config.Init, config.ClusterKey, config.BindAddr, config.ClusterPort, config.UseIPAsName) if err != nil { logrus.WithError(err).Fatal("could not create cluster") }