@limrun/api 0.48.4 → 0.49.1

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.
Files changed (193) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/build-settings.d.mts.map +1 -1
  3. package/build-settings.d.ts.map +1 -1
  4. package/build-settings.js +4 -5
  5. package/build-settings.js.map +1 -1
  6. package/build-settings.mjs +4 -5
  7. package/build-settings.mjs.map +1 -1
  8. package/client.d.mts +8 -5
  9. package/client.d.mts.map +1 -1
  10. package/client.d.ts +8 -5
  11. package/client.d.ts.map +1 -1
  12. package/client.js +4 -4
  13. package/client.js.map +1 -1
  14. package/client.mjs +2 -2
  15. package/client.mjs.map +1 -1
  16. package/destination-tunnel-dialer.d.mts +30 -2
  17. package/destination-tunnel-dialer.d.mts.map +1 -1
  18. package/destination-tunnel-dialer.d.ts +30 -2
  19. package/destination-tunnel-dialer.d.ts.map +1 -1
  20. package/destination-tunnel-dialer.js +349 -65
  21. package/destination-tunnel-dialer.js.map +1 -1
  22. package/destination-tunnel-dialer.mjs +345 -64
  23. package/destination-tunnel-dialer.mjs.map +1 -1
  24. package/destination-tunnel-har.d.mts +23 -0
  25. package/destination-tunnel-har.d.mts.map +1 -0
  26. package/destination-tunnel-har.d.ts +23 -0
  27. package/destination-tunnel-har.d.ts.map +1 -0
  28. package/destination-tunnel-har.js +164 -0
  29. package/destination-tunnel-har.js.map +1 -0
  30. package/destination-tunnel-har.mjs +160 -0
  31. package/destination-tunnel-har.mjs.map +1 -0
  32. package/destination-tunnel-inspection.d.mts +71 -0
  33. package/destination-tunnel-inspection.d.mts.map +1 -0
  34. package/destination-tunnel-inspection.d.ts +71 -0
  35. package/destination-tunnel-inspection.d.ts.map +1 -0
  36. package/destination-tunnel-inspection.js +267 -0
  37. package/destination-tunnel-inspection.js.map +1 -0
  38. package/destination-tunnel-inspection.mjs +261 -0
  39. package/destination-tunnel-inspection.mjs.map +1 -0
  40. package/destination-tunnel.d.mts +119 -14
  41. package/destination-tunnel.d.mts.map +1 -1
  42. package/destination-tunnel.d.ts +119 -14
  43. package/destination-tunnel.d.ts.map +1 -1
  44. package/destination-tunnel.js +407 -98
  45. package/destination-tunnel.js.map +1 -1
  46. package/destination-tunnel.mjs +374 -73
  47. package/destination-tunnel.mjs.map +1 -1
  48. package/exec-client.d.mts +9 -0
  49. package/exec-client.d.mts.map +1 -1
  50. package/exec-client.d.ts +9 -0
  51. package/exec-client.d.ts.map +1 -1
  52. package/exec-client.js.map +1 -1
  53. package/exec-client.mjs.map +1 -1
  54. package/index.d.mts +8 -1
  55. package/index.d.mts.map +1 -1
  56. package/index.d.ts +8 -1
  57. package/index.d.ts.map +1 -1
  58. package/index.js +26 -2
  59. package/index.js.map +1 -1
  60. package/index.mjs +7 -1
  61. package/index.mjs.map +1 -1
  62. package/instance-client.d.mts +107 -1
  63. package/instance-client.d.mts.map +1 -1
  64. package/instance-client.d.ts +107 -1
  65. package/instance-client.d.ts.map +1 -1
  66. package/instance-client.js +83 -1
  67. package/instance-client.js.map +1 -1
  68. package/instance-client.mjs +83 -1
  69. package/instance-client.mjs.map +1 -1
  70. package/internal/destination-tunnel-management.d.mts +4 -3
  71. package/internal/destination-tunnel-management.d.mts.map +1 -1
  72. package/internal/destination-tunnel-management.d.ts +4 -3
  73. package/internal/destination-tunnel-management.d.ts.map +1 -1
  74. package/internal/destination-tunnel-management.js +64 -46
  75. package/internal/destination-tunnel-management.js.map +1 -1
  76. package/internal/destination-tunnel-management.mjs +55 -37
  77. package/internal/destination-tunnel-management.mjs.map +1 -1
  78. package/internal/destination-tunnel-url.d.mts +2 -0
  79. package/internal/destination-tunnel-url.d.mts.map +1 -1
  80. package/internal/destination-tunnel-url.d.ts +2 -0
  81. package/internal/destination-tunnel-url.d.ts.map +1 -1
  82. package/internal/destination-tunnel-url.js +45 -5
  83. package/internal/destination-tunnel-url.js.map +1 -1
  84. package/internal/destination-tunnel-url.mjs +44 -5
  85. package/internal/destination-tunnel-url.mjs.map +1 -1
  86. package/internal/destination-tunnel-wire-reader.d.mts +23 -0
  87. package/internal/destination-tunnel-wire-reader.d.mts.map +1 -0
  88. package/internal/destination-tunnel-wire-reader.d.ts +23 -0
  89. package/internal/destination-tunnel-wire-reader.d.ts.map +1 -0
  90. package/internal/destination-tunnel-wire-reader.js +110 -0
  91. package/internal/destination-tunnel-wire-reader.js.map +1 -0
  92. package/internal/destination-tunnel-wire-reader.mjs +93 -0
  93. package/internal/destination-tunnel-wire-reader.mjs.map +1 -0
  94. package/internal/persist-option.d.mts +14 -0
  95. package/internal/persist-option.d.mts.map +1 -0
  96. package/internal/persist-option.d.ts +14 -0
  97. package/internal/persist-option.d.ts.map +1 -0
  98. package/internal/persist-option.js +18 -0
  99. package/internal/persist-option.js.map +1 -0
  100. package/internal/persist-option.mjs +15 -0
  101. package/internal/persist-option.mjs.map +1 -0
  102. package/internal/proxy-transport.d.mts +27 -0
  103. package/internal/proxy-transport.d.mts.map +1 -1
  104. package/internal/proxy-transport.d.ts +27 -0
  105. package/internal/proxy-transport.d.ts.map +1 -1
  106. package/internal/proxy-transport.js +206 -0
  107. package/internal/proxy-transport.js.map +1 -1
  108. package/internal/proxy-transport.mjs +205 -0
  109. package/internal/proxy-transport.mjs.map +1 -1
  110. package/internal/session-stream.d.mts +39 -0
  111. package/internal/session-stream.d.mts.map +1 -0
  112. package/internal/session-stream.d.ts +39 -0
  113. package/internal/session-stream.d.ts.map +1 -0
  114. package/internal/session-stream.js +144 -0
  115. package/internal/session-stream.js.map +1 -0
  116. package/internal/session-stream.mjs +139 -0
  117. package/internal/session-stream.mjs.map +1 -0
  118. package/internal/tslib.js +4 -4
  119. package/ios-client.d.mts +63 -4
  120. package/ios-client.d.mts.map +1 -1
  121. package/ios-client.d.ts +63 -4
  122. package/ios-client.d.ts.map +1 -1
  123. package/ios-client.js +48 -2
  124. package/ios-client.js.map +1 -1
  125. package/ios-client.mjs +48 -2
  126. package/ios-client.mjs.map +1 -1
  127. package/package.json +22 -1
  128. package/resources/android-instances-helpers.d.mts +25 -0
  129. package/resources/android-instances-helpers.d.mts.map +1 -0
  130. package/resources/android-instances-helpers.d.ts +25 -0
  131. package/resources/android-instances-helpers.d.ts.map +1 -0
  132. package/resources/android-instances-helpers.js +37 -0
  133. package/resources/android-instances-helpers.js.map +1 -0
  134. package/resources/android-instances-helpers.mjs +33 -0
  135. package/resources/android-instances-helpers.mjs.map +1 -0
  136. package/resources/index.d.mts +6 -3
  137. package/resources/index.d.mts.map +1 -1
  138. package/resources/index.d.ts +6 -3
  139. package/resources/index.d.ts.map +1 -1
  140. package/resources/index.js +6 -5
  141. package/resources/index.js.map +1 -1
  142. package/resources/index.mjs +3 -3
  143. package/resources/index.mjs.map +1 -1
  144. package/resources/ios-instances-helpers.d.mts +25 -0
  145. package/resources/ios-instances-helpers.d.mts.map +1 -0
  146. package/resources/ios-instances-helpers.d.ts +25 -0
  147. package/resources/ios-instances-helpers.d.ts.map +1 -0
  148. package/resources/ios-instances-helpers.js +37 -0
  149. package/resources/ios-instances-helpers.js.map +1 -0
  150. package/resources/ios-instances-helpers.mjs +33 -0
  151. package/resources/ios-instances-helpers.mjs.map +1 -0
  152. package/resources/session-artifacts.d.mts +70 -0
  153. package/resources/session-artifacts.d.mts.map +1 -0
  154. package/resources/session-artifacts.d.ts +70 -0
  155. package/resources/session-artifacts.d.ts.map +1 -0
  156. package/resources/session-artifacts.js +8 -0
  157. package/resources/session-artifacts.js.map +1 -0
  158. package/resources/session-artifacts.mjs +7 -0
  159. package/resources/session-artifacts.mjs.map +1 -0
  160. package/resources/xcode-instances-helpers.d.mts +55 -0
  161. package/resources/xcode-instances-helpers.d.mts.map +1 -1
  162. package/resources/xcode-instances-helpers.d.ts +55 -0
  163. package/resources/xcode-instances-helpers.d.ts.map +1 -1
  164. package/resources/xcode-instances-helpers.js +49 -3
  165. package/resources/xcode-instances-helpers.js.map +1 -1
  166. package/resources/xcode-instances-helpers.mjs +47 -2
  167. package/resources/xcode-instances-helpers.mjs.map +1 -1
  168. package/src/build-settings.ts +4 -5
  169. package/src/client.ts +12 -2
  170. package/src/destination-tunnel-dialer.ts +403 -64
  171. package/src/destination-tunnel-har.ts +200 -0
  172. package/src/destination-tunnel-inspection.ts +367 -0
  173. package/src/destination-tunnel.ts +510 -88
  174. package/src/exec-client.ts +9 -0
  175. package/src/index.ts +58 -0
  176. package/src/instance-client.ts +273 -5
  177. package/src/internal/destination-tunnel-management.ts +67 -43
  178. package/src/internal/destination-tunnel-url.ts +61 -5
  179. package/src/internal/destination-tunnel-wire-reader.ts +109 -0
  180. package/src/internal/persist-option.ts +26 -0
  181. package/src/internal/proxy-transport.ts +248 -0
  182. package/src/internal/session-stream.ts +157 -0
  183. package/src/ios-client.ts +129 -8
  184. package/src/resources/android-instances-helpers.ts +45 -0
  185. package/src/resources/index.ts +14 -2
  186. package/src/resources/ios-instances-helpers.ts +45 -0
  187. package/src/resources/session-artifacts.ts +95 -0
  188. package/src/resources/xcode-instances-helpers.ts +116 -5
  189. package/src/version.ts +1 -1
  190. package/version.d.mts +1 -1
  191. package/version.d.ts +1 -1
  192. package/version.js +1 -1
  193. package/version.mjs +1 -1
@@ -1,20 +1,87 @@
1
+ export { DestinationTunnelProtocolError } from "./internal/destination-tunnel-wire-reader.mjs";
1
2
  export declare const DESTINATION_TUNNEL_VERSION = 1;
2
3
  export declare const DESTINATION_TUNNEL_MAX_ROUTES = 10;
4
+ export declare const DESTINATION_TUNNEL_MAX_DOMAINS = 64;
3
5
  export declare const DESTINATION_TUNNEL_CONN_ID_HEADER_BYTES = 4;
6
+ /**
7
+ * IPv4 range used by the device side for synthetic (fake) DNS answers of
8
+ * matched domain selectors.
9
+ */
10
+ export declare const DESTINATION_TUNNEL_FAKE_RANGE = "198.18.0.0/15";
11
+ /** Upper bound for per-flow receive windows advertised in open/openOk. */
12
+ export declare const DESTINATION_TUNNEL_MAX_WINDOW: number;
13
+ /** Default receive window advertised by generic SDK tunnel clients. */
14
+ export declare const DESTINATION_TUNNEL_DEFAULT_WINDOW: number;
15
+ /** Upper bound for a single windowUpdate increment. */
16
+ export declare const DESTINATION_TUNNEL_MAX_WINDOW_INCREMENT = 2147483647;
17
+ export declare const DESTINATION_TUNNEL_DEFAULT_MAX_BODY_BYTES: number;
18
+ export declare const DESTINATION_TUNNEL_MAX_BODY_BYTES: number;
19
+ export declare const DESTINATION_TUNNEL_DEFAULT_TTL_SECONDS: number;
20
+ export declare const DESTINATION_TUNNEL_MAX_TTL_SECONDS: number;
4
21
  export interface DestinationTunnelRoute {
5
22
  host: string;
6
23
  port: number;
7
24
  }
8
- export type DestinationTunnelOpenFailureReason = 'dns_not_found' | 'dns_temporary_failure' | 'connection_refused' | 'connection_reset' | 'connection_timed_out' | 'unreachable' | 'permission_denied' | 'resource_exhausted' | 'route_not_allowed' | 'cancelled' | 'internal' | (string & {});
25
+ /** Canonical selector values carried by the public protocol. */
26
+ export type DestinationTunnelSelectors = string[];
27
+ /** Internal classification used to enforce and dial canonical selectors. */
28
+ export interface DestinationTunnelSelectorCatalog {
29
+ routes?: DestinationTunnelRoute[];
30
+ domains?: string[];
31
+ }
32
+ export interface DestinationTunnelInspectionConfig {
33
+ enabled: boolean;
34
+ captureBodies: boolean;
35
+ maxBodyBytes: number;
36
+ persist: boolean;
37
+ ttlSeconds: number;
38
+ }
39
+ export type DestinationTunnelTransportType = 'tcp' | 'tls';
40
+ export type DestinationTunnelTransportRequest = {
41
+ type: 'tcp';
42
+ } | {
43
+ type: 'tls';
44
+ serverName: string;
45
+ alpnProtocols: string[];
46
+ };
47
+ export interface DestinationTunnelTransportResult {
48
+ type: DestinationTunnelTransportType;
49
+ alpnProtocol?: string;
50
+ remoteAddress?: string;
51
+ dnsMs?: number;
52
+ connectMs?: number;
53
+ tlsMs?: number;
54
+ }
55
+ export type DestinationTunnelSelectorKind = 'route' | 'domain';
56
+ export type DestinationTunnelBindStatus = 'ok' | 'conflict' | 'error';
57
+ /** Per-address bind outcome the device server reports for exact routes. */
58
+ export interface DestinationTunnelBindReport {
59
+ address: string;
60
+ status: DestinationTunnelBindStatus;
61
+ osCode?: string;
62
+ }
63
+ /** Normalized selector the server acknowledges in `ready` and status. */
64
+ export interface DestinationTunnelSelectorReport {
65
+ id: string;
66
+ kind: DestinationTunnelSelectorKind;
67
+ value: string;
68
+ binds?: DestinationTunnelBindReport[];
69
+ }
70
+ export type DestinationTunnelOpenFailureReason = 'dns_not_found' | 'dns_temporary_failure' | 'connection_refused' | 'connection_reset' | 'connection_timed_out' | 'unreachable' | 'permission_denied' | 'resource_exhausted' | 'selector_not_allowed' | 'tls_handshake_failed' | 'tls_validation_failed' | 'tls_protocol_error' | 'cancelled' | 'internal' | (string & {});
9
71
  export type DestinationTunnelResetReason = 'cancelled' | 'connection_error' | 'protocol_error' | 'resource_exhausted' | 'internal' | (string & {});
10
- export type DestinationTunnelSessionErrorCode = 'unsupported_version' | 'invalid_message' | 'invalid_route' | 'route_capacity' | 'already_active' | 'unavailable' | 'internal' | (string & {});
72
+ export type DestinationTunnelSessionErrorCode = 'unsupported_version' | 'invalid_message' | 'invalid_selector' | 'already_active' | 'unavailable' | 'internal' | (string & {});
11
73
  export type DestinationTunnelClientMessage = {
12
74
  type: 'start';
13
75
  version: number;
14
- routes: DestinationTunnelRoute[];
76
+ selectors: DestinationTunnelSelectors;
77
+ inspection: DestinationTunnelInspectionConfig;
78
+ /** Default per-flow receive window this client grants. */
79
+ window: number;
15
80
  } | {
16
81
  type: 'openOk';
17
82
  connId: number;
83
+ transport: DestinationTunnelTransportResult;
84
+ window: number;
18
85
  } | {
19
86
  type: 'openFail';
20
87
  connId: number;
@@ -28,18 +95,26 @@ export type DestinationTunnelClientMessage = {
28
95
  connId: number;
29
96
  reason: DestinationTunnelResetReason;
30
97
  osCode?: string;
98
+ } | {
99
+ type: 'windowUpdate';
100
+ connId: number;
101
+ increment: number;
31
102
  };
32
103
  export type DestinationTunnelServerMessage = {
33
104
  type: 'ready';
34
105
  version: number;
35
106
  tunnelId: string;
107
+ selectors: DestinationTunnelSelectorReport[];
108
+ configHash: string;
36
109
  } | {
37
110
  type: 'open';
38
111
  connId: number;
39
- routeId: string;
112
+ selectorId: string;
40
113
  host: string;
41
114
  port: number;
42
- proto: 'tcp';
115
+ transport: DestinationTunnelTransportRequest;
116
+ /** Server's receive window for this flow. */
117
+ window: number;
43
118
  } | {
44
119
  type: 'fin';
45
120
  connId: number;
@@ -48,27 +123,57 @@ export type DestinationTunnelServerMessage = {
48
123
  connId: number;
49
124
  reason: DestinationTunnelResetReason;
50
125
  osCode?: string;
126
+ } | {
127
+ type: 'windowUpdate';
128
+ connId: number;
129
+ increment: number;
51
130
  } | {
52
131
  type: 'error';
53
132
  code: DestinationTunnelSessionErrorCode;
54
133
  };
55
- export type DestinationTunnelRouteErrorCode = 'empty' | 'too_many' | 'invalid_host' | 'invalid_port' | 'duplicate';
56
- export declare class DestinationTunnelRouteError extends Error {
57
- readonly code: DestinationTunnelRouteErrorCode;
58
- constructor(code: DestinationTunnelRouteErrorCode, message: string);
59
- }
60
- export declare class DestinationTunnelProtocolError extends Error {
61
- constructor(message: string);
134
+ export type DestinationTunnelSelectorErrorCode = 'empty' | 'too_many' | 'invalid_host' | 'invalid_port' | 'invalid_domain' | 'duplicate';
135
+ export declare class DestinationTunnelSelectorError extends Error {
136
+ readonly code: DestinationTunnelSelectorErrorCode;
137
+ constructor(code: DestinationTunnelSelectorErrorCode, message: string);
62
138
  }
63
139
  export declare function encodeDestinationTunnelDataFrame(connId: number, payload: Buffer): Buffer;
64
140
  export declare function decodeDestinationTunnelDataFrame(frame: Buffer): {
65
141
  connId: number;
66
142
  payload: Buffer;
67
143
  };
68
- export declare function validateDestinationTunnelRoutes(routes: readonly DestinationTunnelRoute[]): DestinationTunnelRoute[];
144
+ export declare function validateDestinationTunnelRoutes(routes: readonly DestinationTunnelRoute[], options?: {
145
+ minPort?: number;
146
+ }): DestinationTunnelRoute[];
147
+ /**
148
+ * Validate and canonicalize a full selector set. Selector policy specific to
149
+ * one product (such as the Android bind-listener minimum route port) is
150
+ * expressed via options rather than separate message shapes.
151
+ */
152
+ export declare function validateDestinationTunnelSelectors(selectors: readonly string[], options?: {
153
+ minRoutePort?: number;
154
+ }): DestinationTunnelSelectors;
155
+ export declare function classifyDestinationTunnelSelectors(selectors: readonly string[], options?: {
156
+ minRoutePort?: number;
157
+ }): DestinationTunnelSelectorCatalog;
158
+ export declare function validateDestinationTunnelDomains(domains: readonly string[]): string[];
159
+ /**
160
+ * Deterministic hash of the canonical selector configuration. Servers echo it
161
+ * in `ready` so clients can detect config mismatches across reconnects. The
162
+ * hashed JSON has fixed key order.
163
+ */
164
+ export declare function destinationTunnelConfigHash(selectors: DestinationTunnelSelectors, inspection?: DestinationTunnelInspectionConfig): string;
165
+ export declare function normalizeDestinationTunnelInspection(inspection: Partial<DestinationTunnelInspectionConfig>): DestinationTunnelInspectionConfig;
166
+ export declare function disabledDestinationTunnelInspection(): DestinationTunnelInspectionConfig;
167
+ /** Selector IDs are one-based positions in the canonical selector array. */
168
+ export declare function destinationTunnelSelectorIds(selectors: DestinationTunnelSelectors): string[];
169
+ export declare function destinationTunnelDomainMatches(pattern: string, host: string): boolean;
170
+ /**
171
+ * Verify a server OPEN against the negotiated selectors. Every OPEN must name
172
+ * a known selector ID and a target that the selector actually covers.
173
+ */
69
174
  export declare function assertDestinationTunnelOpenAllowed(message: Extract<DestinationTunnelServerMessage, {
70
175
  type: 'open';
71
- }>, routes: readonly DestinationTunnelRoute[]): void;
176
+ }>, selectors: DestinationTunnelSelectors): DestinationTunnelSelectorKind;
72
177
  export declare function assertDestinationTunnelReady(message: Extract<DestinationTunnelServerMessage, {
73
178
  type: 'ready';
74
179
  }>): void;
@@ -1 +1 @@
1
- {"version":3,"file":"destination-tunnel.d.mts","sourceRoot":"","sources":["src/destination-tunnel.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAC5C,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAChD,eAA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6B,CAoB/B;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,OAAO,CAAC,8BAA8B,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,GAClE,IAAI,CAIN;AAED,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,8BAA8B,GAAG,MAAM,CAqDpG;AAED,wBAAgB,oCAAoC,CAAC,KAAK,EAAE,OAAO,GAAG,8BAA8B,CA6CnG"}
@@ -1,20 +1,87 @@
1
+ export { DestinationTunnelProtocolError } from "./internal/destination-tunnel-wire-reader.js";
1
2
  export declare const DESTINATION_TUNNEL_VERSION = 1;
2
3
  export declare const DESTINATION_TUNNEL_MAX_ROUTES = 10;
4
+ export declare const DESTINATION_TUNNEL_MAX_DOMAINS = 64;
3
5
  export declare const DESTINATION_TUNNEL_CONN_ID_HEADER_BYTES = 4;
6
+ /**
7
+ * IPv4 range used by the device side for synthetic (fake) DNS answers of
8
+ * matched domain selectors.
9
+ */
10
+ export declare const DESTINATION_TUNNEL_FAKE_RANGE = "198.18.0.0/15";
11
+ /** Upper bound for per-flow receive windows advertised in open/openOk. */
12
+ export declare const DESTINATION_TUNNEL_MAX_WINDOW: number;
13
+ /** Default receive window advertised by generic SDK tunnel clients. */
14
+ export declare const DESTINATION_TUNNEL_DEFAULT_WINDOW: number;
15
+ /** Upper bound for a single windowUpdate increment. */
16
+ export declare const DESTINATION_TUNNEL_MAX_WINDOW_INCREMENT = 2147483647;
17
+ export declare const DESTINATION_TUNNEL_DEFAULT_MAX_BODY_BYTES: number;
18
+ export declare const DESTINATION_TUNNEL_MAX_BODY_BYTES: number;
19
+ export declare const DESTINATION_TUNNEL_DEFAULT_TTL_SECONDS: number;
20
+ export declare const DESTINATION_TUNNEL_MAX_TTL_SECONDS: number;
4
21
  export interface DestinationTunnelRoute {
5
22
  host: string;
6
23
  port: number;
7
24
  }
8
- export type DestinationTunnelOpenFailureReason = 'dns_not_found' | 'dns_temporary_failure' | 'connection_refused' | 'connection_reset' | 'connection_timed_out' | 'unreachable' | 'permission_denied' | 'resource_exhausted' | 'route_not_allowed' | 'cancelled' | 'internal' | (string & {});
25
+ /** Canonical selector values carried by the public protocol. */
26
+ export type DestinationTunnelSelectors = string[];
27
+ /** Internal classification used to enforce and dial canonical selectors. */
28
+ export interface DestinationTunnelSelectorCatalog {
29
+ routes?: DestinationTunnelRoute[];
30
+ domains?: string[];
31
+ }
32
+ export interface DestinationTunnelInspectionConfig {
33
+ enabled: boolean;
34
+ captureBodies: boolean;
35
+ maxBodyBytes: number;
36
+ persist: boolean;
37
+ ttlSeconds: number;
38
+ }
39
+ export type DestinationTunnelTransportType = 'tcp' | 'tls';
40
+ export type DestinationTunnelTransportRequest = {
41
+ type: 'tcp';
42
+ } | {
43
+ type: 'tls';
44
+ serverName: string;
45
+ alpnProtocols: string[];
46
+ };
47
+ export interface DestinationTunnelTransportResult {
48
+ type: DestinationTunnelTransportType;
49
+ alpnProtocol?: string;
50
+ remoteAddress?: string;
51
+ dnsMs?: number;
52
+ connectMs?: number;
53
+ tlsMs?: number;
54
+ }
55
+ export type DestinationTunnelSelectorKind = 'route' | 'domain';
56
+ export type DestinationTunnelBindStatus = 'ok' | 'conflict' | 'error';
57
+ /** Per-address bind outcome the device server reports for exact routes. */
58
+ export interface DestinationTunnelBindReport {
59
+ address: string;
60
+ status: DestinationTunnelBindStatus;
61
+ osCode?: string;
62
+ }
63
+ /** Normalized selector the server acknowledges in `ready` and status. */
64
+ export interface DestinationTunnelSelectorReport {
65
+ id: string;
66
+ kind: DestinationTunnelSelectorKind;
67
+ value: string;
68
+ binds?: DestinationTunnelBindReport[];
69
+ }
70
+ export type DestinationTunnelOpenFailureReason = 'dns_not_found' | 'dns_temporary_failure' | 'connection_refused' | 'connection_reset' | 'connection_timed_out' | 'unreachable' | 'permission_denied' | 'resource_exhausted' | 'selector_not_allowed' | 'tls_handshake_failed' | 'tls_validation_failed' | 'tls_protocol_error' | 'cancelled' | 'internal' | (string & {});
9
71
  export type DestinationTunnelResetReason = 'cancelled' | 'connection_error' | 'protocol_error' | 'resource_exhausted' | 'internal' | (string & {});
10
- export type DestinationTunnelSessionErrorCode = 'unsupported_version' | 'invalid_message' | 'invalid_route' | 'route_capacity' | 'already_active' | 'unavailable' | 'internal' | (string & {});
72
+ export type DestinationTunnelSessionErrorCode = 'unsupported_version' | 'invalid_message' | 'invalid_selector' | 'already_active' | 'unavailable' | 'internal' | (string & {});
11
73
  export type DestinationTunnelClientMessage = {
12
74
  type: 'start';
13
75
  version: number;
14
- routes: DestinationTunnelRoute[];
76
+ selectors: DestinationTunnelSelectors;
77
+ inspection: DestinationTunnelInspectionConfig;
78
+ /** Default per-flow receive window this client grants. */
79
+ window: number;
15
80
  } | {
16
81
  type: 'openOk';
17
82
  connId: number;
83
+ transport: DestinationTunnelTransportResult;
84
+ window: number;
18
85
  } | {
19
86
  type: 'openFail';
20
87
  connId: number;
@@ -28,18 +95,26 @@ export type DestinationTunnelClientMessage = {
28
95
  connId: number;
29
96
  reason: DestinationTunnelResetReason;
30
97
  osCode?: string;
98
+ } | {
99
+ type: 'windowUpdate';
100
+ connId: number;
101
+ increment: number;
31
102
  };
32
103
  export type DestinationTunnelServerMessage = {
33
104
  type: 'ready';
34
105
  version: number;
35
106
  tunnelId: string;
107
+ selectors: DestinationTunnelSelectorReport[];
108
+ configHash: string;
36
109
  } | {
37
110
  type: 'open';
38
111
  connId: number;
39
- routeId: string;
112
+ selectorId: string;
40
113
  host: string;
41
114
  port: number;
42
- proto: 'tcp';
115
+ transport: DestinationTunnelTransportRequest;
116
+ /** Server's receive window for this flow. */
117
+ window: number;
43
118
  } | {
44
119
  type: 'fin';
45
120
  connId: number;
@@ -48,27 +123,57 @@ export type DestinationTunnelServerMessage = {
48
123
  connId: number;
49
124
  reason: DestinationTunnelResetReason;
50
125
  osCode?: string;
126
+ } | {
127
+ type: 'windowUpdate';
128
+ connId: number;
129
+ increment: number;
51
130
  } | {
52
131
  type: 'error';
53
132
  code: DestinationTunnelSessionErrorCode;
54
133
  };
55
- export type DestinationTunnelRouteErrorCode = 'empty' | 'too_many' | 'invalid_host' | 'invalid_port' | 'duplicate';
56
- export declare class DestinationTunnelRouteError extends Error {
57
- readonly code: DestinationTunnelRouteErrorCode;
58
- constructor(code: DestinationTunnelRouteErrorCode, message: string);
59
- }
60
- export declare class DestinationTunnelProtocolError extends Error {
61
- constructor(message: string);
134
+ export type DestinationTunnelSelectorErrorCode = 'empty' | 'too_many' | 'invalid_host' | 'invalid_port' | 'invalid_domain' | 'duplicate';
135
+ export declare class DestinationTunnelSelectorError extends Error {
136
+ readonly code: DestinationTunnelSelectorErrorCode;
137
+ constructor(code: DestinationTunnelSelectorErrorCode, message: string);
62
138
  }
63
139
  export declare function encodeDestinationTunnelDataFrame(connId: number, payload: Buffer): Buffer;
64
140
  export declare function decodeDestinationTunnelDataFrame(frame: Buffer): {
65
141
  connId: number;
66
142
  payload: Buffer;
67
143
  };
68
- export declare function validateDestinationTunnelRoutes(routes: readonly DestinationTunnelRoute[]): DestinationTunnelRoute[];
144
+ export declare function validateDestinationTunnelRoutes(routes: readonly DestinationTunnelRoute[], options?: {
145
+ minPort?: number;
146
+ }): DestinationTunnelRoute[];
147
+ /**
148
+ * Validate and canonicalize a full selector set. Selector policy specific to
149
+ * one product (such as the Android bind-listener minimum route port) is
150
+ * expressed via options rather than separate message shapes.
151
+ */
152
+ export declare function validateDestinationTunnelSelectors(selectors: readonly string[], options?: {
153
+ minRoutePort?: number;
154
+ }): DestinationTunnelSelectors;
155
+ export declare function classifyDestinationTunnelSelectors(selectors: readonly string[], options?: {
156
+ minRoutePort?: number;
157
+ }): DestinationTunnelSelectorCatalog;
158
+ export declare function validateDestinationTunnelDomains(domains: readonly string[]): string[];
159
+ /**
160
+ * Deterministic hash of the canonical selector configuration. Servers echo it
161
+ * in `ready` so clients can detect config mismatches across reconnects. The
162
+ * hashed JSON has fixed key order.
163
+ */
164
+ export declare function destinationTunnelConfigHash(selectors: DestinationTunnelSelectors, inspection?: DestinationTunnelInspectionConfig): string;
165
+ export declare function normalizeDestinationTunnelInspection(inspection: Partial<DestinationTunnelInspectionConfig>): DestinationTunnelInspectionConfig;
166
+ export declare function disabledDestinationTunnelInspection(): DestinationTunnelInspectionConfig;
167
+ /** Selector IDs are one-based positions in the canonical selector array. */
168
+ export declare function destinationTunnelSelectorIds(selectors: DestinationTunnelSelectors): string[];
169
+ export declare function destinationTunnelDomainMatches(pattern: string, host: string): boolean;
170
+ /**
171
+ * Verify a server OPEN against the negotiated selectors. Every OPEN must name
172
+ * a known selector ID and a target that the selector actually covers.
173
+ */
69
174
  export declare function assertDestinationTunnelOpenAllowed(message: Extract<DestinationTunnelServerMessage, {
70
175
  type: 'open';
71
- }>, routes: readonly DestinationTunnelRoute[]): void;
176
+ }>, selectors: DestinationTunnelSelectors): DestinationTunnelSelectorKind;
72
177
  export declare function assertDestinationTunnelReady(message: Extract<DestinationTunnelServerMessage, {
73
178
  type: 'ready';
74
179
  }>): void;
@@ -1 +1 @@
1
- {"version":3,"file":"destination-tunnel.d.ts","sourceRoot":"","sources":["src/destination-tunnel.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAC5C,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAChD,eAAO,MAAM,uCAAuC,IAAI,CAAC;AAEzD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,kCAAkC,GAC1C,eAAe,GACf,uBAAuB,GACvB,oBAAoB,GACpB,kBAAkB,GAClB,sBAAsB,GACtB,aAAa,GACb,mBAAmB,GACnB,oBAAoB,GACpB,mBAAmB,GACnB,WAAW,GACX,UAAU,GACV,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,MAAM,MAAM,4BAA4B,GACpC,WAAW,GACX,kBAAkB,GAClB,gBAAgB,GAChB,oBAAoB,GACpB,UAAU,GACV,CAAC,MAAM,G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