@maiyunnet/kebab 9.2.4 → 9.2.6
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/doc/kebab-rag.md +47 -47
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/undici/response.js +1 -6
- package/lib/undici.js +23 -5
- package/package.json +1 -1
package/doc/kebab-rag.md
CHANGED
|
@@ -1360,7 +1360,7 @@ index/variables/VER.md
|
|
|
1360
1360
|
|
|
1361
1361
|
# Variable: VER
|
|
1362
1362
|
|
|
1363
|
-
> `const` **VER**: `"9.2.
|
|
1363
|
+
> `const` **VER**: `"9.2.6"` = `'9.2.6'`
|
|
1364
1364
|
|
|
1365
1365
|
Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
|
|
1366
1366
|
|
|
@@ -17766,7 +17766,7 @@ lib/undici/functions/fetch.md
|
|
|
17766
17766
|
|
|
17767
17767
|
> **fetch**(`input`, `init?`): `Promise`\<`Response`\>
|
|
17768
17768
|
|
|
17769
|
-
Defined in: [lib/undici.ts:
|
|
17769
|
+
Defined in: [lib/undici.ts:175](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L175)
|
|
17770
17770
|
|
|
17771
17771
|
发起一个完全兼容 fetch 的请求
|
|
17772
17772
|
|
|
@@ -17801,7 +17801,7 @@ lib/undici/functions/filterHeaders.md
|
|
|
17801
17801
|
|
|
17802
17802
|
> **filterHeaders**(`headers`, `res?`, `filter?`): `Record`\<`string`, `string` \| `string`[]\>
|
|
17803
17803
|
|
|
17804
|
-
Defined in: [lib/undici.ts:
|
|
17804
|
+
Defined in: [lib/undici.ts:530](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L530)
|
|
17805
17805
|
|
|
17806
17806
|
剔除不代理的 header,返回新的 header
|
|
17807
17807
|
|
|
@@ -17842,7 +17842,7 @@ lib/undici/functions/getFormData.md
|
|
|
17842
17842
|
|
|
17843
17843
|
> **getFormData**(): [`FormData`](../formdata/classes/FormData.md)
|
|
17844
17844
|
|
|
17845
|
-
Defined in: [lib/undici.ts:
|
|
17845
|
+
Defined in: [lib/undici.ts:514](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L514)
|
|
17846
17846
|
|
|
17847
17847
|
创建 FormData 对象
|
|
17848
17848
|
|
|
@@ -17863,7 +17863,7 @@ lib/undici/functions/get.md
|
|
|
17863
17863
|
|
|
17864
17864
|
> **get**(`u`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
17865
17865
|
|
|
17866
|
-
Defined in: [lib/undici.ts:
|
|
17866
|
+
Defined in: [lib/undici.ts:89](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L89)
|
|
17867
17867
|
|
|
17868
17868
|
发起一个 get 请求
|
|
17869
17869
|
|
|
@@ -17898,7 +17898,7 @@ lib/undici/functions/getProxyAgent.md
|
|
|
17898
17898
|
|
|
17899
17899
|
> **getProxyAgent**(`url`): `ProxyAgent`
|
|
17900
17900
|
|
|
17901
|
-
Defined in: [lib/undici.ts:
|
|
17901
|
+
Defined in: [lib/undici.ts:20](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L20)
|
|
17902
17902
|
|
|
17903
17903
|
获取代理 agent
|
|
17904
17904
|
|
|
@@ -17925,7 +17925,7 @@ lib/undici/functions/getResponseJson.md
|
|
|
17925
17925
|
|
|
17926
17926
|
> **getResponseJson**(`u`, `opt?`): `Promise`\<`any`\>
|
|
17927
17927
|
|
|
17928
|
-
Defined in: [lib/undici.ts:
|
|
17928
|
+
Defined in: [lib/undici.ts:154](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L154)
|
|
17929
17929
|
|
|
17930
17930
|
发起 GET 请求并解析 JSON 响应
|
|
17931
17931
|
|
|
@@ -17962,7 +17962,7 @@ lib/undici/functions/mproxyData.md
|
|
|
17962
17962
|
|
|
17963
17963
|
> **mproxyData**(`ctr`): `any`
|
|
17964
17964
|
|
|
17965
|
-
Defined in: [lib/undici.ts:
|
|
17965
|
+
Defined in: [lib/undici.ts:619](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L619)
|
|
17966
17966
|
|
|
17967
17967
|
获取 mproxy 的附加数据
|
|
17968
17968
|
|
|
@@ -17991,7 +17991,7 @@ lib/undici/functions/mproxy.md
|
|
|
17991
17991
|
|
|
17992
17992
|
> **mproxy**(`ctr`, `auth`, `opt?`): `Promise`\<`number`\>
|
|
17993
17993
|
|
|
17994
|
-
Defined in: [lib/undici.ts:
|
|
17994
|
+
Defined in: [lib/undici.ts:566](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L566)
|
|
17995
17995
|
|
|
17996
17996
|
正向 mproxy 代理,注意提前处理不要自动处理 post 数据,读取 get 的 url 为实际请求地址
|
|
17997
17997
|
get: url, auth
|
|
@@ -18033,7 +18033,7 @@ lib/undici/functions/open.md
|
|
|
18033
18033
|
|
|
18034
18034
|
> **open**(`u`): [`Request`](../request/classes/Request.md)
|
|
18035
18035
|
|
|
18036
|
-
Defined in: [lib/undici.ts:
|
|
18036
|
+
Defined in: [lib/undici.ts:80](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L80)
|
|
18037
18037
|
|
|
18038
18038
|
创建一个请求对象
|
|
18039
18039
|
|
|
@@ -18060,7 +18060,7 @@ lib/undici/functions/postJson.md
|
|
|
18060
18060
|
|
|
18061
18061
|
> **postJson**(`u`, `data`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
18062
18062
|
|
|
18063
|
-
Defined in: [lib/undici.ts:
|
|
18063
|
+
Defined in: [lib/undici.ts:114](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L114)
|
|
18064
18064
|
|
|
18065
18065
|
发起 JSON 请求
|
|
18066
18066
|
|
|
@@ -18101,7 +18101,7 @@ lib/undici/functions/postJsonResponseJson.md
|
|
|
18101
18101
|
|
|
18102
18102
|
> **postJsonResponseJson**(`u`, `data`, `opt?`): `Promise`\<`any`\>
|
|
18103
18103
|
|
|
18104
|
-
Defined in: [lib/undici.ts:
|
|
18104
|
+
Defined in: [lib/undici.ts:131](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L131)
|
|
18105
18105
|
|
|
18106
18106
|
发起 JSON 请求并解析 JSON 响应
|
|
18107
18107
|
|
|
@@ -18144,7 +18144,7 @@ lib/undici/functions/post.md
|
|
|
18144
18144
|
|
|
18145
18145
|
> **post**(`u`, `data`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
18146
18146
|
|
|
18147
|
-
Defined in: [lib/undici.ts:
|
|
18147
|
+
Defined in: [lib/undici.ts:99](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L99)
|
|
18148
18148
|
|
|
18149
18149
|
发起一个 post 请求
|
|
18150
18150
|
|
|
@@ -18185,7 +18185,7 @@ lib/undici/functions/request.md
|
|
|
18185
18185
|
|
|
18186
18186
|
> **request**(`u`, `data?`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
18187
18187
|
|
|
18188
|
-
Defined in: [lib/undici.ts:
|
|
18188
|
+
Defined in: [lib/undici.ts:344](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L344)
|
|
18189
18189
|
|
|
18190
18190
|
发起一个请求
|
|
18191
18191
|
|
|
@@ -18222,7 +18222,7 @@ lib/undici/functions/rproxy.md
|
|
|
18222
18222
|
|
|
18223
18223
|
> **rproxy**(`ctr`, `route`, `opt?`): `Promise`\<`boolean`\>
|
|
18224
18224
|
|
|
18225
|
-
Defined in: [lib/undici.ts:
|
|
18225
|
+
Defined in: [lib/undici.ts:637](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L637)
|
|
18226
18226
|
|
|
18227
18227
|
反向代理,注意提前处理不要自动处理 post 数据,将本服务器的某个路由反代到其他网址
|
|
18228
18228
|
|
|
@@ -18299,7 +18299,7 @@ lib/undici/interfaces/IMproxyOptions.md
|
|
|
18299
18299
|
|
|
18300
18300
|
# Interface: IMproxyOptions
|
|
18301
18301
|
|
|
18302
|
-
Defined in: [lib/undici.ts:
|
|
18302
|
+
Defined in: [lib/undici.ts:721](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L721)
|
|
18303
18303
|
|
|
18304
18304
|
正向代理请求的传入参数选项
|
|
18305
18305
|
|
|
@@ -18309,7 +18309,7 @@ Defined in: [lib/undici.ts:703](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18309
18309
|
|
|
18310
18310
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
18311
18311
|
|
|
18312
|
-
Defined in: [lib/undici.ts:
|
|
18312
|
+
Defined in: [lib/undici.ts:730](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L730)
|
|
18313
18313
|
|
|
18314
18314
|
过滤 header,返回 true 则留下
|
|
18315
18315
|
|
|
@@ -18329,7 +18329,7 @@ Defined in: [lib/undici.ts:712](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18329
18329
|
|
|
18330
18330
|
> `optional` **follow?**: `number`
|
|
18331
18331
|
|
|
18332
|
-
Defined in: [lib/undici.ts:
|
|
18332
|
+
Defined in: [lib/undici.ts:724](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L724)
|
|
18333
18333
|
|
|
18334
18334
|
***
|
|
18335
18335
|
|
|
@@ -18337,7 +18337,7 @@ Defined in: [lib/undici.ts:706](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18337
18337
|
|
|
18338
18338
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
18339
18339
|
|
|
18340
|
-
Defined in: [lib/undici.ts:
|
|
18340
|
+
Defined in: [lib/undici.ts:728](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L728)
|
|
18341
18341
|
|
|
18342
18342
|
***
|
|
18343
18343
|
|
|
@@ -18345,7 +18345,7 @@ Defined in: [lib/undici.ts:710](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18345
18345
|
|
|
18346
18346
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
18347
18347
|
|
|
18348
|
-
Defined in: [lib/undici.ts:
|
|
18348
|
+
Defined in: [lib/undici.ts:726](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L726)
|
|
18349
18349
|
|
|
18350
18350
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
18351
18351
|
|
|
@@ -18355,7 +18355,7 @@ Defined in: [lib/undici.ts:708](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18355
18355
|
|
|
18356
18356
|
> `optional` **local?**: `string`
|
|
18357
18357
|
|
|
18358
|
-
Defined in: [lib/undici.ts:
|
|
18358
|
+
Defined in: [lib/undici.ts:727](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L727)
|
|
18359
18359
|
|
|
18360
18360
|
***
|
|
18361
18361
|
|
|
@@ -18363,7 +18363,7 @@ Defined in: [lib/undici.ts:709](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18363
18363
|
|
|
18364
18364
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
18365
18365
|
|
|
18366
|
-
Defined in: [lib/undici.ts:
|
|
18366
|
+
Defined in: [lib/undici.ts:732](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L732)
|
|
18367
18367
|
|
|
18368
18368
|
默认为 default
|
|
18369
18369
|
|
|
@@ -18373,7 +18373,7 @@ Defined in: [lib/undici.ts:714](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18373
18373
|
|
|
18374
18374
|
> `optional` **timeout?**: `number`
|
|
18375
18375
|
|
|
18376
|
-
Defined in: [lib/undici.ts:
|
|
18376
|
+
Defined in: [lib/undici.ts:723](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L723)
|
|
18377
18377
|
|
|
18378
18378
|
秒数
|
|
18379
18379
|
|
|
@@ -18388,7 +18388,7 @@ lib/undici/interfaces/IRequestOptions.md
|
|
|
18388
18388
|
|
|
18389
18389
|
# Interface: IRequestOptions
|
|
18390
18390
|
|
|
18391
|
-
Defined in: [lib/undici.ts:
|
|
18391
|
+
Defined in: [lib/undici.ts:690](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L690)
|
|
18392
18392
|
|
|
18393
18393
|
请求的传入参数选项
|
|
18394
18394
|
|
|
@@ -18398,7 +18398,7 @@ Defined in: [lib/undici.ts:672](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18398
18398
|
|
|
18399
18399
|
> `optional` **cookie?**: `Record`\<`string`, [`ICookie`](../../cookie/interfaces/ICookie.md)\>
|
|
18400
18400
|
|
|
18401
|
-
Defined in: [lib/undici.ts:
|
|
18401
|
+
Defined in: [lib/undici.ts:715](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L715)
|
|
18402
18402
|
|
|
18403
18403
|
cookie 托管对象
|
|
18404
18404
|
|
|
@@ -18408,7 +18408,7 @@ cookie 托管对象
|
|
|
18408
18408
|
|
|
18409
18409
|
> `optional` **follow?**: `number`
|
|
18410
18410
|
|
|
18411
|
-
Defined in: [lib/undici.ts:
|
|
18411
|
+
Defined in: [lib/undici.ts:696](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L696)
|
|
18412
18412
|
|
|
18413
18413
|
追踪 location 次数,0 为不追踪,默认为 0
|
|
18414
18414
|
|
|
@@ -18418,7 +18418,7 @@ Defined in: [lib/undici.ts:678](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18418
18418
|
|
|
18419
18419
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
18420
18420
|
|
|
18421
|
-
Defined in: [lib/undici.ts:
|
|
18421
|
+
Defined in: [lib/undici.ts:701](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L701)
|
|
18422
18422
|
|
|
18423
18423
|
***
|
|
18424
18424
|
|
|
@@ -18426,7 +18426,7 @@ Defined in: [lib/undici.ts:683](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18426
18426
|
|
|
18427
18427
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
18428
18428
|
|
|
18429
|
-
Defined in: [lib/undici.ts:
|
|
18429
|
+
Defined in: [lib/undici.ts:698](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L698)
|
|
18430
18430
|
|
|
18431
18431
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
18432
18432
|
|
|
@@ -18436,7 +18436,7 @@ Defined in: [lib/undici.ts:680](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18436
18436
|
|
|
18437
18437
|
> `optional` **keep?**: `boolean`
|
|
18438
18438
|
|
|
18439
|
-
Defined in: [lib/undici.ts:
|
|
18439
|
+
Defined in: [lib/undici.ts:711](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L711)
|
|
18440
18440
|
|
|
18441
18441
|
连接是否保持长连接(即是否允许复用),默认为 true
|
|
18442
18442
|
|
|
@@ -18446,7 +18446,7 @@ Defined in: [lib/undici.ts:693](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18446
18446
|
|
|
18447
18447
|
> `optional` **local?**: `string`
|
|
18448
18448
|
|
|
18449
|
-
Defined in: [lib/undici.ts:
|
|
18449
|
+
Defined in: [lib/undici.ts:700](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L700)
|
|
18450
18450
|
|
|
18451
18451
|
***
|
|
18452
18452
|
|
|
@@ -18454,7 +18454,7 @@ Defined in: [lib/undici.ts:682](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18454
18454
|
|
|
18455
18455
|
> `optional` **log?**: `boolean`
|
|
18456
18456
|
|
|
18457
|
-
Defined in: [lib/undici.ts:
|
|
18457
|
+
Defined in: [lib/undici.ts:717](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L717)
|
|
18458
18458
|
|
|
18459
18459
|
若有异常写入文件日志,默认为 true
|
|
18460
18460
|
|
|
@@ -18464,7 +18464,7 @@ Defined in: [lib/undici.ts:699](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18464
18464
|
|
|
18465
18465
|
> `optional` **method?**: `"GET"` \| `"POST"` \| `"PUT"` \| `"DELETE"` \| `"OPTIONS"`
|
|
18466
18466
|
|
|
18467
|
-
Defined in: [lib/undici.ts:
|
|
18467
|
+
Defined in: [lib/undici.ts:691](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L691)
|
|
18468
18468
|
|
|
18469
18469
|
***
|
|
18470
18470
|
|
|
@@ -18472,7 +18472,7 @@ Defined in: [lib/undici.ts:673](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18472
18472
|
|
|
18473
18473
|
> `optional` **mproxy?**: `object`
|
|
18474
18474
|
|
|
18475
|
-
Defined in: [lib/undici.ts:
|
|
18475
|
+
Defined in: [lib/undici.ts:703](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L703)
|
|
18476
18476
|
|
|
18477
18477
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
18478
18478
|
|
|
@@ -18500,7 +18500,7 @@ Defined in: [lib/undici.ts:685](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18500
18500
|
|
|
18501
18501
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
18502
18502
|
|
|
18503
|
-
Defined in: [lib/undici.ts:
|
|
18503
|
+
Defined in: [lib/undici.ts:713](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L713)
|
|
18504
18504
|
|
|
18505
18505
|
复用池名/Agent,默认为 default
|
|
18506
18506
|
|
|
@@ -18510,7 +18510,7 @@ Defined in: [lib/undici.ts:695](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18510
18510
|
|
|
18511
18511
|
> `optional` **save?**: `string`
|
|
18512
18512
|
|
|
18513
|
-
Defined in: [lib/undici.ts:
|
|
18513
|
+
Defined in: [lib/undici.ts:699](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L699)
|
|
18514
18514
|
|
|
18515
18515
|
***
|
|
18516
18516
|
|
|
@@ -18518,7 +18518,7 @@ Defined in: [lib/undici.ts:681](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18518
18518
|
|
|
18519
18519
|
> `optional` **timeout?**: `number`
|
|
18520
18520
|
|
|
18521
|
-
Defined in: [lib/undici.ts:
|
|
18521
|
+
Defined in: [lib/undici.ts:694](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L694)
|
|
18522
18522
|
|
|
18523
18523
|
秒数,默认 10 秒
|
|
18524
18524
|
|
|
@@ -18528,7 +18528,7 @@ Defined in: [lib/undici.ts:676](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18528
18528
|
|
|
18529
18529
|
> `optional` **type?**: `"form"` \| `"json"`
|
|
18530
18530
|
|
|
18531
|
-
Defined in: [lib/undici.ts:
|
|
18531
|
+
Defined in: [lib/undici.ts:692](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L692)
|
|
18532
18532
|
|
|
18533
18533
|
lib/undici/interfaces/IRproxyOptions.md
|
|
18534
18534
|
---
|
|
@@ -18541,7 +18541,7 @@ lib/undici/interfaces/IRproxyOptions.md
|
|
|
18541
18541
|
|
|
18542
18542
|
# Interface: IRproxyOptions
|
|
18543
18543
|
|
|
18544
|
-
Defined in: [lib/undici.ts:
|
|
18544
|
+
Defined in: [lib/undici.ts:736](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L736)
|
|
18545
18545
|
|
|
18546
18546
|
反向代理请求的传入参数选项
|
|
18547
18547
|
|
|
@@ -18551,7 +18551,7 @@ Defined in: [lib/undici.ts:718](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18551
18551
|
|
|
18552
18552
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
18553
18553
|
|
|
18554
|
-
Defined in: [lib/undici.ts:
|
|
18554
|
+
Defined in: [lib/undici.ts:745](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L745)
|
|
18555
18555
|
|
|
18556
18556
|
过滤 header,返回 true 则留下
|
|
18557
18557
|
|
|
@@ -18571,7 +18571,7 @@ Defined in: [lib/undici.ts:727](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18571
18571
|
|
|
18572
18572
|
> `optional` **follow?**: `number`
|
|
18573
18573
|
|
|
18574
|
-
Defined in: [lib/undici.ts:
|
|
18574
|
+
Defined in: [lib/undici.ts:739](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L739)
|
|
18575
18575
|
|
|
18576
18576
|
***
|
|
18577
18577
|
|
|
@@ -18579,7 +18579,7 @@ Defined in: [lib/undici.ts:721](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18579
18579
|
|
|
18580
18580
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
18581
18581
|
|
|
18582
|
-
Defined in: [lib/undici.ts:
|
|
18582
|
+
Defined in: [lib/undici.ts:743](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L743)
|
|
18583
18583
|
|
|
18584
18584
|
***
|
|
18585
18585
|
|
|
@@ -18587,7 +18587,7 @@ Defined in: [lib/undici.ts:725](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18587
18587
|
|
|
18588
18588
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
18589
18589
|
|
|
18590
|
-
Defined in: [lib/undici.ts:
|
|
18590
|
+
Defined in: [lib/undici.ts:741](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L741)
|
|
18591
18591
|
|
|
18592
18592
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
18593
18593
|
|
|
@@ -18597,7 +18597,7 @@ Defined in: [lib/undici.ts:723](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18597
18597
|
|
|
18598
18598
|
> `optional` **local?**: `string`
|
|
18599
18599
|
|
|
18600
|
-
Defined in: [lib/undici.ts:
|
|
18600
|
+
Defined in: [lib/undici.ts:742](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L742)
|
|
18601
18601
|
|
|
18602
18602
|
***
|
|
18603
18603
|
|
|
@@ -18605,7 +18605,7 @@ Defined in: [lib/undici.ts:724](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18605
18605
|
|
|
18606
18606
|
> `optional` **mproxy?**: `object`
|
|
18607
18607
|
|
|
18608
|
-
Defined in: [lib/undici.ts:
|
|
18608
|
+
Defined in: [lib/undici.ts:747](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L747)
|
|
18609
18609
|
|
|
18610
18610
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
18611
18611
|
|
|
@@ -18633,7 +18633,7 @@ Defined in: [lib/undici.ts:729](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18633
18633
|
|
|
18634
18634
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
18635
18635
|
|
|
18636
|
-
Defined in: [lib/undici.ts:
|
|
18636
|
+
Defined in: [lib/undici.ts:755](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L755)
|
|
18637
18637
|
|
|
18638
18638
|
默认为 default
|
|
18639
18639
|
|
|
@@ -18643,7 +18643,7 @@ Defined in: [lib/undici.ts:737](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18643
18643
|
|
|
18644
18644
|
> `optional` **timeout?**: `number`
|
|
18645
18645
|
|
|
18646
|
-
Defined in: [lib/undici.ts:
|
|
18646
|
+
Defined in: [lib/undici.ts:738](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L738)
|
|
18647
18647
|
|
|
18648
18648
|
秒数
|
|
18649
18649
|
|
|
@@ -19132,7 +19132,7 @@ lib/undici/type-aliases/THttpHeaders.md
|
|
|
19132
19132
|
|
|
19133
19133
|
> **THttpHeaders** = `http.IncomingHttpHeaders` & `object`
|
|
19134
19134
|
|
|
19135
|
-
Defined in: [lib/undici.ts:
|
|
19135
|
+
Defined in: [lib/undici.ts:760](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L760)
|
|
19136
19136
|
|
|
19137
19137
|
http headers
|
|
19138
19138
|
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
7
7
|
*/
|
|
8
8
|
/** --- 当前系统版本号 --- */
|
|
9
|
-
export const VER = '9.2.
|
|
9
|
+
export const VER = '9.2.6';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/lib/undici/response.js
CHANGED
|
@@ -101,11 +101,6 @@ export class Response {
|
|
|
101
101
|
*/
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
103
103
|
getRawStream() {
|
|
104
|
-
|
|
105
|
-
return this._req ? this._req.body : null;
|
|
106
|
-
}
|
|
107
|
-
catch {
|
|
108
|
-
return null;
|
|
109
|
-
}
|
|
104
|
+
return this._req ? this._req.body : null;
|
|
110
105
|
}
|
|
111
106
|
}
|
package/lib/undici.js
CHANGED
|
@@ -3,6 +3,7 @@ import * as stream from 'stream';
|
|
|
3
3
|
import * as dns from 'dns';
|
|
4
4
|
import * as lFs from '#kebab/lib/fs.js';
|
|
5
5
|
import * as lText from '#kebab/lib/text.js';
|
|
6
|
+
import * as lCrypto from '#kebab/lib/crypto.js';
|
|
6
7
|
import * as lCore from '#kebab/lib/core.js';
|
|
7
8
|
import * as lCookie from '#kebab/lib/cookie.js';
|
|
8
9
|
// --- 自己 ---
|
|
@@ -26,10 +27,26 @@ function getMproxyUrl(u, mproxy) {
|
|
|
26
27
|
const agents = new Map();
|
|
27
28
|
/** --- 获取或创建 undici.agent 对象 --- */
|
|
28
29
|
function getAgent(opt = {}) {
|
|
29
|
-
|
|
30
|
+
let k = opt.reuse ?? 'default';
|
|
30
31
|
if (typeof k !== 'string') {
|
|
31
32
|
return k;
|
|
32
33
|
}
|
|
34
|
+
if (k === 'default') {
|
|
35
|
+
// --- hosts/local/keep 均会影响 agent 行为,需生成独立的 key ---
|
|
36
|
+
const features = [];
|
|
37
|
+
if (opt.hosts) {
|
|
38
|
+
features.push(`h:${lCrypto.hashHmac('md5', lText.stringifyJson(opt.hosts))}`);
|
|
39
|
+
}
|
|
40
|
+
if (opt.local) {
|
|
41
|
+
features.push(`l:${opt.local}`);
|
|
42
|
+
}
|
|
43
|
+
if (opt.keep === false) {
|
|
44
|
+
features.push('k:0');
|
|
45
|
+
}
|
|
46
|
+
if (features.length > 0) {
|
|
47
|
+
k = features.join('|');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
33
50
|
if (!agents.has(k)) {
|
|
34
51
|
agents.set(k, new undici.Agent({
|
|
35
52
|
'connect': {
|
|
@@ -333,7 +350,7 @@ export async function request(u, data, opt = {}) {
|
|
|
333
350
|
'message': 'hostname not found',
|
|
334
351
|
};
|
|
335
352
|
if (opt.log === undefined || opt.log) {
|
|
336
|
-
lCore.log({}, `[
|
|
353
|
+
lCore.log({}, `[UNDICI][REQUEST] ${res.error.message}`, '-neterror');
|
|
337
354
|
}
|
|
338
355
|
return res;
|
|
339
356
|
}
|
|
@@ -346,7 +363,7 @@ export async function request(u, data, opt = {}) {
|
|
|
346
363
|
'message': 'hosts param error',
|
|
347
364
|
};
|
|
348
365
|
if (opt.log === undefined || opt.log) {
|
|
349
|
-
lCore.log({}, `[
|
|
366
|
+
lCore.log({}, `[UNDICI][REQUEST] ${res.error.message}`, '-neterror');
|
|
350
367
|
}
|
|
351
368
|
return res;
|
|
352
369
|
}
|
|
@@ -364,7 +381,7 @@ export async function request(u, data, opt = {}) {
|
|
|
364
381
|
const res = new lResponse.Response(null);
|
|
365
382
|
res.error = err;
|
|
366
383
|
if (opt.log === undefined || opt.log) {
|
|
367
|
-
lCore.log({}, `[
|
|
384
|
+
lCore.log({}, `[UNDICI][REQUEST] ${err.message}`, '-neterror');
|
|
368
385
|
}
|
|
369
386
|
return res;
|
|
370
387
|
}
|
|
@@ -506,10 +523,11 @@ export async function mproxy(ctr, auth, opt = {}) {
|
|
|
506
523
|
const rres = await request(get['url'], req, {
|
|
507
524
|
...opt,
|
|
508
525
|
'hosts': lText.logicalOr(hosts, opt.hosts),
|
|
509
|
-
headers
|
|
526
|
+
headers,
|
|
510
527
|
});
|
|
511
528
|
const stream = rres.getRawStream();
|
|
512
529
|
if (!stream) {
|
|
530
|
+
lCore.log({}, `[UNDICI][MPROXY] ${rres.error?.message ?? 'null'}, ${get['url']}`, '-neterror');
|
|
513
531
|
return -3;
|
|
514
532
|
}
|
|
515
533
|
if (rres.error) {
|