mirror of
https://github.com/gravitl/netmaker.git
synced 2025-02-27 17:42:57 +08:00
Merge pull request #798 from gravitl/feature_v0.11.0_add_commid
added comms id field to nodes
This commit is contained in:
commit
93bcdb225a
2 changed files with 24 additions and 10 deletions
|
@ -92,6 +92,12 @@ func (s *NodeServiceServer) CreateNode(ctx context.Context, req *nodepb.Object)
|
|||
Server: key,
|
||||
}
|
||||
|
||||
commID, err := logic.FetchCommsNetID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
node.CommID = commID
|
||||
|
||||
err = logic.CreateNode(&node)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -10,15 +10,23 @@ import (
|
|||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
const TEN_YEARS_IN_SECONDS = 300000000
|
||||
const MAX_NAME_LENGTH = 62
|
||||
|
||||
// == ACTIONS == (can only be set by GRPC)
|
||||
const NODE_UPDATE_KEY = "updatekey"
|
||||
const NODE_SERVER_NAME = "netmaker"
|
||||
const NODE_DELETE = "delete"
|
||||
const NODE_IS_PENDING = "pending"
|
||||
const NODE_NOOP = "noop"
|
||||
const (
|
||||
// NODE_SERVER_NAME - the default server name
|
||||
NODE_SERVER_NAME = "netmaker"
|
||||
// TEN_YEARS_IN_SECONDS - ten years in seconds
|
||||
TEN_YEARS_IN_SECONDS = 300000000
|
||||
// MAX_NAME_LENGTH - max name length of node
|
||||
MAX_NAME_LENGTH = 62
|
||||
// == ACTIONS == (can only be set by GRPC)
|
||||
// NODE_UPDATE_KEY - action to update key
|
||||
NODE_UPDATE_KEY = "updatekey"
|
||||
// NODE_DELETE - delete node action
|
||||
NODE_DELETE = "delete"
|
||||
// NODE_IS_PENDING - node pending status
|
||||
NODE_IS_PENDING = "pending"
|
||||
// NODE_NOOP - node no op action
|
||||
NODE_NOOP = "noop"
|
||||
)
|
||||
|
||||
var seededRand *rand.Rand = rand.New(
|
||||
rand.NewSource(time.Now().UnixNano()))
|
||||
|
@ -46,7 +54,6 @@ type Node struct {
|
|||
LastPeerUpdate int64 `json:"lastpeerupdate" bson:"lastpeerupdate" yaml:"lastpeerupdate"`
|
||||
LastCheckIn int64 `json:"lastcheckin" bson:"lastcheckin" yaml:"lastcheckin"`
|
||||
MacAddress string `json:"macaddress" bson:"macaddress" yaml:"macaddress" validate:"macaddress_unique"`
|
||||
// checkin interval is depreciated at the network level. Set on server with CHECKIN_INTERVAL
|
||||
Password string `json:"password" bson:"password" yaml:"password" validate:"required,min=6"`
|
||||
Network string `json:"network" bson:"network" yaml:"network" validate:"network_exists"`
|
||||
IsRelayed string `json:"isrelayed" bson:"isrelayed" yaml:"isrelayed"`
|
||||
|
@ -72,6 +79,7 @@ type Node struct {
|
|||
OS string `json:"os" bson:"os" yaml:"os"`
|
||||
MTU int32 `json:"mtu" bson:"mtu" yaml:"mtu"`
|
||||
Version string `json:"version" bson:"version" yaml:"version"`
|
||||
CommID string `json:"commid" bson:"commid" yaml:"comid"`
|
||||
TrafficKeys TrafficKeys `json:"traffickeys" bson:"traffickeys" yaml:"traffickeys"`
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue