@@ -11,9 +11,9 @@ import (
11
11
type ApiNode struct {
12
12
ID string `json:"id,omitempty" validate:"required,min=5,id_unique"`
13
13
HostID string `json:"hostid,omitempty" validate:"required,min=5,id_unique"`
14
- Address string `json:"address" validate:"omitempty,ipv4 "`
15
- Address6 string `json:"address6" validate:"omitempty,ipv6 "`
16
- LocalAddress string `json:"localaddress" validate:"omitempty,ipv4 "`
14
+ Address string `json:"address" validate:"omitempty,cidrv4 "`
15
+ Address6 string `json:"address6" validate:"omitempty,cidrv6 "`
16
+ LocalAddress string `json:"localaddress" validate:"omitempty,cidr "`
17
17
AllowedIPs []string `json:"allowedips"`
18
18
LastModified int64 `json:"lastmodified"`
19
19
ExpirationDateTime int64 `json:"expdatetime"`
@@ -37,6 +37,7 @@ type ApiNode struct {
37
37
InternetGateway string `json:"internetgateway"`
38
38
Connected bool `json:"connected"`
39
39
PendingDelete bool `json:"pendingdelete"`
40
+ Metadata string `json:"metadata" validate:"max=256"`
40
41
// == PRO ==
41
42
DefaultACL string `json:"defaultacl,omitempty" validate:"checkyesornoorunset"`
42
43
IsFailOver bool `json:"is_fail_over"`
@@ -104,6 +105,7 @@ func (a *ApiNode) ConvertToServerNode(currentNode *Node) *Node {
104
105
convertedNode .LastCheckIn = time .Unix (a .LastCheckIn , 0 )
105
106
convertedNode .LastPeerUpdate = time .Unix (a .LastPeerUpdate , 0 )
106
107
convertedNode .ExpirationDateTime = time .Unix (a .ExpirationDateTime , 0 )
108
+ convertedNode .Metadata = a .Metadata
107
109
return & convertedNode
108
110
}
109
111
@@ -158,6 +160,7 @@ func (nm *Node) ConvertToAPINode() *ApiNode {
158
160
apiNode .IsFailOver = nm .IsFailOver
159
161
apiNode .FailOverPeers = nm .FailOverPeers
160
162
apiNode .FailedOverBy = nm .FailedOverBy
163
+ apiNode .Metadata = nm .Metadata
161
164
return & apiNode
162
165
}
163
166
0 commit comments