|
@@ -20,6 +20,7 @@ const TEN_YEARS_IN_SECONDS = 300000000
|
|
const NODE_UPDATE_KEY = "updatekey"
|
|
const NODE_UPDATE_KEY = "updatekey"
|
|
const NODE_DELETE = "delete"
|
|
const NODE_DELETE = "delete"
|
|
const NODE_IS_PENDING = "pending"
|
|
const NODE_IS_PENDING = "pending"
|
|
|
|
+const NODE_NOOP = "noop"
|
|
|
|
|
|
var seededRand *rand.Rand = rand.New(
|
|
var seededRand *rand.Rand = rand.New(
|
|
rand.NewSource(time.Now().UnixNano()))
|
|
rand.NewSource(time.Now().UnixNano()))
|
|
@@ -68,6 +69,12 @@ type Node struct {
|
|
IPForwarding string `json:"ipforwarding" bson:"ipforwarding" yaml:"ipforwarding" validate:"checkyesorno"`
|
|
IPForwarding string `json:"ipforwarding" bson:"ipforwarding" yaml:"ipforwarding" validate:"checkyesorno"`
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func (node *Node) SetDefaultAction() {
|
|
|
|
+ if node.Action == "" {
|
|
|
|
+ node.Action = NODE_NOOP
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
func (node *Node) SetRoamingDefault() {
|
|
func (node *Node) SetRoamingDefault() {
|
|
if node.Roaming == "" {
|
|
if node.Roaming == "" {
|
|
node.Roaming = "no"
|
|
node.Roaming = "no"
|
|
@@ -197,6 +204,7 @@ func (node *Node) SetDefaults() {
|
|
node.SetLastPeerUpdate()
|
|
node.SetLastPeerUpdate()
|
|
node.SetRoamingDefault()
|
|
node.SetRoamingDefault()
|
|
node.SetPullChangesDefault()
|
|
node.SetPullChangesDefault()
|
|
|
|
+ node.SetDefaultAction()
|
|
node.SetID()
|
|
node.SetID()
|
|
node.KeyUpdateTimeStamp = time.Now().Unix()
|
|
node.KeyUpdateTimeStamp = time.Now().Unix()
|
|
}
|
|
}
|