Browse Source

add port to token

afeiszli 4 years ago
parent
commit
1c6b8f8a2b

+ 1 - 0
controllers/intClientHttpController.go

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

+ 2 - 1
controllers/networkHttpController.go

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

+ 1 - 1
functions/helpers.go

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

+ 1 - 0
models/intclient.go

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