From 7a7d5affd02332a52ed9a6bb631f7958e3dcc6b9 Mon Sep 17 00:00:00 2001 From: Abhishek Kondur Date: Thu, 8 Dec 2022 14:54:16 +0530 Subject: [PATCH 1/3] update go mod --- go.mod | 24 +++++++++++++++++++++--- go.sum | 2 ++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index b88e1099..2f2c18e6 100644 --- a/go.mod +++ b/go.mod @@ -2,8 +2,6 @@ module github.com/gravitl/netmaker go 1.19 -replace github.com/gravitl/netclient => /Users/abhishekk/go/src/github.com/gravitl/netclient - require ( github.com/eclipse/paho.mqtt.golang v1.4.2 github.com/go-playground/validator/v10 v10.11.1 @@ -53,10 +51,30 @@ require ( ) require ( - github.com/gravitl/netclient v0.0.0-20221205113827-847146e217b3 + github.com/gravitl/netclient v0.0.0-20221208080934-8f9ebf4e379b github.com/matryer/is v1.4.0 ) +require ( + github.com/devilcove/httpclient v0.6.0 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.0.1 // indirect + github.com/magiconair/properties v1.8.6 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/pelletier/go-toml v1.9.5 // indirect + github.com/pelletier/go-toml/v2 v2.0.5 // indirect + github.com/spf13/cast v1.5.0 // indirect + github.com/spf13/cobra v1.6.0 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/viper v1.13.0 // indirect + github.com/subosito/gotenv v1.4.1 // indirect + github.com/vishvananda/netlink v1.1.0 // indirect + github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df // indirect + golang.zx2c4.com/wintun v0.0.0-20211104114900-415007cec224 // indirect + golang.zx2c4.com/wireguard/windows v0.5.3 // indirect +) + require ( cloud.google.com/go/compute v1.7.0 // indirect fyne.io/systray v1.10.1-0.20220621085403-9a2652634e93 // indirect diff --git a/go.sum b/go.sum index cea5be64..136c6a3a 100644 --- a/go.sum +++ b/go.sum @@ -287,6 +287,8 @@ github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWm github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/goxjs/gl v0.0.0-20210104184919-e3fafc6f8f2a/go.mod h1:dy/f2gjY09hwVfIyATps4G2ai7/hLwLkc5TrPqONuXY= github.com/goxjs/glfw v0.0.0-20191126052801-d2efb5f20838/go.mod h1:oS8P8gVOT4ywTcjV6wZlOU4GuVFQ8F5328KY3MJ79CY= +github.com/gravitl/netclient v0.0.0-20221208080934-8f9ebf4e379b h1:3jJ6KujHPfgc2m9xoyI2tKOzJ3c+ATr17i8Laoxq61c= +github.com/gravitl/netclient v0.0.0-20221208080934-8f9ebf4e379b/go.mod h1:K/gbw9ArTN0rcSqig/npWoa2gsFagHYoK1lFHG/pChA= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/guumaster/hostctl v1.1.3 h1:b/yR3svkYsbr5VBdvfdyLXUl2xaKopSzgE/Xi7+1WRo= github.com/guumaster/hostctl v1.1.3/go.mod h1:h5rDx5Z8Hj2bYZfDt/eX4BNS2RSq7iRcGVQqfROJyH8= From 3bf78fe63837403275fd1e6b52fcacaaf7cef9ea Mon Sep 17 00:00:00 2001 From: Abhishek Kondur Date: Thu, 8 Dec 2022 19:51:07 +0530 Subject: [PATCH 2/3] netclient fix func parameters for build --- netclient/functions/mqpublish.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netclient/functions/mqpublish.go b/netclient/functions/mqpublish.go index 70551d89..fa7a574b 100644 --- a/netclient/functions/mqpublish.go +++ b/netclient/functions/mqpublish.go @@ -193,7 +193,7 @@ func publishMetrics(nodeCfg *config.ClientConfig) { return } - metrics, err := metrics.Collect(nodeCfg.Node.Interface, nodeGET.PeerIDs) + metrics, err := metrics.Collect(nodeCfg.Node.Interface, nodeGET.Node.Network, nodeGET.Node.Proxy, nodeGET.PeerIDs) if err != nil { logger.Log(0, "failed metric collection for node", nodeCfg.Node.Name, err.Error()) } From 79aa9893dc31e34ee3623948da5eb35b3439af13 Mon Sep 17 00:00:00 2001 From: Abhishek Kondur Date: Thu, 8 Dec 2022 21:45:32 +0530 Subject: [PATCH 3/3] change stun port to int type --- config/config.go | 2 +- models/structs.go | 2 +- servercfg/serverconf.go | 11 +++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/config/config.go b/config/config.go index ea153875..33e3a8d3 100644 --- a/config/config.go +++ b/config/config.go @@ -77,7 +77,7 @@ type ServerConfig struct { LicenseValue string `yaml:"license_value"` NetmakerAccountID string `yaml:"netmaker_account_id"` IsEE string `yaml:"is_ee"` - StunPort string `yaml:"stun_port"` + StunPort int `yaml:"stun_port"` StunHost string `yaml:"stun_host"` Proxy string `yaml:"proxy"` } diff --git a/models/structs.go b/models/structs.go index 5221b0df..5022a229 100644 --- a/models/structs.go +++ b/models/structs.go @@ -222,7 +222,7 @@ type ServerConfig struct { Server string `yaml:"server"` Broker string `yaml:"broker"` Is_EE bool `yaml:"isee"` - StunPort string `yaml:"stun_port"` + StunPort int `yaml:"stun_port"` StunHost string `yaml:"stun_host"` } diff --git a/servercfg/serverconf.go b/servercfg/serverconf.go index 8127788a..0a532800 100644 --- a/servercfg/serverconf.go +++ b/servercfg/serverconf.go @@ -692,11 +692,14 @@ func GetNetmakerAccountID() string { return netmakerAccountID } -func GetStunPort() string { - port := "3478" //default +func GetStunPort() int { + port := 3478 //default if os.Getenv("STUN_PORT") != "" { - port = os.Getenv("STUN_PORT") - } else if config.Config.Server.StunPort != "" { + portInt, err := strconv.Atoi(os.Getenv("STUN_PORT")) + if err == nil { + port = portInt + } + } else if config.Config.Server.StunPort != 0 { port = config.Config.Server.StunPort } return port