fix: correctly set the country code when no flag is passed:
- And send uuid in node info
This commit is contained in:
parent
f0018bbd2f
commit
9836ce6725
@ -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 {
|
||||
|
@ -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"`
|
||||
|
Loading…
Reference in New Issue
Block a user