mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-11 23:54:22 +08:00
add port to token
This commit is contained in:
parent
742f019f9b
commit
1c6b8f8a2b
4 changed files with 5 additions and 2 deletions
|
@ -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 == "" {
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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))
|
||||||
|
|
||||||
|
|
|
@ -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"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue