feat(protocol): add gateway transport authority contracts

This commit is contained in:
sechmachine
2026-07-29 05:59:46 +07:00
parent b2c24b3fa3
commit b5558133e3
21 changed files with 1898 additions and 15 deletions
+277 -1
View File
@@ -1,7 +1,7 @@
// Code generated by tools/generate.py; DO NOT EDIT.
import Foundation
public typealias JSONObject = [String: String]
public let schemaSHA256 = "36e4c8bac2eae674c1eba551c6ca8c64bf80fcc092ca63ec89a2c71c2bec86e1"
public let schemaSHA256 = "b8a69785112bb94d45f47c2250ca59d0bde47e3667b8ad89c9b0e2c4cfb25aec"
public let currentWireVersion = "1"
public let nMinus1WireVersion = "0"
public let nMinus2WireVersion = "-1"
@@ -117,6 +117,66 @@ public struct BrokerSession: Codable, Equatable {
}
}
public struct CapabilityProfile: Codable, Equatable {
public let transport: String
public let framing: String
public let media: String
public let audio: String
public let sourceRateControl: String
public let clientDecode: String
enum CodingKeys: String, CodingKey {
case transport = "transport"
case framing = "framing"
case media = "media"
case audio = "audio"
case sourceRateControl = "source_rate_control"
case clientDecode = "client_decode"
}
public init(from decoder: Decoder) throws {
let c = try decoder.container(keyedBy: CodingKeys.self)
transport = try c.decode(String.self, forKey: .transport)
framing = try c.decode(String.self, forKey: .framing)
media = try c.decode(String.self, forKey: .media)
audio = try c.decode(String.self, forKey: .audio)
sourceRateControl = try c.decode(String.self, forKey: .sourceRateControl)
clientDecode = try c.decode(String.self, forKey: .clientDecode)
}
}
public struct ChannelFrame: Codable, Equatable {
public let version: String
public let flowId: String
public let sequence: Int64
public let flags: Int64
public let fragmentIndex: Int64
public let fragmentCount: Int64
public let timestampMs: Int64
public let payload: String
enum CodingKeys: String, CodingKey {
case version = "version"
case flowId = "flow_id"
case sequence = "sequence"
case flags = "flags"
case fragmentIndex = "fragment_index"
case fragmentCount = "fragment_count"
case timestampMs = "timestamp_ms"
case payload = "payload"
}
public init(from decoder: Decoder) throws {
let c = try decoder.container(keyedBy: CodingKeys.self)
version = try c.decode(String.self, forKey: .version)
flowId = try c.decode(String.self, forKey: .flowId)
sequence = try c.decode(Int64.self, forKey: .sequence)
flags = try c.decode(Int64.self, forKey: .flags)
fragmentIndex = try c.decode(Int64.self, forKey: .fragmentIndex)
fragmentCount = try c.decode(Int64.self, forKey: .fragmentCount)
timestampMs = try c.decode(Int64.self, forKey: .timestampMs)
payload = try c.decode(String.self, forKey: .payload)
}
}
public struct ClipboardText: Codable, Equatable {
public let text: String
public let encoding: String
@@ -348,6 +408,108 @@ public struct FieldViolation: Codable, Equatable {
}
}
public struct GatewayDrain: Codable, Equatable {
public let version: String
public let gatewayId: String
public let sequence: Int64
public let reason: String
public let deadline: String
enum CodingKeys: String, CodingKey {
case version = "version"
case gatewayId = "gateway_id"
case sequence = "sequence"
case reason = "reason"
case deadline = "deadline"
}
public init(from decoder: Decoder) throws {
let c = try decoder.container(keyedBy: CodingKeys.self)
version = try c.decode(String.self, forKey: .version)
gatewayId = try c.decode(String.self, forKey: .gatewayId)
sequence = try c.decode(Int64.self, forKey: .sequence)
reason = try c.decode(String.self, forKey: .reason)
deadline = try c.decode(String.self, forKey: .deadline)
}
}
public struct GatewayHeartbeat: Codable, Equatable {
public let version: String
public let gatewayId: String
public let sequence: Int64
public let observedAt: String
public let activeConnections: Int64
public let egressKbps: Int64
public let state: String
enum CodingKeys: String, CodingKey {
case version = "version"
case gatewayId = "gateway_id"
case sequence = "sequence"
case observedAt = "observed_at"
case activeConnections = "active_connections"
case egressKbps = "egress_kbps"
case state = "state"
}
public init(from decoder: Decoder) throws {
let c = try decoder.container(keyedBy: CodingKeys.self)
version = try c.decode(String.self, forKey: .version)
gatewayId = try c.decode(String.self, forKey: .gatewayId)
sequence = try c.decode(Int64.self, forKey: .sequence)
observedAt = try c.decode(String.self, forKey: .observedAt)
activeConnections = try c.decode(Int64.self, forKey: .activeConnections)
egressKbps = try c.decode(Int64.self, forKey: .egressKbps)
state = try c.decode(String.self, forKey: .state)
}
}
public struct GatewayRegistration: Codable, Equatable {
public let version: String
public let gatewayId: String
public let instanceIdentity: String
public let certificateIdentity: String
public let publicIdentity: String
public let address: String
public let providerIdentity: String
public let protocolMinVersion: Int64
public let protocolMaxVersion: Int64
public let connectionCapacity: Int64
public let bandwidthCapacityKbps: Int64
public let features: [String]
public let capabilities: CapabilityProfile
enum CodingKeys: String, CodingKey {
case version = "version"
case gatewayId = "gateway_id"
case instanceIdentity = "instance_identity"
case certificateIdentity = "certificate_identity"
case publicIdentity = "public_identity"
case address = "address"
case providerIdentity = "provider_identity"
case protocolMinVersion = "protocol_min_version"
case protocolMaxVersion = "protocol_max_version"
case connectionCapacity = "connection_capacity"
case bandwidthCapacityKbps = "bandwidth_capacity_kbps"
case features = "features"
case capabilities = "capabilities"
}
public init(from decoder: Decoder) throws {
let c = try decoder.container(keyedBy: CodingKeys.self)
version = try c.decode(String.self, forKey: .version)
gatewayId = try c.decode(String.self, forKey: .gatewayId)
instanceIdentity = try c.decode(String.self, forKey: .instanceIdentity)
certificateIdentity = try c.decode(String.self, forKey: .certificateIdentity)
publicIdentity = try c.decode(String.self, forKey: .publicIdentity)
address = try c.decode(String.self, forKey: .address)
providerIdentity = try c.decode(String.self, forKey: .providerIdentity)
protocolMinVersion = try c.decode(Int64.self, forKey: .protocolMinVersion)
protocolMaxVersion = try c.decode(Int64.self, forKey: .protocolMaxVersion)
connectionCapacity = try c.decode(Int64.self, forKey: .connectionCapacity)
bandwidthCapacityKbps = try c.decode(Int64.self, forKey: .bandwidthCapacityKbps)
features = try c.decode([String].self, forKey: .features)
capabilities = try c.decode(CapabilityProfile.self, forKey: .capabilities)
}
}
public struct GrantReference: Codable, Equatable {
public let opaqueValue: String
public let expiresAt: String
@@ -492,6 +654,30 @@ public struct PageInfo: Codable, Equatable {
}
}
public struct ProviderState: Codable, Equatable {
public let version: String
public let sessionId: String
public let state: String
public let cleanupPending: Bool
public let channels: [String]
enum CodingKeys: String, CodingKey {
case version = "version"
case sessionId = "session_id"
case state = "state"
case cleanupPending = "cleanup_pending"
case channels = "channels"
}
public init(from decoder: Decoder) throws {
let c = try decoder.container(keyedBy: CodingKeys.self)
version = try c.decode(String.self, forKey: .version)
sessionId = try c.decode(String.self, forKey: .sessionId)
state = try c.decode(String.self, forKey: .state)
cleanupPending = try c.decode(Bool.self, forKey: .cleanupPending)
channels = try c.decode([String].self, forKey: .channels)
}
}
public struct ReauthGrant: Codable, Equatable {
public let token: String
public let purpose: String
@@ -624,6 +810,42 @@ public struct ResourceList: Codable, Equatable {
}
}
public struct SessionAuthority: Codable, Equatable {
public let version: String
public let sessionId: String
public let gatewayId: String
public let audience: String
public let reconnectSequence: Int64
public let expiresAt: String
public let capabilities: CapabilityProfile
public let providerProfile: String
public let providerIdentity: String
enum CodingKeys: String, CodingKey {
case version = "version"
case sessionId = "session_id"
case gatewayId = "gateway_id"
case audience = "audience"
case reconnectSequence = "reconnect_sequence"
case expiresAt = "expires_at"
case capabilities = "capabilities"
case providerProfile = "provider_profile"
case providerIdentity = "provider_identity"
}
public init(from decoder: Decoder) throws {
let c = try decoder.container(keyedBy: CodingKeys.self)
version = try c.decode(String.self, forKey: .version)
sessionId = try c.decode(String.self, forKey: .sessionId)
gatewayId = try c.decode(String.self, forKey: .gatewayId)
audience = try c.decode(String.self, forKey: .audience)
reconnectSequence = try c.decode(Int64.self, forKey: .reconnectSequence)
expiresAt = try c.decode(String.self, forKey: .expiresAt)
capabilities = try c.decode(CapabilityProfile.self, forKey: .capabilities)
providerProfile = try c.decode(String.self, forKey: .providerProfile)
providerIdentity = try c.decode(String.self, forKey: .providerIdentity)
}
}
public struct SessionRequest: Codable, Equatable {
public let clientDeviceId: String
public let deviceKeyId: String
@@ -648,6 +870,60 @@ public struct SessionRequest: Codable, Equatable {
}
}
public struct StableError: Codable, Equatable {
public let version: String
public let code: String
public let message: String
public let retryable: Bool
enum CodingKeys: String, CodingKey {
case version = "version"
case code = "code"
case message = "message"
case retryable = "retryable"
}
public init(from decoder: Decoder) throws {
let c = try decoder.container(keyedBy: CodingKeys.self)
version = try c.decode(String.self, forKey: .version)
code = try c.decode(String.self, forKey: .code)
message = try c.decode(String.self, forKey: .message)
retryable = try c.decode(Bool.self, forKey: .retryable)
}
}
public struct TunnelAdmissionRequest: Codable, Equatable {
public let version: String
public let sessionId: String
public let gatewayId: String
public let audience: String
public let grant: String
public let reconnectSequence: Int64
public let clientNonce: String
public let capabilities: CapabilityProfile
enum CodingKeys: String, CodingKey {
case version = "version"
case sessionId = "session_id"
case gatewayId = "gateway_id"
case audience = "audience"
case grant = "grant"
case reconnectSequence = "reconnect_sequence"
case clientNonce = "client_nonce"
case capabilities = "capabilities"
}
public init(from decoder: Decoder) throws {
let c = try decoder.container(keyedBy: CodingKeys.self)
version = try c.decode(String.self, forKey: .version)
sessionId = try c.decode(String.self, forKey: .sessionId)
gatewayId = try c.decode(String.self, forKey: .gatewayId)
audience = try c.decode(String.self, forKey: .audience)
grant = try c.decode(String.self, forKey: .grant)
reconnectSequence = try c.decode(Int64.self, forKey: .reconnectSequence)
clientNonce = try c.decode(String.self, forKey: .clientNonce)
capabilities = try c.decode(CapabilityProfile.self, forKey: .capabilities)
}
}
public struct VersionNegotiation: Codable, Equatable {
public let supportedVersions: [String]
public let features: [String]