Skip to content

Commit f8d63c9

Browse files
committed
resolve merge conflicts
2 parents 411d5a5 + 116e2ef commit f8d63c9

File tree

15 files changed

+154
-68
lines changed

15 files changed

+154
-68
lines changed

.swaggo

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Replace all time.Duration with int64
2+
replace time.Duration int64

config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ type ServerConfig struct {
8989
EgressesLimit int `yaml:"egresses_limit"`
9090
DeployedByOperator bool `yaml:"deployed_by_operator"`
9191
Environment string `yaml:"environment"`
92-
JwtValidityDuration time.Duration `yaml:"jwt_validity_duration"`
92+
JwtValidityDuration time.Duration `yaml:"jwt_validity_duration" swaggertype:"primitive,integer" format:"int64"`
9393
RacAutoDisable bool `yaml:"rac_auto_disable"`
9494
CacheEnabled string `yaml:"caching_enabled"`
9595
EndpointDetection bool `json:"endpoint_detection"`

controllers/acls.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ func createAcl(w http.ResponseWriter, r *http.Request) {
207207
acl.CreatedBy = user.UserName
208208
acl.CreatedAt = time.Now().UTC()
209209
acl.Default = false
210+
if acl.ServiceType == models.Any {
211+
acl.Port = []string{}
212+
acl.Proto = models.ALL
213+
}
210214
// validate create acl policy
211215
if !logic.IsAclPolicyValid(acl) {
212216
logic.ReturnErrorResponse(w, r, logic.FormatError(errors.New("invalid policy"), "badrequest"))

logic/acls.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,10 @@ func UpdateAcl(newAcl, acl models.Acl) error {
325325
acl.Proto = newAcl.Proto
326326
acl.ServiceType = newAcl.ServiceType
327327
}
328+
if newAcl.ServiceType == models.Any {
329+
acl.Port = []string{}
330+
acl.Proto = models.ALL
331+
}
328332
acl.Enabled = newAcl.Enabled
329333
d, err := json.Marshal(acl)
330334
if err != nil {
@@ -844,6 +848,7 @@ func GetAclRulesForNode(targetnode *models.Node) (rules map[string]models.AclRul
844848
}
845849

846850
acls := listDevicePolicies(models.NetworkID(targetnode.Network))
851+
targetnode.Tags["*"] = struct{}{}
847852
for nodeTag := range targetnode.Tags {
848853
for _, acl := range acls {
849854
if !acl.Enabled {
@@ -944,7 +949,8 @@ func GetAclRulesForNode(targetnode *models.Node) (rules map[string]models.AclRul
944949
}
945950
}
946951
} else {
947-
if _, ok := dstTags[nodeTag.String()]; ok {
952+
_, all := dstTags["*"]
953+
if _, ok := dstTags[nodeTag.String()]; ok || all {
948954
// get all src tags
949955
for src := range srcTags {
950956
if src == nodeTag.String() {

logic/nodes.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,7 @@ func GetTagMapWithNodesByNetwork(netID models.NetworkID, withStaticNodes bool) (
829829
tagNodesMap[nodeTagID] = append(tagNodesMap[nodeTagID], nodeI)
830830
}
831831
}
832+
tagNodesMap["*"] = nodes
832833
if !withStaticNodes {
833834
return
834835
}
@@ -850,6 +851,10 @@ func AddTagMapWithStaticNodes(netID models.NetworkID,
850851
IsStatic: true,
851852
StaticNode: extclient,
852853
})
854+
tagNodesMap["*"] = append(tagNodesMap["*"], models.Node{
855+
IsStatic: true,
856+
StaticNode: extclient,
857+
})
853858
}
854859

855860
}

models/api_node.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ type ApiNode struct {
1616
Address6 string `json:"address6" validate:"omitempty,cidrv6"`
1717
LocalAddress string `json:"localaddress" validate:"omitempty,cidr"`
1818
AllowedIPs []string `json:"allowedips"`
19-
LastModified int64 `json:"lastmodified"`
20-
ExpirationDateTime int64 `json:"expdatetime"`
21-
LastCheckIn int64 `json:"lastcheckin"`
22-
LastPeerUpdate int64 `json:"lastpeerupdate"`
19+
LastModified int64 `json:"lastmodified" swaggertype:"primitive,integer" format:"int64"`
20+
ExpirationDateTime int64 `json:"expdatetime" swaggertype:"primitive,integer" format:"int64"`
21+
LastCheckIn int64 `json:"lastcheckin" swaggertype:"primitive,integer" format:"int64"`
22+
LastPeerUpdate int64 `json:"lastpeerupdate" swaggertype:"primitive,integer" format:"int64"`
2323
Network string `json:"network"`
2424
NetworkRange string `json:"networkrange"`
2525
NetworkRange6 string `json:"networkrange6"`

models/enrollment_key.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ type EnrollmentKey struct {
5858

5959
// APIEnrollmentKey - used to create enrollment keys via API
6060
type APIEnrollmentKey struct {
61-
Expiration int64 `json:"expiration"`
61+
Expiration int64 `json:"expiration" swaggertype:"primitive,integer" format:"int64"`
6262
UsesRemaining int `json:"uses_remaining"`
6363
Networks []string `json:"networks"`
6464
Unlimited bool `json:"unlimited"`

models/extclient.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type ExtClient struct {
1313
AllowedIPs []string `json:"allowed_ips"`
1414
IngressGatewayID string `json:"ingressgatewayid" bson:"ingressgatewayid"`
1515
IngressGatewayEndpoint string `json:"ingressgatewayendpoint" bson:"ingressgatewayendpoint"`
16-
LastModified int64 `json:"lastmodified" bson:"lastmodified"`
16+
LastModified int64 `json:"lastmodified" bson:"lastmodified" swaggertype:"primitive,integer" format:"int64"`
1717
Enabled bool `json:"enabled" bson:"enabled"`
1818
OwnerID string `json:"ownerid" bson:"ownerid"`
1919
DeniedACLs map[string]struct{} `json:"deniednodeacls" bson:"acls,omitempty"`

models/host.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ type Host struct {
7171
IsDefault bool `json:"isdefault" yaml:"isdefault"`
7272
NatType string `json:"nat_type,omitempty" yaml:"nat_type,omitempty"`
7373
TurnEndpoint *netip.AddrPort `json:"turn_endpoint,omitempty" yaml:"turn_endpoint,omitempty"`
74-
PersistentKeepalive time.Duration `json:"persistentkeepalive" yaml:"persistentkeepalive"`
74+
PersistentKeepalive time.Duration `json:"persistentkeepalive" swaggertype:"primitive,integer" format:"int64" yaml:"persistentkeepalive"`
7575
}
7676

7777
// FormatBool converts a boolean to a [yes|no] string

models/metrics.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ type Metrics struct {
1515
// Metric - holds a metric for data between nodes
1616
type Metric struct {
1717
NodeName string `json:"node_name" bson:"node_name" yaml:"node_name"`
18-
Uptime int64 `json:"uptime" bson:"uptime" yaml:"uptime"`
19-
TotalTime int64 `json:"totaltime" bson:"totaltime" yaml:"totaltime"`
20-
Latency int64 `json:"latency" bson:"latency" yaml:"latency"`
21-
TotalReceived int64 `json:"totalreceived" bson:"totalreceived" yaml:"totalreceived"`
22-
LastTotalReceived int64 `json:"lasttotalreceived" bson:"lasttotalreceived" yaml:"lasttotalreceived"`
23-
TotalSent int64 `json:"totalsent" bson:"totalsent" yaml:"totalsent"`
24-
LastTotalSent int64 `json:"lasttotalsent" bson:"lasttotalsent" yaml:"lasttotalsent"`
25-
ActualUptime time.Duration `json:"actualuptime" bson:"actualuptime" yaml:"actualuptime"`
18+
Uptime int64 `json:"uptime" bson:"uptime" yaml:"uptime" swaggertype:"primitive,integer" format:"int64"`
19+
TotalTime int64 `json:"totaltime" bson:"totaltime" yaml:"totaltime" swaggertype:"primitive,integer" format:"int64"`
20+
Latency int64 `json:"latency" bson:"latency" yaml:"latency" swaggertype:"primitive,integer" format:"int64"`
21+
TotalReceived int64 `json:"totalreceived" bson:"totalreceived" yaml:"totalreceived" swaggertype:"primitive,integer" format:"int64"`
22+
LastTotalReceived int64 `json:"lasttotalreceived" bson:"lasttotalreceived" yaml:"lasttotalreceived" swaggertype:"primitive,integer" format:"int64"`
23+
TotalSent int64 `json:"totalsent" bson:"totalsent" yaml:"totalsent" swaggertype:"primitive,integer" format:"int64"`
24+
LastTotalSent int64 `json:"lasttotalsent" bson:"lasttotalsent" yaml:"lasttotalsent" swaggertype:"primitive,integer" format:"int64"`
25+
ActualUptime time.Duration `json:"actualuptime" swaggertype:"primitive,integer" format:"int64" bson:"actualuptime" yaml:"actualuptime"`
2626
PercentUp float64 `json:"percentup" bson:"percentup" yaml:"percentup"`
2727
Connected bool `json:"connected" bson:"connected" yaml:"connected"`
2828
}

0 commit comments

Comments
 (0)