diff --git a/cmd/hvpn-node/hvpn-node.go b/cmd/hvpn-node/hvpn-node.go index ccf6643..eece744 100644 --- a/cmd/hvpn-node/hvpn-node.go +++ b/cmd/hvpn-node/hvpn-node.go @@ -14,9 +14,10 @@ import ( "strings" "time" + "github.com/biter777/countries" + "github.com/google/uuid" "github.com/urfave/cli/v2" "golang.zx2c4.com/wireguard/wgctrl/wgtypes" - "github.com/biter777/countries" hvpnnode3 "gitea.hbanafa.com/HeshamTB/hvpn-node3" ) @@ -35,6 +36,7 @@ var WgPort int var wgLink *hvpnnode3.WGLink var Country countries.CountryCode +var UUID uuid.UUID var httpPort int var TLS_ENABLED bool @@ -211,7 +213,6 @@ func createCliApp() *cli.App { if c == countries.Unknown { return errors.New(fmt.Sprintf("Country code %s is unknown", s)) } - Country = c return nil }, EnvVars: []string{ "HVPN_COUNTRY" }, @@ -287,6 +288,8 @@ func setup(ctx *cli.Context) error { os.Exit(-1) } slog.Info("Node UUID: " + uuid.String()) + UUID = *uuid + Country = countries.ByName(string(ctx.String("country"))) var privateKey wgtypes.Key createPrivKey := func() error { diff --git a/proto/node.go b/proto/node.go index 44488e5..e54a764 100644 --- a/proto/node.go +++ b/proto/node.go @@ -3,6 +3,7 @@ package proto import "time" type NodePublicInfo struct { + UUID string `json:"uuid"` PublicKey string `json:"public_key"` UDPPort int `json:"udp_port"` Endpoint string `json:"endpoint"`