add port to token

This commit is contained in:
afeiszli 2021-06-01 19:28:01 +00:00
parent 742f019f9b
commit 1c6b8f8a2b
4 changed files with 5 additions and 2 deletions

View file

@ -147,6 +147,7 @@ func RegisterIntClient(client models.IntClient) (models.IntClient, error) {
client.ServerAPIEndpoint = gcfg.APIHost + ":" + gcfg.APIPort
client.ServerAddress = server.ServerAddress
client.ServerPort = server.ServerPort
client.ServerGRPCPort = gcfg.GRPCPort
client.ServerKey = server.ServerKey
if client.ClientID == "" {

View file

@ -631,8 +631,9 @@ func CreateAccessKey(accesskey models.AccessKey, network models.Network) (models
netID := network.NetID
grpcaddress := servercfg.GetGRPCHost() + ":" + servercfg.GetGRPCPort()
apiaddress := servercfg.GetAPIHost() + ":" + servercfg.GetAPIPort()
wgport := servercfg.GetGRPWGCPort()
accessstringdec := grpcaddress + "|" + apiaddress + "|" + netID + "|" + accesskey.Value + "|" + privAddr
accessstringdec := wgport + "|" +grpcaddress + "|" + apiaddress + "|" + netID + "|" + accesskey.Value + "|" + privAddr
accesskey.AccessString = base64.StdEncoding.EncodeToString([]byte(accessstringdec))
//validate accesskey
v := validator.New()

View file

@ -45,7 +45,7 @@ func CreateServerToken(netID string) (string, error) {
privAddr = network.LocalRange
}
accessstringdec := address + "|" + address + "|" + netID + "|" + accesskey.Value + "|" + privAddr
accessstringdec := " " + "|"+ address + "|" + address + "|" + netID + "|" + accesskey.Value + "|" + privAddr
accesskey.AccessString = base64.StdEncoding.EncodeToString([]byte(accessstringdec))

View file

@ -12,6 +12,7 @@ type IntClient struct {
ServerAPIEndpoint string `json:"serverapiendpoint" bson:"serverapiendpoint"`
ServerAddress string `json:"serveraddress" bson:"serveraddress"`
ServerPort string `json:"serverport" bson:"serverport"`
ServerGRPCPort string `json:"serverport" bson:"serverport"`
ServerKey string `json:"serverkey" bson:"serverkey"`
IsServer string `json:"isserver" bson:"isserver"`
}