@opensoha/contracts 0.1.25 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPATIBILITY.md +34 -0
- package/README.md +1 -1
- package/agent/environment/export.go +1 -0
- package/agent/environment/protocol_test.go +1 -1
- package/agent/guest/protocol_test.go +2 -2
- package/auth/catalog_generated.go +2 -2
- package/auth/permission-catalog.json +481 -1
- package/compat/json-schema-ecosystem-0.1.0.json +1 -1
- package/compat/openapi-loose-boundaries-0.1.0.json +1 -1
- package/delivery/document.schema.json +127 -9
- package/endpointcontrol/decode.go +64 -0
- package/endpointcontrol/models.go +138 -0
- package/endpointcontrol/models_test.go +51 -0
- package/endpointcontrol/protocol.schema.json +397 -0
- package/examples/relations_compat_test.go +18 -0
- package/fixtures/json-schema/endpoint-controls/invalid/controls.json +16 -0
- package/fixtures/json-schema/endpoint-controls/invalid/missing-channel-decision.json +15 -0
- package/fixtures/json-schema/endpoint-controls/invalid/receipt-content.json +36 -0
- package/fixtures/json-schema/endpoint-controls/valid/controls.json +16 -0
- package/fixtures/json-schema/endpoint-controls/valid/receipt.json +35 -0
- package/fixtures/json-schema/network-runtime-protocol/invalid/eap-activate-bad-fingerprint.json +14 -0
- package/fixtures/json-schema/network-runtime-protocol/invalid/eap-gateway-request.json +14 -0
- package/fixtures/json-schema/network-runtime-protocol/invalid/eap-private-key-request.json +15 -0
- package/fixtures/json-schema/network-runtime-protocol/invalid/eap-profile-without-eap-credential.json +22 -0
- package/fixtures/json-schema/network-runtime-protocol/invalid/endpoint-dns-observation.json +25 -0
- package/fixtures/json-schema/network-runtime-protocol/invalid/gateway-presence.json +22 -0
- package/fixtures/json-schema/network-runtime-protocol/invalid/mihomo-protection-zero-version.json +45 -0
- package/fixtures/json-schema/network-runtime-protocol/invalid/presence-raw-key.json +23 -0
- package/fixtures/json-schema/network-runtime-protocol/invalid/presence-zero-sequence.json +22 -0
- package/fixtures/json-schema/network-runtime-protocol/invalid/workload-wide-vpn.json +17 -0
- package/fixtures/json-schema/network-runtime-protocol/valid/eap-certificate-activate.json +14 -0
- package/fixtures/json-schema/network-runtime-protocol/valid/eap-certificate-request.json +14 -0
- package/fixtures/json-schema/network-runtime-protocol/valid/eap-profile-enrollment.json +24 -0
- package/fixtures/json-schema/network-runtime-protocol/valid/endpoint-presence.json +22 -0
- package/fixtures/json-schema/network-runtime-protocol/valid/ipv6-configuration.json +102 -0
- package/fixtures/json-schema/network-runtime-protocol/valid/mihomo-protected-policy.json +45 -0
- package/fixtures/json-schema/network-runtime-protocol/valid/site-dns-ipv6.json +25 -0
- package/fixtures/json-schema/network-runtime-protocol/valid/workload-direct-ztna.json +20 -0
- package/fixtures/openapi/DLPShadowDecision/invalid/step-up-type.json +14 -0
- package/fixtures/openapi/DLPShadowDecision/valid/archive-v2.json +14 -0
- package/fixtures/openapi/DLPShadowDecision/valid/step-up.json +14 -0
- package/fixtures/openapi/DLPShadowInput/invalid/self-reported-result.json +7 -0
- package/fixtures/openapi/DLPShadowInput/invalid/too-many-samples.json +14 -0
- package/fixtures/openapi/DLPShadowInput/valid/bounded.json +7 -0
- package/fixtures/openapi/DeliveryDocument/invalid/migration-missing-guide-build-template.json +30 -0
- package/fixtures/openapi/DeliveryDocument/invalid/migration-missing-guide-deployment-template.json +30 -0
- package/fixtures/openapi/DeliveryDocument/invalid/migration-missing-guide-workflow-template.json +27 -0
- package/fixtures/openapi/DeliveryDocument/valid/migration-build-template.json +31 -0
- package/fixtures/openapi/DeliveryDocument/valid/migration-deployment-template.json +31 -0
- package/fixtures/openapi/DeliveryDocument/valid/migration-workflow-template.json +28 -0
- package/fixtures/openapi/DeliveryPlanInput/invalid/manual-plan.json +7 -0
- package/fixtures/openapi/DeliveryPlanInput/valid/manual-plan.json +6 -0
- package/fixtures/openapi/DeliveryTargetInput/invalid/candidate-on-runtime-deploy.json +9 -0
- package/fixtures/openapi/DeliveryTargetInput/invalid/config-update-missing-service.json +7 -0
- package/fixtures/openapi/DeliveryTargetInput/valid/template-configuration-only.json +8 -0
- package/fixtures/openapi/DeliveryTargetInput/valid/template-configuration-without-runtime-environment.json +1 -0
- package/fixtures/openapi/DockerVolumeDLPAppealInput/invalid/p4-response.json +3 -0
- package/fixtures/openapi/DockerVolumeDLPAppealInput/valid/p4-response.json +3 -0
- package/fixtures/openapi/DockerVolumeDLPAppealReviewInput/invalid/p4-response.json +5 -0
- package/fixtures/openapi/DockerVolumeDLPAppealReviewInput/valid/p4-response.json +5 -0
- package/fixtures/openapi/DockerVolumeDLPAuthorizationInput/invalid/p4-response.json +3 -0
- package/fixtures/openapi/DockerVolumeDLPAuthorizationInput/valid/p4-response.json +3 -0
- package/fixtures/openapi/DockerVolumeDLPContent/invalid/archive-unsupported-channel.json +9 -0
- package/fixtures/openapi/DockerVolumeDLPContent/invalid/p4.json +6 -0
- package/fixtures/openapi/DockerVolumeDLPContent/invalid/step-up-audit.json +9 -0
- package/fixtures/openapi/DockerVolumeDLPContent/invalid/unavailable-engine.json +9 -0
- package/fixtures/openapi/DockerVolumeDLPContent/invalid/unknown-data-level.json +12 -0
- package/fixtures/openapi/DockerVolumeDLPContent/valid/classified-rule.json +16 -0
- package/fixtures/openapi/DockerVolumeDLPContent/valid/p4.json +8 -0
- package/fixtures/openapi/DockerVolumeDLPContent/valid/step-up.json +9 -0
- package/fixtures/openapi/DockerVolumeDLPDecision/invalid/p4.json +9 -0
- package/fixtures/openapi/DockerVolumeDLPDecision/invalid/step-up-type.json +12 -0
- package/fixtures/openapi/DockerVolumeDLPDecision/valid/archive-v2.json +12 -0
- package/fixtures/openapi/DockerVolumeDLPDecision/valid/p4.json +11 -0
- package/fixtures/openapi/DockerVolumeDLPDecision/valid/step-up.json +12 -0
- package/fixtures/openapi/DockerVolumeDLPSaveInput/invalid/p4.json +11 -0
- package/fixtures/openapi/DockerVolumeDLPSaveInput/valid/p4.json +11 -0
- package/fixtures/openapi/DockerVolumeFileReadInput/invalid/p4-response.json +5 -0
- package/fixtures/openapi/DockerVolumeFileReadInput/valid/p4-response.json +4 -0
- package/fixtures/openapi/EndpointDeviceInput/invalid/reported-management.json +5 -0
- package/fixtures/openapi/EndpointDeviceInput/valid/management-state.json +5 -0
- package/fixtures/openapi/EndpointDeviceRegistrationInput/invalid/self-promote-management.json +5 -0
- package/fixtures/openapi/KubernetesImportCandidateListEnvelope/invalid/source-with-spec.json +33 -0
- package/fixtures/openapi/KubernetesImportCandidateListEnvelope/invalid/source-without-uid.json +29 -0
- package/fixtures/openapi/KubernetesImportCandidateListEnvelope/valid/stable-source.json +30 -0
- package/fixtures/openapi/KubernetesPod/invalid/pod-uid.json +9 -0
- package/fixtures/openapi/KubernetesPod/valid/pod-uid.json +9 -0
- package/fixtures/openapi/KubernetesPodDetail/invalid/pod-uid.json +6 -0
- package/fixtures/openapi/KubernetesPodDetail/valid/pod-uid.json +6 -0
- package/fixtures/openapi/KubernetesServiceImportRequest/invalid/empty-source-uid.json +48 -0
- package/fixtures/openapi/KubernetesServiceImportRequest/valid/pinned-workloads-and-cr.json +48 -0
- package/fixtures/openapi/ManagedContentPasteInput/invalid/boundary.json +5 -0
- package/fixtures/openapi/ManagedContentPasteInput/valid/boundary.json +6 -0
- package/fixtures/openapi/ManagedContentPolicy/invalid/self-reported-allow.json +8 -0
- package/fixtures/openapi/ManagedContentPolicy/invalid/step-up-audit.json +8 -0
- package/fixtures/openapi/ManagedContentPolicy/invalid/unknown-extractor.json +8 -0
- package/fixtures/openapi/ManagedContentPolicy/valid/archive-v2.json +8 -0
- package/fixtures/openapi/ManagedContentPolicy/valid/network-and-level.json +10 -0
- package/fixtures/openapi/ManagedContentPolicy/valid/step-up.json +8 -0
- package/fixtures/openapi/ManagedContentReviewInput/invalid/boundary.json +5 -0
- package/fixtures/openapi/ManagedContentReviewInput/valid/boundary.json +5 -0
- package/fixtures/openapi/ManagedContentSaveInput/invalid/boundary.json +14 -0
- package/fixtures/openapi/ManagedContentSaveInput/valid/boundary.json +16 -0
- package/fixtures/openapi/ManagedContentUploadInput/invalid/boundary.json +7 -0
- package/fixtures/openapi/ManagedContentUploadInput/valid/boundary.json +6 -0
- package/fixtures/openapi/ManifestExecutionTaskPayload/invalid/initialization.json +7 -0
- package/fixtures/openapi/ManifestExecutionTaskPayload/valid/initialization.json +7 -0
- package/fixtures/openapi/ManifestRootResource/invalid/root.json +1 -0
- package/fixtures/openapi/ManifestRootResource/valid/root.json +1 -0
- package/fixtures/openapi/NetworkAccessPolicyInput/invalid/unknown-management-state.json +35 -0
- package/fixtures/openapi/NetworkAccessPolicyInput/valid/managed-device.json +35 -0
- package/fixtures/openapi/NetworkAdmissionPreviewRequest/invalid/deviceId-characters.json +4 -0
- package/fixtures/openapi/NetworkAdmissionPreviewRequest/invalid/nasBindingId-characters.json +4 -0
- package/fixtures/openapi/NetworkAdmissionPreviewRequest/invalid/subject-override.json +1 -0
- package/fixtures/openapi/NetworkAdmissionPreviewRequest/valid/device-nas.json +1 -0
- package/fixtures/openapi/NetworkAdmissionPreviewResult/invalid/missing-attributeVersion.json +13 -0
- package/fixtures/openapi/NetworkAdmissionPreviewResult/invalid/missing-evaluatedAt.json +13 -0
- package/fixtures/openapi/NetworkAdmissionPreviewResult/valid/versioned.json +14 -0
- package/fixtures/openapi/NetworkConflictAnalysisRequest/invalid/missing-runtime-ranges.json +1 -0
- package/fixtures/openapi/NetworkConflictAnalysisRequest/invalid/unknown-source-type.json +9 -0
- package/fixtures/openapi/NetworkConflictAnalysisRequest/valid/empty-runtime-ranges.json +3 -0
- package/fixtures/openapi/NetworkConflictAnalysisRequest/{invalid → valid}/ipv6-range.json +1 -1
- package/fixtures/openapi/NetworkEAPServerTrust/invalid/no-server-validation.json +5 -0
- package/fixtures/openapi/NetworkEAPServerTrust/valid/named-server.json +9 -0
- package/fixtures/openapi/NetworkEndpointResponsePolicyInput/invalid/all-sites-implicit.json +45 -0
- package/fixtures/openapi/NetworkEndpointResponsePolicyInput/invalid/unbounded-stages.json +54 -0
- package/fixtures/openapi/NetworkEndpointResponsePolicyInput/invalid/zero-heartbeat.json +47 -0
- package/fixtures/openapi/NetworkEndpointResponsePolicyInput/valid/staged-protection.json +47 -0
- package/fixtures/openapi/NetworkEndpointResponseRestoreInput/invalid/missing-reason.json +3 -0
- package/fixtures/openapi/NetworkEndpointResponseRestoreInput/valid/expected-current.json +4 -0
- package/fixtures/openapi/NetworkPolicyPreviewResult/invalid/attribute-version.json +1 -0
- package/fixtures/openapi/NetworkPolicyPreviewResult/valid/admission-version.json +1 -0
- package/fixtures/openapi/NetworkPolicySubjects/invalid/duplicate-role.json +1 -0
- package/fixtures/openapi/NetworkPolicySubjects/invalid/role-characters.json +5 -0
- package/fixtures/openapi/NetworkPolicySubjects/valid/role-bound.json +1 -0
- package/fixtures/openapi/NetworkProxyConfigurationInput/invalid/missing-content.json +1 -0
- package/fixtures/openapi/NetworkProxyConfigurationPatchInput/invalid/bad-binding-id.json +9 -0
- package/fixtures/openapi/NetworkProxyConfigurationPatchInput/invalid/empty-content.json +1 -0
- package/fixtures/openapi/NetworkProxyConfigurationPatchInput/valid/binding-only.json +11 -0
- package/fixtures/openapi/NetworkProxyConfigurationPatchInput/valid/clear-binding-disabled.json +5 -0
- package/fixtures/openapi/NetworkProxyConfigurationPatchInput/valid/enabled.json +1 -0
- package/fixtures/openapi/NetworkSiteInput/invalid/unknown-governance.json +6 -0
- package/fixtures/openapi/NetworkSiteInput/valid/restricted-unmanaged.json +6 -0
- package/fixtures/openapi/ResourceRelationConfig/invalid/executable-rule.json +17 -0
- package/fixtures/openapi/ResourceRelationConfig/valid/unknown-kind.json +13 -0
- package/fixtures/openapi/ServiceDeploymentTemplateInput/invalid/migration-missing-guide-valid-yaml.json +38 -0
- package/fixtures/openapi/ServiceDeploymentTemplateInput/valid/migration-valid-yaml.json +39 -0
- package/fixtures/openapi/TemplateMigrationAssessment/invalid/initialization.json +9 -0
- package/fixtures/openapi/TemplateMigrationAssessment/valid/initialization.json +9 -0
- package/fixtures/openapi/TemplateMigrationPolicy/invalid/blank-guide.json +5 -0
- package/fixtures/openapi/TemplateMigrationPolicy/invalid/missing-guide.json +4 -0
- package/fixtures/openapi/TemplateMigrationPolicy/invalid/unknown-escape-hatch.json +6 -0
- package/fixtures/openapi/TemplateMigrationPolicy/valid/legacy-safe.json +4 -0
- package/fixtures/openapi/TemplateMigrationPolicy/valid/ordered-data-change.json +5 -0
- package/fixtures/openapi/TemplateUpdateBatchInput/invalid/duplicate-candidates.json +11 -0
- package/fixtures/openapi/TemplateUpdateBatchInput/invalid/empty-identities.json +10 -0
- package/fixtures/openapi/TemplateUpdateBatchInput/valid/staged-adoption.json +10 -0
- package/fixtures/openapi/TemplateUpdatePolicyInput/invalid/unknown-mode.json +8 -0
- package/fixtures/openapi/TemplateUpdatePolicyInput/valid/explicit-automatic.json +8 -0
- package/fixtures/openapi/TemplateUpdatePreviewInput/invalid/empty-identities.json +10 -0
- package/fixtures/openapi/TemplateUpdatePreviewInput/invalid/empty-targets.json +6 -0
- package/fixtures/openapi/TemplateUpdatePreviewInput/valid/cross-version-manual.json +14 -0
- package/gen/go/sohaapi/client.go +1 -1
- package/gen/go/sohaapi/client_test.go +2 -2
- package/gen/go/sohaapi/import_source_compat_test.go +12 -0
- package/gen/go/sohaapi/proxy_configuration_test.go +38 -0
- package/gen/go/sohaapi/types.go +3760 -345
- package/gen/ts/sohaapi/index.ts +5573 -181
- package/go.mod +2 -2
- package/helmrelease/delivery.go +4 -1
- package/helmrelease/initialization.go +10 -0
- package/helmrelease/runtime/delivery.go +40 -10
- package/helmrelease/runtime/delivery_test.go +4 -0
- package/helmrelease/runtime/initialization.go +186 -0
- package/helmrelease/runtime/initialization_test.go +203 -0
- package/network/README.md +34 -0
- package/network/network-radius-accounting.schema.json +4 -1
- package/network/network-runtime-protocol.schema.json +2166 -317
- package/network/proxy-runtime.schema.json +482 -67
- package/openapi/network_control_test.go +64 -0
- package/openapi/soha-api.json +53524 -43459
- package/openapi/soha-api.yaml +26431 -20491
- package/openapi/spec_generated.go +3 -3
- package/openapi/spec_test.go +42 -0
- package/package.json +6 -3
- package/proxytransport/handler.go +271 -0
- package/proxytransport/probe.go +30 -0
- package/proxytransport/scope.go +89 -0
- package/proxytransport/transport_test.go +60 -0
- package/resource/models.go +2 -0
- package/resource/relations.go +225 -0
- package/resource/relations_test.go +47 -0
- package/resource/root_cr.go +38 -0
- package/resource/runtime/argocd_integration_test.go +1 -1
- package/resource/runtime/initialization.go +66 -0
- package/resource/runtime/initialization_test.go +80 -0
- package/resource/runtime/relations.go +161 -0
- package/resource/runtime/relations_test.go +100 -0
- package/resource/runtime/root_cr.go +79 -0
- package/resource/runtime/root_cr_test.go +118 -0
|
@@ -5,109 +5,524 @@
|
|
|
5
5
|
"description": "Messages on the authenticated proxy runtime channel. Configuration content is delivered only to the enrolled runtime and is never returned by management reads.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"additionalProperties": false,
|
|
8
|
-
"required": [
|
|
8
|
+
"required": [
|
|
9
|
+
"schemaVersion",
|
|
10
|
+
"runtimeId",
|
|
11
|
+
"messageType",
|
|
12
|
+
"occurredAt",
|
|
13
|
+
"payload"
|
|
14
|
+
],
|
|
9
15
|
"properties": {
|
|
10
|
-
"schemaVersion": {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
16
|
+
"schemaVersion": {
|
|
17
|
+
"const": "proxy-runtime/v1alpha1"
|
|
18
|
+
},
|
|
19
|
+
"runtimeId": {
|
|
20
|
+
"$ref": "#/$defs/Identifier"
|
|
21
|
+
},
|
|
22
|
+
"messageType": {
|
|
23
|
+
"enum": [
|
|
24
|
+
"configuration.desired",
|
|
25
|
+
"configuration.applied",
|
|
26
|
+
"observation",
|
|
27
|
+
"connections.snapshot",
|
|
28
|
+
"connection.close.request",
|
|
29
|
+
"connection.close.result"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"occurredAt": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"format": "date-time"
|
|
35
|
+
},
|
|
14
36
|
"payload": {
|
|
15
37
|
"oneOf": [
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
{
|
|
20
|
-
|
|
21
|
-
|
|
38
|
+
{
|
|
39
|
+
"$ref": "#/$defs/ConfigurationDesired"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"$ref": "#/$defs/ConfigurationApplied"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"$ref": "#/$defs/Observation"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"$ref": "#/$defs/ConnectionsSnapshot"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"$ref": "#/$defs/ConnectionCloseRequest"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"$ref": "#/$defs/ConnectionCloseResult"
|
|
55
|
+
}
|
|
22
56
|
]
|
|
23
57
|
}
|
|
24
58
|
},
|
|
25
59
|
"allOf": [
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
60
|
+
{
|
|
61
|
+
"if": {
|
|
62
|
+
"properties": {
|
|
63
|
+
"messageType": {
|
|
64
|
+
"const": "configuration.desired"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"required": [
|
|
68
|
+
"messageType"
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
"then": {
|
|
72
|
+
"properties": {
|
|
73
|
+
"payload": {
|
|
74
|
+
"$ref": "#/$defs/ConfigurationDesired"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"if": {
|
|
81
|
+
"properties": {
|
|
82
|
+
"messageType": {
|
|
83
|
+
"const": "configuration.applied"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"required": [
|
|
87
|
+
"messageType"
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
"then": {
|
|
91
|
+
"properties": {
|
|
92
|
+
"payload": {
|
|
93
|
+
"$ref": "#/$defs/ConfigurationApplied"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"if": {
|
|
100
|
+
"properties": {
|
|
101
|
+
"messageType": {
|
|
102
|
+
"const": "observation"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"required": [
|
|
106
|
+
"messageType"
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"then": {
|
|
110
|
+
"properties": {
|
|
111
|
+
"payload": {
|
|
112
|
+
"$ref": "#/$defs/Observation"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"if": {
|
|
119
|
+
"properties": {
|
|
120
|
+
"messageType": {
|
|
121
|
+
"const": "connections.snapshot"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"required": [
|
|
125
|
+
"messageType"
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
"then": {
|
|
129
|
+
"properties": {
|
|
130
|
+
"payload": {
|
|
131
|
+
"$ref": "#/$defs/ConnectionsSnapshot"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"if": {
|
|
138
|
+
"properties": {
|
|
139
|
+
"messageType": {
|
|
140
|
+
"const": "connection.close.request"
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"required": [
|
|
144
|
+
"messageType"
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
"then": {
|
|
148
|
+
"properties": {
|
|
149
|
+
"payload": {
|
|
150
|
+
"$ref": "#/$defs/ConnectionCloseRequest"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"if": {
|
|
157
|
+
"properties": {
|
|
158
|
+
"messageType": {
|
|
159
|
+
"const": "connection.close.result"
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
"required": [
|
|
163
|
+
"messageType"
|
|
164
|
+
]
|
|
165
|
+
},
|
|
166
|
+
"then": {
|
|
167
|
+
"properties": {
|
|
168
|
+
"payload": {
|
|
169
|
+
"$ref": "#/$defs/ConnectionCloseResult"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
32
174
|
],
|
|
33
175
|
"$defs": {
|
|
34
|
-
"Identifier": {
|
|
35
|
-
|
|
36
|
-
|
|
176
|
+
"Identifier": {
|
|
177
|
+
"type": "string",
|
|
178
|
+
"minLength": 1,
|
|
179
|
+
"maxLength": 128,
|
|
180
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]*$"
|
|
181
|
+
},
|
|
182
|
+
"Engine": {
|
|
183
|
+
"enum": [
|
|
184
|
+
"mihomo",
|
|
185
|
+
"sing-box",
|
|
186
|
+
"v2ray"
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
"Hash": {
|
|
190
|
+
"type": "string",
|
|
191
|
+
"pattern": "^sha256:[a-f0-9]{64}$"
|
|
192
|
+
},
|
|
37
193
|
"ConfigurationDesired": {
|
|
38
|
-
"type": "object",
|
|
39
|
-
"
|
|
194
|
+
"type": "object",
|
|
195
|
+
"additionalProperties": false,
|
|
196
|
+
"required": [
|
|
197
|
+
"revision",
|
|
198
|
+
"engine",
|
|
199
|
+
"enabled",
|
|
200
|
+
"contentHash",
|
|
201
|
+
"content",
|
|
202
|
+
"validUntil"
|
|
203
|
+
],
|
|
40
204
|
"properties": {
|
|
41
|
-
"revision": {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
205
|
+
"revision": {
|
|
206
|
+
"type": "integer",
|
|
207
|
+
"minimum": 1
|
|
208
|
+
},
|
|
209
|
+
"engine": {
|
|
210
|
+
"$ref": "#/$defs/Engine"
|
|
211
|
+
},
|
|
212
|
+
"enabled": {
|
|
213
|
+
"type": "boolean"
|
|
214
|
+
},
|
|
215
|
+
"contentHash": {
|
|
216
|
+
"$ref": "#/$defs/Hash"
|
|
217
|
+
},
|
|
218
|
+
"content": {
|
|
219
|
+
"type": "string",
|
|
220
|
+
"minLength": 1,
|
|
221
|
+
"maxLength": 1048576,
|
|
222
|
+
"writeOnly": true
|
|
223
|
+
},
|
|
224
|
+
"validUntil": {
|
|
225
|
+
"type": "string",
|
|
226
|
+
"format": "date-time"
|
|
227
|
+
},
|
|
228
|
+
"binding": {
|
|
229
|
+
"$ref": "#/$defs/Binding"
|
|
230
|
+
},
|
|
231
|
+
"protection": {
|
|
232
|
+
"$ref": "#/$defs/Protection"
|
|
233
|
+
}
|
|
47
234
|
}
|
|
48
235
|
},
|
|
49
236
|
"ConfigurationApplied": {
|
|
50
|
-
"type": "object",
|
|
51
|
-
"
|
|
237
|
+
"type": "object",
|
|
238
|
+
"additionalProperties": false,
|
|
239
|
+
"required": [
|
|
240
|
+
"revision",
|
|
241
|
+
"status",
|
|
242
|
+
"readbackHash"
|
|
243
|
+
],
|
|
52
244
|
"properties": {
|
|
53
|
-
"revision": {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
245
|
+
"revision": {
|
|
246
|
+
"type": "integer",
|
|
247
|
+
"minimum": 1
|
|
248
|
+
},
|
|
249
|
+
"status": {
|
|
250
|
+
"enum": [
|
|
251
|
+
"applied",
|
|
252
|
+
"rejected",
|
|
253
|
+
"rolled-back"
|
|
254
|
+
]
|
|
255
|
+
},
|
|
256
|
+
"readbackHash": {
|
|
257
|
+
"$ref": "#/$defs/Hash"
|
|
258
|
+
},
|
|
259
|
+
"reasonCode": {
|
|
260
|
+
"type": "string",
|
|
261
|
+
"minLength": 1,
|
|
262
|
+
"maxLength": 128
|
|
263
|
+
}
|
|
57
264
|
}
|
|
58
265
|
},
|
|
59
266
|
"Observation": {
|
|
60
|
-
"type": "object",
|
|
61
|
-
"
|
|
267
|
+
"type": "object",
|
|
268
|
+
"additionalProperties": false,
|
|
269
|
+
"required": [
|
|
270
|
+
"engine",
|
|
271
|
+
"engineVersion",
|
|
272
|
+
"health",
|
|
273
|
+
"capabilities",
|
|
274
|
+
"uptimeSeconds",
|
|
275
|
+
"uploadTotal",
|
|
276
|
+
"downloadTotal"
|
|
277
|
+
],
|
|
62
278
|
"properties": {
|
|
63
|
-
"engine": {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"
|
|
279
|
+
"engine": {
|
|
280
|
+
"$ref": "#/$defs/Engine"
|
|
281
|
+
},
|
|
282
|
+
"engineVersion": {
|
|
283
|
+
"type": "string",
|
|
284
|
+
"minLength": 1,
|
|
285
|
+
"maxLength": 64
|
|
286
|
+
},
|
|
287
|
+
"health": {
|
|
288
|
+
"enum": [
|
|
289
|
+
"healthy",
|
|
290
|
+
"degraded",
|
|
291
|
+
"unhealthy"
|
|
292
|
+
]
|
|
293
|
+
},
|
|
294
|
+
"capabilities": {
|
|
295
|
+
"type": "array",
|
|
296
|
+
"maxItems": 6,
|
|
297
|
+
"uniqueItems": true,
|
|
298
|
+
"items": {
|
|
299
|
+
"enum": [
|
|
300
|
+
"traffic",
|
|
301
|
+
"connections",
|
|
302
|
+
"close_connection",
|
|
303
|
+
"protected_destinations_v1",
|
|
304
|
+
"protection_rules_readback",
|
|
305
|
+
"guarded_dns_tcp_v1"
|
|
306
|
+
]
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
"reasonCode": {
|
|
310
|
+
"type": "string",
|
|
311
|
+
"minLength": 1,
|
|
312
|
+
"maxLength": 128
|
|
313
|
+
},
|
|
314
|
+
"uptimeSeconds": {
|
|
315
|
+
"type": "integer",
|
|
316
|
+
"minimum": 0
|
|
317
|
+
},
|
|
318
|
+
"uploadTotal": {
|
|
319
|
+
"type": "integer",
|
|
320
|
+
"minimum": 0,
|
|
321
|
+
"maximum": 9223372036854775807
|
|
322
|
+
},
|
|
323
|
+
"downloadTotal": {
|
|
324
|
+
"type": "integer",
|
|
325
|
+
"minimum": 0,
|
|
326
|
+
"maximum": 9223372036854775807
|
|
327
|
+
},
|
|
328
|
+
"activeConnections": {
|
|
329
|
+
"type": "integer",
|
|
330
|
+
"minimum": 0,
|
|
331
|
+
"maximum": 1000000
|
|
332
|
+
}
|
|
72
333
|
}
|
|
73
334
|
},
|
|
74
335
|
"Connection": {
|
|
75
|
-
"type": "object",
|
|
76
|
-
"
|
|
336
|
+
"type": "object",
|
|
337
|
+
"additionalProperties": false,
|
|
338
|
+
"required": [
|
|
339
|
+
"id",
|
|
340
|
+
"destination",
|
|
341
|
+
"network",
|
|
342
|
+
"uploadBytes",
|
|
343
|
+
"downloadBytes"
|
|
344
|
+
],
|
|
77
345
|
"properties": {
|
|
78
|
-
"id": {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
346
|
+
"id": {
|
|
347
|
+
"$ref": "#/$defs/Identifier"
|
|
348
|
+
},
|
|
349
|
+
"destination": {
|
|
350
|
+
"type": "string",
|
|
351
|
+
"minLength": 1,
|
|
352
|
+
"maxLength": 253
|
|
353
|
+
},
|
|
354
|
+
"network": {
|
|
355
|
+
"enum": [
|
|
356
|
+
"tcp",
|
|
357
|
+
"udp",
|
|
358
|
+
"other"
|
|
359
|
+
]
|
|
360
|
+
},
|
|
361
|
+
"uploadBytes": {
|
|
362
|
+
"type": "integer",
|
|
363
|
+
"minimum": 0
|
|
364
|
+
},
|
|
365
|
+
"downloadBytes": {
|
|
366
|
+
"type": "integer",
|
|
367
|
+
"minimum": 0
|
|
368
|
+
},
|
|
369
|
+
"startedAt": {
|
|
370
|
+
"type": "string",
|
|
371
|
+
"format": "date-time"
|
|
372
|
+
}
|
|
84
373
|
}
|
|
85
374
|
},
|
|
86
375
|
"ConnectionsSnapshot": {
|
|
87
|
-
"type": "object",
|
|
88
|
-
"
|
|
376
|
+
"type": "object",
|
|
377
|
+
"additionalProperties": false,
|
|
378
|
+
"required": [
|
|
379
|
+
"engine",
|
|
380
|
+
"connections"
|
|
381
|
+
],
|
|
89
382
|
"properties": {
|
|
90
|
-
"engine": {
|
|
91
|
-
|
|
383
|
+
"engine": {
|
|
384
|
+
"enum": [
|
|
385
|
+
"mihomo",
|
|
386
|
+
"sing-box"
|
|
387
|
+
]
|
|
388
|
+
},
|
|
389
|
+
"connections": {
|
|
390
|
+
"type": "array",
|
|
391
|
+
"maxItems": 200,
|
|
392
|
+
"items": {
|
|
393
|
+
"$ref": "#/$defs/Connection"
|
|
394
|
+
}
|
|
395
|
+
}
|
|
92
396
|
}
|
|
93
397
|
},
|
|
94
398
|
"ConnectionCloseRequest": {
|
|
95
|
-
"type": "object",
|
|
96
|
-
"
|
|
399
|
+
"type": "object",
|
|
400
|
+
"additionalProperties": false,
|
|
401
|
+
"required": [
|
|
402
|
+
"commandId",
|
|
403
|
+
"connectionId",
|
|
404
|
+
"expiresAt"
|
|
405
|
+
],
|
|
97
406
|
"properties": {
|
|
98
|
-
"commandId": {
|
|
99
|
-
|
|
100
|
-
|
|
407
|
+
"commandId": {
|
|
408
|
+
"$ref": "#/$defs/Identifier"
|
|
409
|
+
},
|
|
410
|
+
"connectionId": {
|
|
411
|
+
"$ref": "#/$defs/Identifier"
|
|
412
|
+
},
|
|
413
|
+
"expiresAt": {
|
|
414
|
+
"type": "string",
|
|
415
|
+
"format": "date-time"
|
|
416
|
+
}
|
|
101
417
|
}
|
|
102
418
|
},
|
|
103
419
|
"ConnectionCloseResult": {
|
|
104
|
-
"type": "object",
|
|
105
|
-
"
|
|
420
|
+
"type": "object",
|
|
421
|
+
"additionalProperties": false,
|
|
422
|
+
"required": [
|
|
423
|
+
"commandId",
|
|
424
|
+
"status"
|
|
425
|
+
],
|
|
106
426
|
"properties": {
|
|
107
|
-
"commandId": {
|
|
108
|
-
|
|
109
|
-
|
|
427
|
+
"commandId": {
|
|
428
|
+
"$ref": "#/$defs/Identifier"
|
|
429
|
+
},
|
|
430
|
+
"status": {
|
|
431
|
+
"enum": [
|
|
432
|
+
"closed",
|
|
433
|
+
"not-found",
|
|
434
|
+
"failed"
|
|
435
|
+
]
|
|
436
|
+
},
|
|
437
|
+
"reasonCode": {
|
|
438
|
+
"type": "string",
|
|
439
|
+
"minLength": 1,
|
|
440
|
+
"maxLength": 128
|
|
441
|
+
}
|
|
110
442
|
}
|
|
443
|
+
},
|
|
444
|
+
"Binding": {
|
|
445
|
+
"type": "object",
|
|
446
|
+
"additionalProperties": false,
|
|
447
|
+
"required": [
|
|
448
|
+
"siteId",
|
|
449
|
+
"deviceId",
|
|
450
|
+
"resourceIds"
|
|
451
|
+
],
|
|
452
|
+
"properties": {
|
|
453
|
+
"siteId": {
|
|
454
|
+
"$ref": "#/$defs/Identifier"
|
|
455
|
+
},
|
|
456
|
+
"deviceId": {
|
|
457
|
+
"$ref": "#/$defs/Identifier"
|
|
458
|
+
},
|
|
459
|
+
"resourceIds": {
|
|
460
|
+
"type": "array",
|
|
461
|
+
"maxItems": 128,
|
|
462
|
+
"uniqueItems": true,
|
|
463
|
+
"items": {
|
|
464
|
+
"$ref": "#/$defs/Identifier"
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
"Protection": {
|
|
470
|
+
"type": "object",
|
|
471
|
+
"additionalProperties": false,
|
|
472
|
+
"required": [
|
|
473
|
+
"policyVersion",
|
|
474
|
+
"cidrs",
|
|
475
|
+
"hosts"
|
|
476
|
+
],
|
|
477
|
+
"properties": {
|
|
478
|
+
"policyVersion": {
|
|
479
|
+
"type": "integer",
|
|
480
|
+
"minimum": 1
|
|
481
|
+
},
|
|
482
|
+
"cidrs": {
|
|
483
|
+
"type": "array",
|
|
484
|
+
"maxItems": 4096,
|
|
485
|
+
"uniqueItems": true,
|
|
486
|
+
"items": {
|
|
487
|
+
"allOf": [
|
|
488
|
+
{
|
|
489
|
+
"$ref": "#/$defs/IPCIDR"
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
"not": {
|
|
493
|
+
"enum": [
|
|
494
|
+
"0.0.0.0/0",
|
|
495
|
+
"::/0"
|
|
496
|
+
]
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
]
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
"hosts": {
|
|
503
|
+
"type": "array",
|
|
504
|
+
"maxItems": 2048,
|
|
505
|
+
"uniqueItems": true,
|
|
506
|
+
"items": {
|
|
507
|
+
"type": "string",
|
|
508
|
+
"minLength": 1,
|
|
509
|
+
"maxLength": 253,
|
|
510
|
+
"pattern": "^(?:[A-Za-z0-9](?:[A-Za-z0-9.-]{0,251}[A-Za-z0-9])?|[A-Za-z0-9])$"
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
"IPv4CIDR": {
|
|
516
|
+
"type": "string",
|
|
517
|
+
"maxLength": 18,
|
|
518
|
+
"pattern": "^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])/(?:[0-9]|[12][0-9]|3[0-2])$",
|
|
519
|
+
"description": "Canonical IPv4 CIDR; use IPCIDR for either supported address family."
|
|
520
|
+
},
|
|
521
|
+
"IPCIDR": {
|
|
522
|
+
"type": "string",
|
|
523
|
+
"maxLength": 64,
|
|
524
|
+
"pattern": "^(?:(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])/(?:[1-9]|[12][0-9]|3[0-2])|(?:(?:(?:0|[1-9a-f][0-9a-f]{0,3}):){7}(?:0|[1-9a-f][0-9a-f]{0,3})|(?:(?:0|[1-9a-f][0-9a-f]{0,3}):){1,7}:|(?:(?:0|[1-9a-f][0-9a-f]{0,3}):){1,6}:(?:0|[1-9a-f][0-9a-f]{0,3})|(?:(?:0|[1-9a-f][0-9a-f]{0,3}):){1,5}(?::(?:0|[1-9a-f][0-9a-f]{0,3})){1,2}|(?:(?:0|[1-9a-f][0-9a-f]{0,3}):){1,4}(?::(?:0|[1-9a-f][0-9a-f]{0,3})){1,3}|(?:(?:0|[1-9a-f][0-9a-f]{0,3}):){1,3}(?::(?:0|[1-9a-f][0-9a-f]{0,3})){1,4}|(?:(?:0|[1-9a-f][0-9a-f]{0,3}):){1,2}(?::(?:0|[1-9a-f][0-9a-f]{0,3})){1,5}|(?:0|[1-9a-f][0-9a-f]{0,3}):(?:(?::(?:0|[1-9a-f][0-9a-f]{0,3})){1,6})|:(?:(?::(?:0|[1-9a-f][0-9a-f]{0,3})){1,7}|:))/(?:[1-9]|[1-9][0-9]|1[01][0-9]|12[0-8]))$",
|
|
525
|
+
"description": "Non-default IPv4 or IPv6 CIDR syntax. Core additionally validates canonical network-address bits and compressed address spelling with netip."
|
|
111
526
|
}
|
|
112
527
|
}
|
|
113
528
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
package openapi
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"encoding/json"
|
|
5
|
+
"strings"
|
|
6
|
+
"testing"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
func TestEndpointChannelControlTransport(t *testing.T) {
|
|
10
|
+
type server struct {
|
|
11
|
+
URL string `json:"url"`
|
|
12
|
+
}
|
|
13
|
+
type operation struct {
|
|
14
|
+
Servers []server `json:"servers"`
|
|
15
|
+
Security []map[string][]string `json:"security"`
|
|
16
|
+
}
|
|
17
|
+
var document struct {
|
|
18
|
+
Servers []server `json:"servers"`
|
|
19
|
+
Paths map[string]struct {
|
|
20
|
+
Servers []server `json:"servers"`
|
|
21
|
+
Get operation `json:"get"`
|
|
22
|
+
Post operation `json:"post"`
|
|
23
|
+
} `json:"paths"`
|
|
24
|
+
Components struct {
|
|
25
|
+
SecuritySchemes map[string]struct {
|
|
26
|
+
Type string `json:"type"`
|
|
27
|
+
} `json:"securitySchemes"`
|
|
28
|
+
} `json:"components"`
|
|
29
|
+
}
|
|
30
|
+
if err := json.Unmarshal(JSON(), &document); err != nil {
|
|
31
|
+
t.Fatal(err)
|
|
32
|
+
}
|
|
33
|
+
for _, suffix := range []string{"", "/receipt"} {
|
|
34
|
+
path := "/network-control/v1/runtimes/{runtimeID}/channel-controls" + suffix
|
|
35
|
+
t.Run(path, func(t *testing.T) {
|
|
36
|
+
item, ok := document.Paths[path]
|
|
37
|
+
if !ok {
|
|
38
|
+
t.Fatal("missing runtime channel control operation")
|
|
39
|
+
}
|
|
40
|
+
op := item.Get
|
|
41
|
+
if suffix != "" {
|
|
42
|
+
op = item.Post
|
|
43
|
+
}
|
|
44
|
+
servers := op.Servers
|
|
45
|
+
if len(servers) == 0 {
|
|
46
|
+
servers = item.Servers
|
|
47
|
+
}
|
|
48
|
+
if len(servers) == 0 {
|
|
49
|
+
servers = document.Servers
|
|
50
|
+
}
|
|
51
|
+
if len(servers) != 1 || strings.TrimSuffix(servers[0].URL, "/")+path != "/api"+path {
|
|
52
|
+
t.Errorf("effective server %v does not target the independent /api/network-control/v1 listener", servers)
|
|
53
|
+
}
|
|
54
|
+
if len(op.Security) != 1 || len(op.Security[0]) != 1 {
|
|
55
|
+
t.Fatal("runtime operations must explicitly require one certificate scheme, without a Bearer alternative")
|
|
56
|
+
}
|
|
57
|
+
for name, scopes := range op.Security[0] {
|
|
58
|
+
if len(scopes) != 0 || document.Components.SecuritySchemes[name].Type != "mutualTLS" {
|
|
59
|
+
t.Errorf("runtime operation requires %q, want a mutualTLS security scheme", name)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
}
|