@eric8810/catcher-napi-http
Advanced tools
+7
-0
@@ -23,2 +23,9 @@ import { HttpClientConfig, RequestOptions, HttpResponse as JsHttpResponse, Metrics as JsMetrics, StreamEvent } from './types.js'; | ||
| disableAdaptiveTimeout(): void; | ||
| /** | ||
| * 通知客户端网络环境已变化(WiFi 切换 / VPN 换节点 / 蜂窝切换等)。 | ||
| * | ||
| * 清空 DNS 缓存、重建连接池(丢弃可能半开的 keep-alive 连接)、重置 | ||
| * 熔断器 — 新请求立即走新网络上的全新连接。飞行中的请求不受影响。 | ||
| */ | ||
| networkChanged(): void; | ||
| cancelAll(): void; | ||
@@ -25,0 +32,0 @@ cancelRequest(requestId: number): boolean; |
+12
-0
@@ -140,2 +140,14 @@ "use strict"; | ||
| } | ||
| /** | ||
| * 通知客户端网络环境已变化(WiFi 切换 / VPN 换节点 / 蜂窝切换等)。 | ||
| * | ||
| * 清空 DNS 缓存、重建连接池(丢弃可能半开的 keep-alive 连接)、重置 | ||
| * 熔断器 — 新请求立即走新网络上的全新连接。飞行中的请求不受影响。 | ||
| */ | ||
| networkChanged() { | ||
| if (!this._raw.networkChanged) { | ||
| throw new Error("networkChanged() requires rebuilt native addon (cargo build)"); | ||
| } | ||
| this._raw.networkChanged(); | ||
| } | ||
| cancelAll() { | ||
@@ -142,0 +154,0 @@ this._raw.cancelAll(); |
+5
-1
@@ -77,2 +77,4 @@ /* tslint:disable */ | ||
| interface DnsConfig { | ||
| /** DNS 模式。默认: 'catcher'。仅显式 native 时使用协议库原生解析。 */ | ||
| mode?: 'catcher' | 'native'; | ||
| /** 缓存条目数上限。默认: 512 */ | ||
@@ -92,2 +94,4 @@ cache_size?: number; | ||
| host_mapping?: Record<string, string>; | ||
| /** 读取系统 DNS 失败时是否退回默认 DNS。默认: false */ | ||
| fallback_to_default_nameservers?: boolean; | ||
| } | ||
@@ -129,3 +133,3 @@ /** 退避策略 */ | ||
| interface ProxyConfig { | ||
| /** 代理 URL: "http://host:port" | "https://host:port" | "socks5://host:port" */ | ||
| /** 代理 URL。Catcher 会把 socks5:// 按 socks5h:// 处理,避免代理场景提前本地解析域名。 */ | ||
| url: string; | ||
@@ -132,0 +136,0 @@ auth?: ProxyAuth; |
+10
-0
@@ -65,2 +65,12 @@ /* tslint:disable */ | ||
| disableAdaptiveTimeout(): void | ||
| /** | ||
| * Notify the client that the network environment changed | ||
| * (WiFi switch, VPN node change, cellular handover, ...). | ||
| * | ||
| * Clears the DNS cache, rebuilds the connection pool (dropping all | ||
| * possibly half-open keep-alive sockets) and resets the circuit breaker, | ||
| * so new requests immediately use fresh connections on the new network. | ||
| * In-flight requests are unaffected. | ||
| */ | ||
| networkChanged(): void | ||
| /** Cancel all in-flight requests. */ | ||
@@ -67,0 +77,0 @@ cancelAll(): void |
+9
-9
| { | ||
| "name": "@eric8810/catcher-napi-http", | ||
| "version": "0.3.12", | ||
| "version": "0.3.13", | ||
| "description": "catcher HTTP native addon for Node.js via napi-rs", | ||
@@ -59,11 +59,11 @@ "main": "dist/client.js", | ||
| "optionalDependencies": { | ||
| "@eric8810/catcher-napi-http-win32-x64-msvc": "0.3.12", | ||
| "@eric8810/catcher-napi-http-darwin-x64": "0.3.12", | ||
| "@eric8810/catcher-napi-http-linux-x64-gnu": "0.3.12", | ||
| "@eric8810/catcher-napi-http-darwin-arm64": "0.3.12", | ||
| "@eric8810/catcher-napi-http-linux-x64-musl": "0.3.12", | ||
| "@eric8810/catcher-napi-http-linux-arm64-gnu": "0.3.12", | ||
| "@eric8810/catcher-napi-http-linux-arm64-musl": "0.3.12", | ||
| "@eric8810/catcher-napi-http-win32-arm64-msvc": "0.3.12" | ||
| "@eric8810/catcher-napi-http-win32-x64-msvc": "0.3.13", | ||
| "@eric8810/catcher-napi-http-darwin-x64": "0.3.13", | ||
| "@eric8810/catcher-napi-http-linux-x64-gnu": "0.3.13", | ||
| "@eric8810/catcher-napi-http-darwin-arm64": "0.3.13", | ||
| "@eric8810/catcher-napi-http-linux-x64-musl": "0.3.13", | ||
| "@eric8810/catcher-napi-http-linux-arm64-gnu": "0.3.13", | ||
| "@eric8810/catcher-napi-http-linux-arm64-musl": "0.3.13", | ||
| "@eric8810/catcher-napi-http-win32-arm64-msvc": "0.3.13" | ||
| } | ||
| } |
+2
-0
@@ -56,2 +56,3 @@ # @eric8810/catcher-napi-http | ||
| dns: { | ||
| mode: 'catcher', | ||
| cache_size: 512, | ||
@@ -131,2 +132,3 @@ cache_ttl_secs: 300, | ||
| interface DnsConfig { | ||
| mode?: 'catcher' | 'native' // default: 'catcher' | ||
| cache_size?: number // default: 512 | ||
@@ -133,0 +135,0 @@ cache_ttl_secs?: number // default: 300 |
36385
4.7%702
4.93%246
0.82%