diff --git a/config/config.go b/config/config.go index 90fcb0949..36ce1cbf1 100644 --- a/config/config.go +++ b/config/config.go @@ -89,7 +89,7 @@ type ServerConfig struct { EgressesLimit int `yaml:"egresses_limit"` DeployedByOperator bool `yaml:"deployed_by_operator"` Environment string `yaml:"environment"` - JwtValidityDuration time.Duration `yaml:"jwt_validity_duration"` + JwtValidityDuration time.Duration `yaml:"jwt_validity_duration" swaggertype:"primitive,integer" format:"int64"` RacAutoDisable bool `yaml:"rac_auto_disable"` CacheEnabled string `yaml:"caching_enabled"` EndpointDetection bool `json:"endpoint_detection"` diff --git a/models/api_node.go b/models/api_node.go index c5ef2f834..69dfedc74 100644 --- a/models/api_node.go +++ b/models/api_node.go @@ -18,7 +18,7 @@ type ApiNode struct { AllowedIPs []string `json:"allowedips"` LastModified int64 `json:"lastmodified"` ExpirationDateTime int64 `json:"expdatetime"` - LastCheckIn int64 `json:"lastcheckin"` + LastCheckIn int64 `json:"lastcheckin" swaggertype:"primitive,integer" format:"int64"` LastPeerUpdate int64 `json:"lastpeerupdate"` Network string `json:"network"` NetworkRange string `json:"networkrange"` diff --git a/models/host.go b/models/host.go index 2781dee0e..c6d5eaa3c 100644 --- a/models/host.go +++ b/models/host.go @@ -71,7 +71,7 @@ type Host struct { IsDefault bool `json:"isdefault" yaml:"isdefault"` NatType string `json:"nat_type,omitempty" yaml:"nat_type,omitempty"` TurnEndpoint *netip.AddrPort `json:"turn_endpoint,omitempty" yaml:"turn_endpoint,omitempty"` - PersistentKeepalive time.Duration `json:"persistentkeepalive" yaml:"persistentkeepalive"` + PersistentKeepalive time.Duration `json:"persistentkeepalive" swaggertype:"primitive,integer" format:"int64" yaml:"persistentkeepalive"` } // FormatBool converts a boolean to a [yes|no] string diff --git a/models/metrics.go b/models/metrics.go index 459c7f17c..62b4bb683 100644 --- a/models/metrics.go +++ b/models/metrics.go @@ -22,7 +22,7 @@ type Metric struct { LastTotalReceived int64 `json:"lasttotalreceived" bson:"lasttotalreceived" yaml:"lasttotalreceived"` TotalSent int64 `json:"totalsent" bson:"totalsent" yaml:"totalsent"` LastTotalSent int64 `json:"lasttotalsent" bson:"lasttotalsent" yaml:"lasttotalsent"` - ActualUptime time.Duration `json:"actualuptime" bson:"actualuptime" yaml:"actualuptime"` + ActualUptime time.Duration `json:"actualuptime" swaggertype:"primitive,integer" format:"int64" bson:"actualuptime" yaml:"actualuptime"` PercentUp float64 `json:"percentup" bson:"percentup" yaml:"percentup"` Connected bool `json:"connected" bson:"connected" yaml:"connected"` } diff --git a/swagger.yaml b/swagger.yaml index 7c61b2f69..566597274 100644 --- a/swagger.yaml +++ b/swagger.yaml @@ -74,7 +74,8 @@ definitions: ingressesLimit: type: integer jwtValidityDuration: - $ref: '#/definitions/time.Duration' + format: int64 + type: integer licenseValue: type: string machinesLimit: @@ -109,6 +110,8 @@ definitions: type: string publicIPService: type: string + publicIp: + type: string racAutoDisable: type: boolean restBackend: @@ -179,6 +182,41 @@ definitions: required: - tags type: object + models.AclRule: + properties: + allowed: + type: boolean + allowed_ports: + items: + type: string + type: array + allowed_protocols: + allOf: + - $ref: '#/definitions/models.Protocol' + description: tcp, udp, etc. + direction: + allOf: + - $ref: '#/definitions/models.AllowedTrafficDirection' + description: single or two-way + id: + type: string + ip_list: + items: + $ref: '#/definitions/net.IPNet' + type: array + ip6_list: + items: + $ref: '#/definitions/net.IPNet' + type: array + type: object + models.AllowedTrafficDirection: + enum: + - 0 + - 1 + type: integer + x-enum-varnames: + - TrafficDirectionUni + - TrafficDirectionBi models.ApiHost: properties: autoupdate: @@ -307,6 +345,7 @@ definitions: isrelayed: type: boolean lastcheckin: + format: int64 type: integer lastmodified: type: integer @@ -334,6 +373,8 @@ definitions: type: string static_node: $ref: '#/definitions/models.ExtClient' + status: + $ref: '#/definitions/models.NodeStatus' tags: additionalProperties: type: object @@ -515,13 +556,27 @@ definitions: properties: allow: type: boolean - dstIP: + allowed_ports: + items: + type: string + type: array + allowed_protocols: + allOf: + - $ref: '#/definitions/models.Protocol' + description: tcp, udp, etc. + dst_ip: $ref: '#/definitions/net.IPNet' - srcIP: + src_ip: $ref: '#/definitions/net.IPNet' type: object models.FwUpdate: properties: + acl_rules: + additionalProperties: + $ref: '#/definitions/models.AclRule' + type: object + allow_all: + type: boolean egress_info: additionalProperties: $ref: '#/definitions/models.EgressInfo' @@ -534,6 +589,10 @@ definitions: type: boolean is_ingress_gw: type: boolean + networks: + items: + $ref: '#/definitions/net.IPNet' + type: array type: object models.Host: properties: @@ -596,7 +655,8 @@ definitions: os: type: string persistentkeepalive: - $ref: '#/definitions/time.Duration' + format: int64 + type: integer publickey: items: type: integer @@ -797,7 +857,8 @@ definitions: models.Metric: properties: actualuptime: - $ref: '#/definitions/time.Duration' + format: int64 + type: integer connected: type: boolean lasttotalreceived: @@ -967,6 +1028,8 @@ definitions: type: integer networkrange6: type: number + node_status: + $ref: '#/definitions/models.NodeStatus' ownerid: type: string pendingdelete: @@ -1005,10 +1068,36 @@ definitions: serverconfig: $ref: '#/definitions/models.ServerConfig' type: object + models.NodeStatus: + enum: + - online + - offline + - warning + - error + - unknown + type: string + x-enum-varnames: + - OnlineSt + - OfflineSt + - WarningSt + - ErrorSt + - UnKnown models.PeerMap: additionalProperties: $ref: '#/definitions/models.IDandAddr' type: object + models.Protocol: + enum: + - all + - udp + - tcp + - icmp + type: string + x-enum-varnames: + - ALL + - UDP + - TCP + - ICMP models.RegisterResponse: properties: requested_host: @@ -1313,8 +1402,6 @@ definitions: - 1000000000 - 60000000000 - 3600000000000 - - -9223372036854775808 - - 9223372036854775807 - 1 - 1000 - 1000000 @@ -1331,8 +1418,6 @@ definitions: - Second - Minute - Hour - - minDuration - - maxDuration - Nanosecond - Microsecond - Millisecond