@maiyunnet/kebab 9.14.1 → 9.14.3

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 CHANGED
@@ -1360,7 +1360,7 @@ index/variables/VER.md
1360
1360
 
1361
1361
  # Variable: VER
1362
1362
 
1363
- > `const` **VER**: `"9.14.1"` = `'9.14.1'`
1363
+ > `const` **VER**: `"9.14.3"` = `'9.14.3'`
1364
1364
 
1365
1365
  Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
1366
1366
 
@@ -3350,7 +3350,7 @@ lib/core/functions/clone.md
3350
3350
 
3351
3351
  > **clone**\<`T`\>(`obj`): `T`
3352
3352
 
3353
- Defined in: [lib/core.ts:1189](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1189)
3353
+ Defined in: [lib/core.ts:1335](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1335)
3354
3354
 
3355
3355
  完整的克隆一份数组/对象
3356
3356
 
@@ -3414,7 +3414,7 @@ lib/core/functions/debug.md
3414
3414
 
3415
3415
  > **debug**(`message?`, ...`optionalParams`): `void`
3416
3416
 
3417
- Defined in: [lib/core.ts:1223](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1223)
3417
+ Defined in: [lib/core.ts:1369](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1369)
3418
3418
 
3419
3419
  打印调试信息,线上环境不会打印
3420
3420
 
@@ -3449,7 +3449,7 @@ lib/core/functions/display.md
3449
3449
 
3450
3450
  > **display**(`message?`, ...`optionalParams`): `void`
3451
3451
 
3452
- Defined in: [lib/core.ts:1236](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1236)
3452
+ Defined in: [lib/core.ts:1382](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1382)
3453
3453
 
3454
3454
  向控制台直接显示内容,一般情况下禁止使用
3455
3455
 
@@ -3484,7 +3484,7 @@ lib/core/functions/emptyObject.md
3484
3484
 
3485
3485
  > **emptyObject**(`obj`, `deep?`): `void`
3486
3486
 
3487
- Defined in: [lib/core.ts:471](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L471)
3487
+ Defined in: [lib/core.ts:617](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L617)
3488
3488
 
3489
3489
  将对象的所有属性清除包括键,不会破坏引用关系,对象变量依然保证是引用状态
3490
3490
 
@@ -3519,7 +3519,7 @@ lib/core/functions/exec.md
3519
3519
 
3520
3520
  > **exec**(`command`, `options?`): `Promise`\<`string` \| `false`\>
3521
3521
 
3522
- Defined in: [lib/core.ts:533](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L533)
3522
+ Defined in: [lib/core.ts:679](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L679)
3523
3523
 
3524
3524
  执行命令行
3525
3525
 
@@ -3554,7 +3554,7 @@ lib/core/functions/getLog.md
3554
3554
 
3555
3555
  > **getLog**(`opt`): `Promise`\<`false` \| \{ `list`: `any`[] \| `string`[][]; `total`: `number`; \}\>
3556
3556
 
3557
- Defined in: [lib/core.ts:1101](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1101)
3557
+ Defined in: [lib/core.ts:1247](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1247)
3558
3558
 
3559
3559
  获取日志内容为一个数组
3560
3560
 
@@ -3610,6 +3610,44 @@ Defined in: [lib/core.ts:1101](https://github.com/maiyunnet/kebab/blob/master/li
3610
3610
 
3611
3611
  `Promise`\<`false` \| \{ `list`: `any`[] \| `string`[][]; `total`: `number`; \}\>
3612
3612
 
3613
+ lib/core/functions/ipLimit.md
3614
+ ---
3615
+
3616
+ [**Documents for @maiyunnet/kebab**](../../../index.md)
3617
+
3618
+ ***
3619
+
3620
+ [Documents for @maiyunnet/kebab](../../../index.md) / [lib/core](../index.md) / ipLimit
3621
+
3622
+ # Function: ipLimit()
3623
+
3624
+ > **ipLimit**(`ip`, `mask?`): `string`
3625
+
3626
+ Defined in: [lib/core.ts:445](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L445)
3627
+
3628
+ 截取 IP 的限速段
3629
+ IPv4 原样返回;IPv6 截取前 mask 位(默认 /64),防止同一人使用大量 IPv6 地址绕过限速
3630
+
3631
+ ## Parameters
3632
+
3633
+ ### ip
3634
+
3635
+ `string`
3636
+
3637
+ IP 地址
3638
+
3639
+ ### mask?
3640
+
3641
+ `number` = `64`
3642
+
3643
+ IPv6 前缀长度,0-128 的整数,默认 64
3644
+
3645
+ ## Returns
3646
+
3647
+ `string`
3648
+
3649
+ 限速段,如 192.168.1.1、2001:db8:1234:5678::
3650
+
3613
3651
  lib/core/functions/ip.md
3614
3652
  ---
3615
3653
 
@@ -3689,7 +3727,7 @@ lib/core/functions/loadEnv.md
3689
3727
 
3690
3728
  > **loadEnv**(`dir`): `Promise`\<`void`\>
3691
3729
 
3692
- Defined in: [lib/core.ts:1288](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1288)
3730
+ Defined in: [lib/core.ts:1434](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1434)
3693
3731
 
3694
3732
  加载 .env 文件到 process.env,若文件不存在则跳过
3695
3733
 
@@ -3718,7 +3756,7 @@ lib/core/functions/log.md
3718
3756
 
3719
3757
  > **log**(`opt`, `msg`, `fend?`): `void`
3720
3758
 
3721
- Defined in: [lib/core.ts:988](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L988)
3759
+ Defined in: [lib/core.ts:1134](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1134)
3722
3760
 
3723
3761
  写入文件日志
3724
3762
 
@@ -3759,7 +3797,7 @@ lib/core/functions/ls.md
3759
3797
 
3760
3798
  > **ls**(`opt`): `Promise`\<`object`[]\>
3761
3799
 
3762
- Defined in: [lib/core.ts:1150](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1150)
3800
+ Defined in: [lib/core.ts:1296](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1296)
3763
3801
 
3764
3802
  获取目录内文件/文件夹列表
3765
3803
 
@@ -3865,7 +3903,7 @@ lib/core/functions/objectSort.md
3865
3903
 
3866
3904
  > **objectSort**\<`T`\>(`o`): `T`
3867
3905
 
3868
- Defined in: [lib/core.ts:452](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L452)
3906
+ Defined in: [lib/core.ts:598](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L598)
3869
3907
 
3870
3908
  将对象进行升序排列
3871
3909
 
@@ -3900,7 +3938,7 @@ lib/core/functions/passThroughAppend.md
3900
3938
 
3901
3939
  > **passThroughAppend**(`passThrough`, `data`, `end?`): `Promise`\<`void`\>
3902
3940
 
3903
- Defined in: [lib/core.ts:490](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L490)
3941
+ Defined in: [lib/core.ts:636](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L636)
3904
3942
 
3905
3943
  调用前自行创建 passThrough,并且调用 pipe 绑定到应该绑定的对象,然后再调用本函数
3906
3944
 
@@ -4039,6 +4077,50 @@ Defined in: [lib/core.ts:129](https://github.com/maiyunnet/kebab/blob/master/lib
4039
4077
 
4040
4078
  `string`
4041
4079
 
4080
+ lib/core/functions/realIPLimit.md
4081
+ ---
4082
+
4083
+ [**Documents for @maiyunnet/kebab**](../../../index.md)
4084
+
4085
+ ***
4086
+
4087
+ [Documents for @maiyunnet/kebab](../../../index.md) / [lib/core](../index.md) / realIPLimit
4088
+
4089
+ # Function: realIPLimit()
4090
+
4091
+ > **realIPLimit**(`ctr`, `name?`, `mask?`): `string`
4092
+
4093
+ Defined in: [lib/core.ts:465](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L465)
4094
+
4095
+ 获取安全 IP 的限速段(用于 ratelimit 库的 key)
4096
+ IPv4 原样返回;IPv6 截取前 mask 位(默认 /64)
4097
+
4098
+ ## Parameters
4099
+
4100
+ ### ctr
4101
+
4102
+ [`Ctr`](../../../sys/ctr/classes/Ctr.md)
4103
+
4104
+ Ctr 实例
4105
+
4106
+ ### name?
4107
+
4108
+ `string` = `''`
4109
+
4110
+ 输入安全的 header
4111
+
4112
+ ### mask?
4113
+
4114
+ `number` = `64`
4115
+
4116
+ IPv6 前缀长度,0-128 的整数,默认 64
4117
+
4118
+ ## Returns
4119
+
4120
+ `string`
4121
+
4122
+ 限速段,如 192.168.1.1、2001:db8:1234:5678::
4123
+
4042
4124
  lib/core/functions/realIP.md
4043
4125
  ---
4044
4126
 
@@ -4052,7 +4134,7 @@ lib/core/functions/realIP.md
4052
4134
 
4053
4135
  > **realIP**(`ctr`, `name?`): `string`
4054
4136
 
4055
- Defined in: [lib/core.ts:424](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L424)
4137
+ Defined in: [lib/core.ts:426](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L426)
4056
4138
 
4057
4139
  获取直连 IP(安全 IP)
4058
4140
 
@@ -4085,7 +4167,7 @@ lib/core/functions/removeGlobal.md
4085
4167
 
4086
4168
  > **removeGlobal**(`key`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4087
4169
 
4088
- Defined in: [lib/core.ts:805](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L805)
4170
+ Defined in: [lib/core.ts:951](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L951)
4089
4171
 
4090
4172
  移除某个跨线程/跨内网服务器全局变量
4091
4173
 
@@ -4120,7 +4202,7 @@ lib/core/functions/resolveEnvVars.md
4120
4202
 
4121
4203
  > **resolveEnvVars**(`obj`): `void`
4122
4204
 
4123
- Defined in: [lib/core.ts:1318](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1318)
4205
+ Defined in: [lib/core.ts:1464](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1464)
4124
4206
 
4125
4207
  将配置对象中的 ${ENV_VAR} 占位符替换为 process.env 的值
4126
4208
 
@@ -4149,7 +4231,7 @@ lib/core/functions/sendNpm.md
4149
4231
 
4150
4232
  > **sendNpm**(`path`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4151
4233
 
4152
- Defined in: [lib/core.ts:704](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L704)
4234
+ Defined in: [lib/core.ts:850](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L850)
4153
4235
 
4154
4236
  向本机或局域网 RPC 发送 npm install 操作
4155
4237
 
@@ -4184,7 +4266,7 @@ lib/core/functions/sendPackage.md
4184
4266
 
4185
4267
  > **sendPackage**(`content`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4186
4268
 
4187
- Defined in: [lib/core.ts:928](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L928)
4269
+ Defined in: [lib/core.ts:1074](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1074)
4188
4270
 
4189
4271
  向本机或局域网 RPC 发送 package.json 更新操作
4190
4272
 
@@ -4219,7 +4301,7 @@ lib/core/functions/sendPm2.md
4219
4301
 
4220
4302
  > **sendPm2**(`name`, `action?`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4221
4303
 
4222
- Defined in: [lib/core.ts:656](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L656)
4304
+ Defined in: [lib/core.ts:802](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L802)
4223
4305
 
4224
4306
  向本机或局域网 RPC 发送 PM2 操作
4225
4307
 
@@ -4260,7 +4342,7 @@ lib/core/functions/sendProject.md
4260
4342
 
4261
4343
  > **sendProject**(`path`, `key`, `value`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4262
4344
 
4263
- Defined in: [lib/core.ts:880](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L880)
4345
+ Defined in: [lib/core.ts:1026](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1026)
4264
4346
 
4265
4347
  向本机或局域网 RPC 发送项目配置更新操作
4266
4348
 
@@ -4307,7 +4389,7 @@ lib/core/functions/sendReload.md
4307
4389
 
4308
4390
  > **sendReload**(`hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4309
4391
 
4310
- Defined in: [lib/core.ts:553](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L553)
4392
+ Defined in: [lib/core.ts:699](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L699)
4311
4393
 
4312
4394
  向主进程(或局域网同代码机子)发送广播将进行 reload 操作,等待回传
4313
4395
  主要作用除代码热更新以外的其他情况
@@ -4335,7 +4417,7 @@ lib/core/functions/sendRestart.md
4335
4417
 
4336
4418
  > **sendRestart**(`hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4337
4419
 
4338
- Defined in: [lib/core.ts:602](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L602)
4420
+ Defined in: [lib/core.ts:748](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L748)
4339
4421
 
4340
4422
  向主进程(或局域网同代码机子)发送广播将进行 restart 操作,停止监听并启动新进程,老进程在连接全部断开后自行销毁
4341
4423
  主要用作不间断的代码热更新
@@ -4410,7 +4492,7 @@ lib/core/functions/setGlobal.md
4410
4492
 
4411
4493
  > **setGlobal**(`key`, `data`, `hosts?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4412
4494
 
4413
- Defined in: [lib/core.ts:755](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L755)
4495
+ Defined in: [lib/core.ts:901](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L901)
4414
4496
 
4415
4497
  设置跨线程/指定的局域网主机的全局变量
4416
4498
 
@@ -4451,7 +4533,7 @@ lib/core/functions/sleep.md
4451
4533
 
4452
4534
  > **sleep**(`ms`): `Promise`\<`void`\>
4453
4535
 
4454
- Defined in: [lib/core.ts:440](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L440)
4536
+ Defined in: [lib/core.ts:586](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L586)
4455
4537
 
4456
4538
  间隔一段时间
4457
4539
 
@@ -4509,7 +4591,7 @@ lib/core/functions/updateCode.md
4509
4591
 
4510
4592
  > **updateCode**(`sourcePath`, `path`, `hosts?`, `config?`, `strict?`): `Promise`\<`Record`\<`string`, \{ `result`: `boolean`; `return`: `string`; \}\>\>
4511
4593
 
4512
- Defined in: [lib/core.ts:820](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L820)
4594
+ Defined in: [lib/core.ts:966](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L966)
4513
4595
 
4514
4596
  上传并覆盖代码文件,config.json、kebab.json、.js.map、.ts, .gitignore 不会被覆盖和新创建
4515
4597
 
@@ -4562,7 +4644,7 @@ lib/core/functions/writeEventStreamHead.md
4562
4644
 
4563
4645
  > **writeEventStreamHead**(`res`): `void`
4564
4646
 
4565
- Defined in: [lib/core.ts:1258](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1258)
4647
+ Defined in: [lib/core.ts:1404](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1404)
4566
4648
 
4567
4649
  ## Parameters
4568
4650
 
@@ -4587,7 +4669,7 @@ lib/core/functions/writeHead.md
4587
4669
 
4588
4670
  > **writeHead**(`res`, `statusCode`, `headers?`): `void`
4589
4671
 
4590
- Defined in: [lib/core.ts:1247](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1247)
4672
+ Defined in: [lib/core.ts:1393](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1393)
4591
4673
 
4592
4674
  让 res 发送头部(前提是头部没有被发送才能调用本方法
4593
4675
 
@@ -4628,7 +4710,7 @@ lib/core/functions/write.md
4628
4710
 
4629
4711
  > **write**(`res`, `data`): `void`
4630
4712
 
4631
- Defined in: [lib/core.ts:1270](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1270)
4713
+ Defined in: [lib/core.ts:1416](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1416)
4632
4714
 
4633
4715
  向 res 发送数据
4634
4716
 
@@ -4684,6 +4766,7 @@ lib/core/index.md
4684
4766
  - [RANDOM\_UN](variables/RANDOM_UN.md)
4685
4767
  - [RANDOM\_V](variables/RANDOM_V.md)
4686
4768
  - [REAL\_IP\_CF](variables/REAL_IP_CF.md)
4769
+ - [REAL\_IP\_EO](variables/REAL_IP_EO.md)
4687
4770
  - [REAL\_IP\_X](variables/REAL_IP_X.md)
4688
4771
 
4689
4772
  ## Functions
@@ -4698,6 +4781,7 @@ lib/core/index.md
4698
4781
  - [exec](functions/exec.md)
4699
4782
  - [getLog](functions/getLog.md)
4700
4783
  - [ip](functions/ip.md)
4784
+ - [ipLimit](functions/ipLimit.md)
4701
4785
  - [ips](functions/ips.md)
4702
4786
  - [loadEnv](functions/loadEnv.md)
4703
4787
  - [log](functions/log.md)
@@ -4709,6 +4793,7 @@ lib/core/index.md
4709
4793
  - [rand](functions/rand.md)
4710
4794
  - [random](functions/random.md)
4711
4795
  - [realIP](functions/realIP.md)
4796
+ - [realIPLimit](functions/realIPLimit.md)
4712
4797
  - [removeGlobal](functions/removeGlobal.md)
4713
4798
  - [resolveEnvVars](functions/resolveEnvVars.md)
4714
4799
  - [sendNpm](functions/sendNpm.md)
@@ -4800,7 +4885,7 @@ lib/core/interfaces/ILogOptions.md
4800
4885
 
4801
4886
  # Interface: ILogOptions
4802
4887
 
4803
- Defined in: [lib/core.ts:971](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L971)
4888
+ Defined in: [lib/core.ts:1117](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1117)
4804
4889
 
4805
4890
  log 设置的选项
4806
4891
 
@@ -4810,7 +4895,7 @@ log 设置的选项
4810
4895
 
4811
4896
  > `optional` **cookie?**: `Record`\<`string`, `string`\>
4812
4897
 
4813
- Defined in: [lib/core.ts:977](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L977)
4898
+ Defined in: [lib/core.ts:1123](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1123)
4814
4899
 
4815
4900
  ***
4816
4901
 
@@ -4818,7 +4903,7 @@ Defined in: [lib/core.ts:977](https://github.com/maiyunnet/kebab/blob/master/lib
4818
4903
 
4819
4904
  > `optional` **get?**: `Record`\<`string`, `any`\>
4820
4905
 
4821
- Defined in: [lib/core.ts:976](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L976)
4906
+ Defined in: [lib/core.ts:1122](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1122)
4822
4907
 
4823
4908
  ***
4824
4909
 
@@ -4826,7 +4911,7 @@ Defined in: [lib/core.ts:976](https://github.com/maiyunnet/kebab/blob/master/lib
4826
4911
 
4827
4912
  > `optional` **headers?**: `IncomingHttpHeaders`
4828
4913
 
4829
- Defined in: [lib/core.ts:979](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L979)
4914
+ Defined in: [lib/core.ts:1125](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1125)
4830
4915
 
4831
4916
  ***
4832
4917
 
@@ -4834,7 +4919,7 @@ Defined in: [lib/core.ts:979](https://github.com/maiyunnet/kebab/blob/master/lib
4834
4919
 
4835
4920
  > `optional` **hostname?**: `string`
4836
4921
 
4837
- Defined in: [lib/core.ts:974](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L974)
4922
+ Defined in: [lib/core.ts:1120](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1120)
4838
4923
 
4839
4924
  ***
4840
4925
 
@@ -4842,7 +4927,7 @@ Defined in: [lib/core.ts:974](https://github.com/maiyunnet/kebab/blob/master/lib
4842
4927
 
4843
4928
  > `optional` **path?**: `string`
4844
4929
 
4845
- Defined in: [lib/core.ts:972](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L972)
4930
+ Defined in: [lib/core.ts:1118](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1118)
4846
4931
 
4847
4932
  ***
4848
4933
 
@@ -4850,7 +4935,7 @@ Defined in: [lib/core.ts:972](https://github.com/maiyunnet/kebab/blob/master/lib
4850
4935
 
4851
4936
  > `optional` **req?**: `IncomingMessage` \| `Http2ServerRequest` \| `null`
4852
4937
 
4853
- Defined in: [lib/core.ts:975](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L975)
4938
+ Defined in: [lib/core.ts:1121](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1121)
4854
4939
 
4855
4940
  ***
4856
4941
 
@@ -4858,7 +4943,7 @@ Defined in: [lib/core.ts:975](https://github.com/maiyunnet/kebab/blob/master/lib
4858
4943
 
4859
4944
  > `optional` **session?**: `Record`\<`string`, `any`\>
4860
4945
 
4861
- Defined in: [lib/core.ts:978](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L978)
4946
+ Defined in: [lib/core.ts:1124](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1124)
4862
4947
 
4863
4948
  ***
4864
4949
 
@@ -4866,7 +4951,7 @@ Defined in: [lib/core.ts:978](https://github.com/maiyunnet/kebab/blob/master/lib
4866
4951
 
4867
4952
  > `optional` **urlFull?**: `string`
4868
4953
 
4869
- Defined in: [lib/core.ts:973](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L973)
4954
+ Defined in: [lib/core.ts:1119](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1119)
4870
4955
 
4871
4956
  lib/core/type-aliases/TPm2Action.md
4872
4957
  ---
@@ -4881,7 +4966,7 @@ lib/core/type-aliases/TPm2Action.md
4881
4966
 
4882
4967
  > **TPm2Action** = `"start"` \| `"stop"` \| `"restart"`
4883
4968
 
4884
- Defined in: [lib/core.ts:648](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L648)
4969
+ Defined in: [lib/core.ts:794](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L794)
4885
4970
 
4886
4971
  PM2 操作类型
4887
4972
 
@@ -4955,7 +5040,7 @@ lib/core/variables/global.md
4955
5040
 
4956
5041
  > `const` **global**: `Record`\<`string`, `any`\> = `{}`
4957
5042
 
4958
- Defined in: [lib/core.ts:747](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L747)
5043
+ Defined in: [lib/core.ts:893](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L893)
4959
5044
 
4960
5045
  跨进程全局变量
4961
5046
 
@@ -5129,6 +5214,23 @@ Defined in: [lib/core.ts:400](https://github.com/maiyunnet/kebab/blob/master/lib
5129
5214
 
5130
5215
  使用的是 Cloudflare
5131
5216
 
5217
+ lib/core/variables/REAL_IP_EO.md
5218
+ ---
5219
+
5220
+ [**Documents for @maiyunnet/kebab**](../../../index.md)
5221
+
5222
+ ***
5223
+
5224
+ [Documents for @maiyunnet/kebab](../../../index.md) / [lib/core](../index.md) / REAL\_IP\_EO
5225
+
5226
+ # Variable: REAL\_IP\_EO
5227
+
5228
+ > `const` **REAL\_IP\_EO**: `"eo-connecting-ip"` = `'eo-connecting-ip'`
5229
+
5230
+ Defined in: [lib/core.ts:402](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L402)
5231
+
5232
+ 使用的是 EO
5233
+
5132
5234
  lib/core/variables/REAL_IP_X.md
5133
5235
  ---
5134
5236
 
@@ -7439,7 +7541,7 @@ lib/db/pool/classes/Pool.md
7439
7541
 
7440
7542
  # Class: Pool
7441
7543
 
7442
- Defined in: [lib/db/pool.ts:115](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L115)
7544
+ Defined in: [lib/db/pool.ts:116](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L116)
7443
7545
 
7444
7546
  数据库连接池对象
7445
7547
 
@@ -7449,7 +7551,7 @@ Defined in: [lib/db/pool.ts:115](https://github.com/maiyunnet/kebab/blob/master/
7449
7551
 
7450
7552
  > **new Pool**(`etc`, `opt`): `Pool`
7451
7553
 
7452
- Defined in: [lib/db/pool.ts:126](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L126)
7554
+ Defined in: [lib/db/pool.ts:127](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L127)
7453
7555
 
7454
7556
  #### Parameters
7455
7557
 
@@ -7475,7 +7577,7 @@ Defined in: [lib/db/pool.ts:126](https://github.com/maiyunnet/kebab/blob/master/
7475
7577
 
7476
7578
  > **beginTransaction**(`ctr`): `Promise`\<[`Transaction`](../../tran/classes/Transaction.md) \| `null`\>
7477
7579
 
7478
- Defined in: [lib/db/pool.ts:194](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L194)
7580
+ Defined in: [lib/db/pool.ts:195](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L195)
7479
7581
 
7480
7582
  开启事务,返回事务对象并锁定连接,别人任何人不可用,有 ctr 的话必传 this,独立执行时可传 null
7481
7583
 
@@ -7495,7 +7597,7 @@ Defined in: [lib/db/pool.ts:194](https://github.com/maiyunnet/kebab/blob/master/
7495
7597
 
7496
7598
  > **execute**(`sql`, `values?`): `Promise`\<[`IPacket`](../../interfaces/IPacket.md)\>
7497
7599
 
7498
- Defined in: [lib/db/pool.ts:174](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L174)
7600
+ Defined in: [lib/db/pool.ts:175](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L175)
7499
7601
 
7500
7602
  执行一条 SQL 并获得影响行数对象 packet,连接失败抛出错误
7501
7603
 
@@ -7523,7 +7625,7 @@ Defined in: [lib/db/pool.ts:174](https://github.com/maiyunnet/kebab/blob/master/
7523
7625
 
7524
7626
  > **getName**(): `string`
7525
7627
 
7526
- Defined in: [lib/db/pool.ts:140](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L140)
7628
+ Defined in: [lib/db/pool.ts:141](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L141)
7527
7629
 
7528
7630
  获取当前连接的数据库名称
7529
7631
 
@@ -7537,7 +7639,7 @@ Defined in: [lib/db/pool.ts:140](https://github.com/maiyunnet/kebab/blob/master/
7537
7639
 
7538
7640
  > **getQueries**(): `number`
7539
7641
 
7540
- Defined in: [lib/db/pool.ts:326](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L326)
7642
+ Defined in: [lib/db/pool.ts:327](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L327)
7541
7643
 
7542
7644
  获取 SQL 执行次数
7543
7645
 
@@ -7551,7 +7653,7 @@ Defined in: [lib/db/pool.ts:326](https://github.com/maiyunnet/kebab/blob/master/
7551
7653
 
7552
7654
  > **getService**(): [`ESERVICE`](../../enumerations/ESERVICE.md)
7553
7655
 
7554
- Defined in: [lib/db/pool.ts:135](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L135)
7656
+ Defined in: [lib/db/pool.ts:136](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L136)
7555
7657
 
7556
7658
  获取当前连接的服务商
7557
7659
 
@@ -7565,7 +7667,7 @@ Defined in: [lib/db/pool.ts:135](https://github.com/maiyunnet/kebab/blob/master/
7565
7667
 
7566
7668
  > **query**(`sql`, `values?`): `Promise`\<[`IData`](../../interfaces/IData.md)\>
7567
7669
 
7568
- Defined in: [lib/db/pool.ts:150](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L150)
7670
+ Defined in: [lib/db/pool.ts:151](https://github.com/maiyunnet/kebab/blob/master/lib/db/pool.ts#L151)
7569
7671
 
7570
7672
  执行一条 SQL,无视顺序和相同连接,随用随取
7571
7673
 
@@ -16293,7 +16395,7 @@ lib/text/functions/csvescape.md
16293
16395
 
16294
16396
  > **csvescape**(`str`): `string`
16295
16397
 
16296
- Defined in: [lib/text.ts:514](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L514)
16398
+ Defined in: [lib/text.ts:511](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L511)
16297
16399
 
16298
16400
  CSV 特殊字符转换为实体字符
16299
16401
 
@@ -16320,7 +16422,7 @@ lib/text/functions/getFileExt.md
16320
16422
 
16321
16423
  > **getFileExt**(`path`): `string`
16322
16424
 
16323
- Defined in: [lib/text.ts:555](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L555)
16425
+ Defined in: [lib/text.ts:552](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L552)
16324
16426
 
16325
16427
  获取文件后缀
16326
16428
 
@@ -16349,7 +16451,7 @@ lib/text/functions/getFileNameExt.md
16349
16451
 
16350
16452
  > **getFileNameExt**(`path`): `object`
16351
16453
 
16352
- Defined in: [lib/text.ts:568](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L568)
16454
+ Defined in: [lib/text.ts:565](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L565)
16353
16455
 
16354
16456
  获取文件名和后缀
16355
16457
 
@@ -16386,7 +16488,7 @@ lib/text/functions/getFilename.md
16386
16488
 
16387
16489
  > **getFilename**(`path`, `ext?`): `string`
16388
16490
 
16389
- Defined in: [lib/text.ts:535](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L535)
16491
+ Defined in: [lib/text.ts:532](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L532)
16390
16492
 
16391
16493
  获取文件名
16392
16494
 
@@ -16421,7 +16523,7 @@ lib/text/functions/htmlescape.md
16421
16523
 
16422
16524
  > **htmlescape**(`html`): `string`
16423
16525
 
16424
- Defined in: [lib/text.ts:505](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L505)
16526
+ Defined in: [lib/text.ts:502](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L502)
16425
16527
 
16426
16528
  HTML 特殊字符转换为实体字符
16427
16529
 
@@ -16450,7 +16552,7 @@ lib/text/functions/int2str.md
16450
16552
 
16451
16553
  > **int2str**(`int`, `digits?`, `decimal?`): `string`
16452
16554
 
16453
- Defined in: [lib/text.ts:768](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L768)
16555
+ Defined in: [lib/text.ts:765](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L765)
16454
16556
 
16455
16557
  为解决精度问题,将整数转换为小数字符串
16456
16558
  以下几个示例都是当 digits 为 3、decimal 为 2 时
@@ -16496,7 +16598,7 @@ lib/text/functions/isAscii.md
16496
16598
 
16497
16599
  > **isAscii**(`text`): `boolean`
16498
16600
 
16499
- Defined in: [lib/text.ts:273](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L273)
16601
+ Defined in: [lib/text.ts:270](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L270)
16500
16602
 
16501
16603
  判断是否在 ascii 字符集内,仅可输入部分
16502
16604
 
@@ -16525,7 +16627,7 @@ lib/text/functions/isDomain.md
16525
16627
 
16526
16628
  > **isDomain**(`domain`): `boolean`
16527
16629
 
16528
- Defined in: [lib/text.ts:262](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L262)
16630
+ Defined in: [lib/text.ts:259](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L259)
16529
16631
 
16530
16632
  判断是否是域名
16531
16633
 
@@ -16556,7 +16658,7 @@ lib/text/functions/isEMail.md
16556
16658
 
16557
16659
  > **isEMail**(`email`): `boolean`
16558
16660
 
16559
- Defined in: [lib/text.ts:231](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L231)
16661
+ Defined in: [lib/text.ts:232](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L232)
16560
16662
 
16561
16663
  是否是邮件地址
16562
16664
 
@@ -16583,7 +16685,7 @@ lib/text/functions/isFalsy.md
16583
16685
 
16584
16686
  > **isFalsy**(`val`): `val is TFalsy`
16585
16687
 
16586
- Defined in: [lib/text.ts:719](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L719)
16688
+ Defined in: [lib/text.ts:716](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L716)
16587
16689
 
16588
16690
  判断一个值是否是虚假的(为 null/undefined/空字符串/false/0)
16589
16691
 
@@ -16612,7 +16714,7 @@ lib/text/functions/isIdCardCN.md
16612
16714
 
16613
16715
  > **isIdCardCN**(`idcard`): `boolean`
16614
16716
 
16615
- Defined in: [lib/text.ts:385](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L385)
16717
+ Defined in: [lib/text.ts:382](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L382)
16616
16718
 
16617
16719
  是否是中国大陆身份证号码
16618
16720
 
@@ -16641,9 +16743,9 @@ lib/text/functions/isIPv4.md
16641
16743
 
16642
16744
  > **isIPv4**(`ip`): `boolean`
16643
16745
 
16644
- Defined in: [lib/text.ts:241](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L241)
16746
+ Defined in: [lib/text.ts:240](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L240)
16645
16747
 
16646
- 是否是 IPv4
16748
+ 是否是 IPv4(基于 Node 原生 net.isIP,严格校验)
16647
16749
 
16648
16750
  ## Parameters
16649
16751
 
@@ -16668,9 +16770,9 @@ lib/text/functions/isIPv6.md
16668
16770
 
16669
16771
  > **isIPv6**(`ip`): `boolean`
16670
16772
 
16671
- Defined in: [lib/text.ts:251](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L251)
16773
+ Defined in: [lib/text.ts:248](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L248)
16672
16774
 
16673
- 是否是 IPv6
16775
+ 是否是 IPv6(基于 Node 原生 net.isIP,严格校验)
16674
16776
 
16675
16777
  ## Parameters
16676
16778
 
@@ -16695,7 +16797,7 @@ lib/text/functions/isPhoneCN.md
16695
16797
 
16696
16798
  > **isPhoneCN**(`p`): `boolean`
16697
16799
 
16698
- Defined in: [lib/text.ts:377](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L377)
16800
+ Defined in: [lib/text.ts:374](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L374)
16699
16801
 
16700
16802
  判断手机号是否是 11 位,不做真实性校验
16701
16803
 
@@ -16724,7 +16826,7 @@ lib/text/functions/isRealPath.md
16724
16826
 
16725
16827
  > **isRealPath**(`path`): `boolean`
16726
16828
 
16727
- Defined in: [lib/text.ts:522](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L522)
16829
+ Defined in: [lib/text.ts:519](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L519)
16728
16830
 
16729
16831
  判断是否是绝对路径,是返回 true,相对路径返回 false
16730
16832
 
@@ -16753,7 +16855,7 @@ lib/text/functions/isTruthy.md
16753
16855
 
16754
16856
  > **isTruthy**\<`T`\>(`val`): `val is Exclude<T, TFalsy>`
16755
16857
 
16756
- Defined in: [lib/text.ts:727](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L727)
16858
+ Defined in: [lib/text.ts:724](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L724)
16757
16859
 
16758
16860
  判断一个值是否是真实的(不为 null/undefined/空字符串/false/0)
16759
16861
 
@@ -16788,7 +16890,7 @@ lib/text/functions/logicalOr.md
16788
16890
 
16789
16891
  > **logicalOr**\<`T`, `T2`\>(`v1`, `v2`): `T` *extends* [`TFalsy`](../type-aliases/TFalsy.md) ? `T2` : `T`
16790
16892
 
16791
- Defined in: [lib/text.ts:736](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L736)
16893
+ Defined in: [lib/text.ts:733](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L733)
16792
16894
 
16793
16895
  类似 || 运算符的效果
16794
16896
 
@@ -16833,7 +16935,7 @@ lib/text/functions/match.md
16833
16935
 
16834
16936
  > **match**(`str`, `regs`): `boolean`
16835
16937
 
16836
- Defined in: [lib/text.ts:362](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L362)
16938
+ Defined in: [lib/text.ts:359](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L359)
16837
16939
 
16838
16940
  传入正则进行匹配 str 是否有一项满足
16839
16941
 
@@ -16868,7 +16970,7 @@ lib/text/functions/nlReplace.md
16868
16970
 
16869
16971
  > **nlReplace**(`str`, `to?`): `string`
16870
16972
 
16871
- Defined in: [lib/text.ts:282](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L282)
16973
+ Defined in: [lib/text.ts:279](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L279)
16872
16974
 
16873
16975
  换行替换为别的
16874
16976
 
@@ -16903,7 +17005,7 @@ lib/text/functions/parseDomain.md
16903
17005
 
16904
17006
  > **parseDomain**(`domain`): `Promise`\<[`IDomain`](../interfaces/IDomain.md)\>
16905
17007
 
16906
- Defined in: [lib/text.ts:305](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L305)
17008
+ Defined in: [lib/text.ts:302](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L302)
16907
17009
 
16908
17010
  解析域名并获取 tld/sld/domain/sub
16909
17011
 
@@ -16932,7 +17034,7 @@ lib/text/functions/parseHost.md
16932
17034
 
16933
17035
  > **parseHost**(`host`): `object`
16934
17036
 
16935
- Defined in: [lib/text.ts:29](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L29)
17037
+ Defined in: [lib/text.ts:30](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L30)
16936
17038
 
16937
17039
  解析主机名和端口号
16938
17040
 
@@ -16973,7 +17075,7 @@ lib/text/functions/parseJson.md
16973
17075
 
16974
17076
  > **parseJson**\<`T`\>(`str`): `false` \| `T`
16975
17077
 
16976
- Defined in: [lib/text.ts:630](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L630)
17078
+ Defined in: [lib/text.ts:627](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L627)
16977
17079
 
16978
17080
  将字符串解析为对象,返回 false 代表解析失败,支持 BigInt
16979
17081
 
@@ -17008,7 +17110,7 @@ lib/text/functions/parseUrl.md
17008
17110
 
17009
17111
  > **parseUrl**(`url`): [`IUrlParse`](../../../index/interfaces/IUrlParse.md)
17010
17112
 
17011
- Defined in: [lib/text.ts:55](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L55)
17113
+ Defined in: [lib/text.ts:56](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L56)
17012
17114
 
17013
17115
  格式化一段 URL
17014
17116
 
@@ -17035,7 +17137,7 @@ lib/text/functions/queryParse.md
17035
17137
 
17036
17138
  > **queryParse**(`query`): `Record`\<`string`, `string` \| `string`[]\>
17037
17139
 
17038
- Defined in: [lib/text.ts:462](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L462)
17140
+ Defined in: [lib/text.ts:459](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L459)
17039
17141
 
17040
17142
  将 query string 转换为对象
17041
17143
 
@@ -17066,7 +17168,7 @@ lib/text/functions/queryStringify.md
17066
17168
 
17067
17169
  > **queryStringify**(`query`, `encode?`): `string`
17068
17170
 
17069
- Defined in: [lib/text.ts:413](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L413)
17171
+ Defined in: [lib/text.ts:410](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L410)
17070
17172
 
17071
17173
  将对象转换为 query string
17072
17174
 
@@ -17092,7 +17194,7 @@ Defined in: [lib/text.ts:413](https://github.com/maiyunnet/kebab/blob/master/lib
17092
17194
 
17093
17195
  > **queryStringify**(`query`, `options`): `string`
17094
17196
 
17095
- Defined in: [lib/text.ts:419](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L419)
17197
+ Defined in: [lib/text.ts:416](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L416)
17096
17198
 
17097
17199
  将对象转换为 query string
17098
17200
 
@@ -17137,7 +17239,7 @@ lib/text/functions/sizeFormat.md
17137
17239
 
17138
17240
  > **sizeFormat**(`size`, `spliter?`): `string`
17139
17241
 
17140
- Defined in: [lib/text.ts:15](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L15)
17242
+ Defined in: [lib/text.ts:16](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L16)
17141
17243
 
17142
17244
  将文件大小格式化为带单位的字符串
17143
17245
 
@@ -17172,7 +17274,7 @@ lib/text/functions/str2int.md
17172
17274
 
17173
17275
  > **str2int**(`str`, `digits?`): `number`
17174
17276
 
17175
- Defined in: [lib/text.ts:750](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L750)
17277
+ Defined in: [lib/text.ts:747](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L747)
17176
17278
 
17177
17279
  为解决精度问题,将字符串数字转换为整数显示
17178
17280
  以下几个示例都是当 digits 为 2 时
@@ -17212,7 +17314,7 @@ lib/text/functions/stringifyBuffer.md
17212
17314
 
17213
17315
  > **stringifyBuffer**(`buf`): `string`
17214
17316
 
17215
- Defined in: [lib/text.ts:673](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L673)
17317
+ Defined in: [lib/text.ts:670](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L670)
17216
17318
 
17217
17319
  输出文本格式的 buffer
17218
17320
 
@@ -17241,7 +17343,7 @@ lib/text/functions/stringifyJson.md
17241
17343
 
17242
17344
  > **stringifyJson**(`obj`, `space?`): `string`
17243
17345
 
17244
- Defined in: [lib/text.ts:660](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L660)
17346
+ Defined in: [lib/text.ts:657](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L657)
17245
17347
 
17246
17348
  将对象转换为 json 字符串,返回 false 代表解析失败,支持 BigInt
17247
17349
 
@@ -17276,7 +17378,7 @@ lib/text/functions/stringifyResult.md
17276
17378
 
17277
17379
  > **stringifyResult**(`rtn`): `string`
17278
17380
 
17279
- Defined in: [lib/text.ts:590](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L590)
17381
+ Defined in: [lib/text.ts:587](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L587)
17280
17382
 
17281
17383
  将普通的返回 JSON 对象序列化为字符串
17282
17384
 
@@ -17305,7 +17407,7 @@ lib/text/functions/trimJson.md
17305
17407
 
17306
17408
  > **trimJson**(`json`): `any`
17307
17409
 
17308
- Defined in: [lib/text.ts:681](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L681)
17410
+ Defined in: [lib/text.ts:678](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L678)
17309
17411
 
17310
17412
  递归删除 json 中的字符串首尾空格,会返回一个新的对象
17311
17413
 
@@ -17332,7 +17434,7 @@ lib/text/functions/urlAtom.md
17332
17434
 
17333
17435
  > **urlAtom**(`url`): `string`
17334
17436
 
17335
- Defined in: [lib/text.ts:212](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L212)
17437
+ Defined in: [lib/text.ts:213](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L213)
17336
17438
 
17337
17439
  将路径中的 ../ ./ 都按规范妥善处理
17338
17440
 
@@ -17361,7 +17463,7 @@ lib/text/functions/urlResolve.md
17361
17463
 
17362
17464
  > **urlResolve**(`from`, `to`, `limit?`): `string`
17363
17465
 
17364
- Defined in: [lib/text.ts:146](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L146)
17466
+ Defined in: [lib/text.ts:147](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L147)
17365
17467
 
17366
17468
  将相对路径根据基准路径进行转换
17367
17469
 
@@ -17413,8 +17515,6 @@ lib/text/index.md
17413
17515
  - [REGEXP\_ASCII](variables/REGEXP_ASCII.md)
17414
17516
  - [REGEXP\_DOMAIN](variables/REGEXP_DOMAIN.md)
17415
17517
  - [REGEXP\_EMAIL](variables/REGEXP_EMAIL.md)
17416
- - [REGEXP\_IPV4](variables/REGEXP_IPV4.md)
17417
- - [REGEXP\_IPV6](variables/REGEXP_IPV6.md)
17418
17518
 
17419
17519
  ## Functions
17420
17520
 
@@ -17463,7 +17563,7 @@ lib/text/interfaces/IDomain.md
17463
17563
 
17464
17564
  # Interface: IDomain
17465
17565
 
17466
- Defined in: [lib/text.ts:294](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L294)
17566
+ Defined in: [lib/text.ts:291](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L291)
17467
17567
 
17468
17568
  解析后的 domain
17469
17569
 
@@ -17473,7 +17573,7 @@ Defined in: [lib/text.ts:294](https://github.com/maiyunnet/kebab/blob/master/lib
17473
17573
 
17474
17574
  > **domain**: `string` \| `null`
17475
17575
 
17476
- Defined in: [lib/text.ts:297](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L297)
17576
+ Defined in: [lib/text.ts:294](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L294)
17477
17577
 
17478
17578
  ***
17479
17579
 
@@ -17481,7 +17581,7 @@ Defined in: [lib/text.ts:297](https://github.com/maiyunnet/kebab/blob/master/lib
17481
17581
 
17482
17582
  > **sld**: `string` \| `null`
17483
17583
 
17484
- Defined in: [lib/text.ts:296](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L296)
17584
+ Defined in: [lib/text.ts:293](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L293)
17485
17585
 
17486
17586
  ***
17487
17587
 
@@ -17489,7 +17589,7 @@ Defined in: [lib/text.ts:296](https://github.com/maiyunnet/kebab/blob/master/lib
17489
17589
 
17490
17590
  > **sub**: `string` \| `null`
17491
17591
 
17492
- Defined in: [lib/text.ts:298](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L298)
17592
+ Defined in: [lib/text.ts:295](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L295)
17493
17593
 
17494
17594
  ***
17495
17595
 
@@ -17497,7 +17597,7 @@ Defined in: [lib/text.ts:298](https://github.com/maiyunnet/kebab/blob/master/lib
17497
17597
 
17498
17598
  > **tld**: `string` \| `null`
17499
17599
 
17500
- Defined in: [lib/text.ts:295](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L295)
17600
+ Defined in: [lib/text.ts:292](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L292)
17501
17601
 
17502
17602
  lib/text/type-aliases/TFalsy.md
17503
17603
  ---
@@ -17512,7 +17612,7 @@ lib/text/type-aliases/TFalsy.md
17512
17612
 
17513
17613
  > **TFalsy** = `false` \| `""` \| `0` \| `null` \| `undefined` \| *typeof* `NaN`
17514
17614
 
17515
- Defined in: [lib/text.ts:713](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L713)
17615
+ Defined in: [lib/text.ts:710](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L710)
17516
17616
 
17517
17617
  虚假值类型
17518
17618
 
@@ -17529,7 +17629,7 @@ lib/text/variables/REGEXP_ASCII.md
17529
17629
 
17530
17630
  > `const` **REGEXP\_ASCII**: `RegExp`
17531
17631
 
17532
- Defined in: [lib/text.ts:267](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L267)
17632
+ Defined in: [lib/text.ts:264](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L264)
17533
17633
 
17534
17634
  可打印的 ascii 字符集
17535
17635
 
@@ -17546,7 +17646,7 @@ lib/text/variables/REGEXP_DOMAIN.md
17546
17646
 
17547
17647
  > `const` **REGEXP\_DOMAIN**: `RegExp`
17548
17648
 
17549
- Defined in: [lib/text.ts:255](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L255)
17649
+ Defined in: [lib/text.ts:252](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L252)
17550
17650
 
17551
17651
  lib/text/variables/REGEXP_EMAIL.md
17552
17652
  ---
@@ -17561,37 +17661,7 @@ lib/text/variables/REGEXP_EMAIL.md
17561
17661
 
17562
17662
  > `const` **REGEXP\_EMAIL**: `RegExp`
17563
17663
 
17564
- Defined in: [lib/text.ts:225](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L225)
17565
-
17566
- lib/text/variables/REGEXP_IPV4.md
17567
- ---
17568
-
17569
- [**Documents for @maiyunnet/kebab**](../../../index.md)
17570
-
17571
- ***
17572
-
17573
- [Documents for @maiyunnet/kebab](../../../index.md) / [lib/text](../index.md) / REGEXP\_IPV4
17574
-
17575
- # Variable: REGEXP\_IPV4
17576
-
17577
- > `const` **REGEXP\_IPV4**: `RegExp`
17578
-
17579
- Defined in: [lib/text.ts:235](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L235)
17580
-
17581
- lib/text/variables/REGEXP_IPV6.md
17582
- ---
17583
-
17584
- [**Documents for @maiyunnet/kebab**](../../../index.md)
17585
-
17586
- ***
17587
-
17588
- [Documents for @maiyunnet/kebab](../../../index.md) / [lib/text](../index.md) / REGEXP\_IPV6
17589
-
17590
- # Variable: REGEXP\_IPV6
17591
-
17592
- > `const` **REGEXP\_IPV6**: `RegExp`
17593
-
17594
- Defined in: [lib/text.ts:245](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L245)
17664
+ Defined in: [lib/text.ts:226](https://github.com/maiyunnet/kebab/blob/master/lib/text.ts#L226)
17595
17665
 
17596
17666
  lib/time/classes/Time.md
17597
17667
  ---
package/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * --- 本文件用来定义每个目录实体地址的常量 ---
6
6
  */
7
7
  /** --- 当前系统版本号 --- */
8
- export declare const VER = "9.14.1";
8
+ export declare const VER = "9.14.3";
9
9
  /** --- 框架根目录,以 / 结尾 --- */
10
10
  export declare const ROOT_PATH: string;
11
11
  /** --- 框架的 LIB,以 / 结尾 --- */
package/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * --- 本文件用来定义每个目录实体地址的常量 ---
7
7
  */
8
8
  /** --- 当前系统版本号 --- */
9
- export const VER = '9.14.1';
9
+ export const VER = '9.14.3';
10
10
  // --- 服务端用的路径 ---
11
11
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
12
12
  /** --- /xxx/xxx --- */
package/lib/core.d.ts CHANGED
@@ -127,12 +127,31 @@ export declare function ips(ctr: sCtr.Ctr | http.IncomingHttpHeaders): {
127
127
  export declare const REAL_IP_X = "x-forwarded-for";
128
128
  /** --- 使用的是 Cloudflare --- */
129
129
  export declare const REAL_IP_CF = "cf-connecting-ip";
130
+ /** --- 使用的是 EO --- */
131
+ export declare const REAL_IP_EO = "eo-connecting-ip";
130
132
  /**
131
133
  * --- 获取直连 IP(安全 IP) ---
132
134
  * @param ctr
133
135
  * @param name 输入安全的 header
134
136
  */
135
137
  export declare function realIP(ctr: sCtr.Ctr, name?: string): string;
138
+ /**
139
+ * --- 截取 IP 的限速段 ---
140
+ * --- IPv4 原样返回;IPv6 截取前 mask 位(默认 /64),防止同一人使用大量 IPv6 地址绕过限速 ---
141
+ * @param ip IP 地址
142
+ * @param mask IPv6 前缀长度,0-128 的整数,默认 64
143
+ * @returns 限速段,如 192.168.1.1、2001:db8:1234:5678::
144
+ */
145
+ export declare function ipLimit(ip: string, mask?: number): string;
146
+ /**
147
+ * --- 获取安全 IP 的限速段(用于 ratelimit 库的 key) ---
148
+ * --- IPv4 原样返回;IPv6 截取前 mask 位(默认 /64) ---
149
+ * @param ctr Ctr 实例
150
+ * @param name 输入安全的 header
151
+ * @param mask IPv6 前缀长度,0-128 的整数,默认 64
152
+ * @returns 限速段,如 192.168.1.1、2001:db8:1234:5678::
153
+ */
154
+ export declare function realIPLimit(ctr: sCtr.Ctr, name?: string, mask?: number): string;
136
155
  /**
137
156
  * --- 间隔一段时间 ---
138
157
  * @param ms 间隔毫秒
package/lib/core.js CHANGED
@@ -337,6 +337,8 @@ export function ips(ctr) {
337
337
  export const REAL_IP_X = 'x-forwarded-for';
338
338
  /** --- 使用的是 Cloudflare --- */
339
339
  export const REAL_IP_CF = 'cf-connecting-ip';
340
+ /** --- 使用的是 EO --- */
341
+ export const REAL_IP_EO = 'eo-connecting-ip';
340
342
  /**
341
343
  * --- 规范化 IP 地址 ---
342
344
  * --- 将 IPv4-mapped IPv6(如 ::ffff:127.0.0.1)转换为纯 IPv4,原生 IPv6 保持不变 ---
@@ -369,6 +371,145 @@ export function realIP(ctr, name = '') {
369
371
  const req = ctr.getPrototype('_req');
370
372
  return normalizeIP(req.socket.remoteAddress ?? '');
371
373
  }
374
+ /**
375
+ * --- 截取 IP 的限速段 ---
376
+ * --- IPv4 原样返回;IPv6 截取前 mask 位(默认 /64),防止同一人使用大量 IPv6 地址绕过限速 ---
377
+ * @param ip IP 地址
378
+ * @param mask IPv6 前缀长度,0-128 的整数,默认 64
379
+ * @returns 限速段,如 192.168.1.1、2001:db8:1234:5678::
380
+ */
381
+ export function ipLimit(ip, mask = 64) {
382
+ if (!ip) {
383
+ return '';
384
+ }
385
+ const value = ip.trim();
386
+ if (net.isIP(value) === 6) {
387
+ return ipv6Segment(value, mask);
388
+ }
389
+ // --- IPv4 或无法识别的字符串原样返回 ---
390
+ return value;
391
+ }
392
+ /**
393
+ * --- 获取安全 IP 的限速段(用于 ratelimit 库的 key) ---
394
+ * --- IPv4 原样返回;IPv6 截取前 mask 位(默认 /64) ---
395
+ * @param ctr Ctr 实例
396
+ * @param name 输入安全的 header
397
+ * @param mask IPv6 前缀长度,0-128 的整数,默认 64
398
+ * @returns 限速段,如 192.168.1.1、2001:db8:1234:5678::
399
+ */
400
+ export function realIPLimit(ctr, name = '', mask = 64) {
401
+ return ipLimit(realIP(ctr, name), mask);
402
+ }
403
+ /**
404
+ * --- 截取 IPv6 地址的前缀段 ---
405
+ * @param ip IPv6 地址
406
+ * @param mask 前缀长度,0-128
407
+ */
408
+ function ipv6Segment(ip, mask) {
409
+ if (mask >= 128) {
410
+ return ip;
411
+ }
412
+ if (mask <= 0) {
413
+ return '::';
414
+ }
415
+ // --- 展开为 8 组 16 进制字符串 ---
416
+ const groups = expandIPv6(ip);
417
+ if (!groups) {
418
+ return ip;
419
+ }
420
+ /** --- 完整保留的组数 --- */
421
+ const full = Math.floor(mask / 16);
422
+ /** --- 下一组需保留的位数 --- */
423
+ const bits = mask % 16;
424
+ const parts = groups.slice(0, full);
425
+ if (bits > 0) {
426
+ // --- 保留下一组的高 bits 位,其余位清零 ---
427
+ const next = parseInt(groups[full], 16);
428
+ parts.push((next & (0xFFFF << (16 - bits))).toString(16));
429
+ }
430
+ // --- 补零到 8 组后按标准压缩 ---
431
+ while (parts.length < 8) {
432
+ parts.push('0');
433
+ }
434
+ return compressIPv6(parts);
435
+ }
436
+ /**
437
+ * --- 将 8 组 IPv6 分组压缩为标准 RFC 5952 表示(最长连续零段压缩为 ::) ---
438
+ * @param groups 8 组 16 进制字符串
439
+ */
440
+ function compressIPv6(groups) {
441
+ /** --- 最长连续零组的起始位置与长度 --- */
442
+ let bestStart = -1;
443
+ let bestLen = 1;
444
+ let curStart = -1;
445
+ let curLen = 0;
446
+ for (let i = 0; i < groups.length; ++i) {
447
+ if (parseInt(groups[i], 16) === 0) {
448
+ if (curStart === -1) {
449
+ curStart = i;
450
+ curLen = 0;
451
+ }
452
+ ++curLen;
453
+ if (curLen > bestLen) {
454
+ bestLen = curLen;
455
+ bestStart = curStart;
456
+ }
457
+ }
458
+ else {
459
+ curStart = -1;
460
+ curLen = 0;
461
+ }
462
+ }
463
+ /** --- 统一为小写无前导零 --- */
464
+ const norm = (g) => parseInt(g, 16).toString(16);
465
+ if (bestLen < 2) {
466
+ // --- 无连续零段,直接拼接 ---
467
+ return groups.map(norm).join(':');
468
+ }
469
+ const left = groups.slice(0, bestStart).map(norm);
470
+ const right = groups.slice(bestStart + bestLen).map(norm);
471
+ return (left.length ? left.join(':') : '') + '::' + (right.length ? right.join(':') : '');
472
+ }
473
+ /**
474
+ * --- 将 IPv6 地址展开为 8 组 16 进制字符串数组 ---
475
+ * @param ip IPv6 地址
476
+ * @returns 8 组字符串数组,解析失败返回 null
477
+ */
478
+ function expandIPv6(ip) {
479
+ // --- 处理内嵌 IPv4(如 ::ffff:1.2.3.4、1:2:3:4:5:6:1.2.3.4) ---
480
+ let value = ip;
481
+ const ipv4Match = /^(.*:)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/.exec(value);
482
+ if (ipv4Match) {
483
+ const v4 = ipv4Match[2].split('.').map((n) => parseInt(n, 10).toString(16).padStart(2, '0'));
484
+ value = ipv4Match[1] + v4[0] + v4[1] + ':' + v4[2] + v4[3];
485
+ }
486
+ // --- 处理 :: 压缩 ---
487
+ const dc = value.indexOf('::');
488
+ let groups;
489
+ if (dc !== -1) {
490
+ const left = value.slice(0, dc);
491
+ const right = value.slice(dc + 2);
492
+ const leftGroups = left ? left.split(':') : [];
493
+ const rightGroups = right ? right.split(':') : [];
494
+ const missing = 8 - leftGroups.length - rightGroups.length;
495
+ if (missing < 1) {
496
+ return null;
497
+ }
498
+ groups = leftGroups.concat(new Array(missing).fill('0'), rightGroups);
499
+ }
500
+ else {
501
+ groups = value.split(':');
502
+ }
503
+ if (groups.length !== 8) {
504
+ return null;
505
+ }
506
+ for (const group of groups) {
507
+ if (!/^[\da-f]{1,4}$/i.test(group)) {
508
+ return null;
509
+ }
510
+ }
511
+ return groups;
512
+ }
372
513
  /**
373
514
  * --- 间隔一段时间 ---
374
515
  * @param ms 间隔毫秒
package/lib/db/pool.js CHANGED
@@ -82,11 +82,12 @@ async function checkConnection() {
82
82
  }
83
83
  setTimeout(function () {
84
84
  checkConnection().catch(e => { lCore.display('[DB][checkConnection]', e); });
85
- }, 10_000);
85
+ }, 10_000).unref();
86
86
  }
87
+ // --- 模块级巡检定时器,unref 防止在一次性 CLI 进程中阻止退出(服务进程内有其他句柄保持存活,行为不变) ---
87
88
  setTimeout(function () {
88
89
  checkConnection().catch(e => { lCore.display('[DB][checkConnection]', e); });
89
- }, 10_000);
90
+ }, 10_000).unref();
90
91
  /** --- 数据库连接池对象 --- */
91
92
  export class Pool {
92
93
  /** --- SQL 执行次数 --- */
package/lib/text.d.ts CHANGED
@@ -1,8 +1,3 @@
1
- /**
2
- * Project: Kebab, User: JianSuoQiYue
3
- * Date: 2019-5-15 16:49:39
4
- * Last: 2020-04-06 20:51:06, 2022-9-29 15:18:16, 2022-12-29 00:01:30, 2024-3-6 17:53:14, 2024-5-31 17:29:52, 2025-6-13 15:47:02, 2025-9-23 12:51:49
5
- */
6
1
  import * as kebab from '#kebab/index.js';
7
2
  /**
8
3
  * --- 将文件大小格式化为带单位的字符串 ---
@@ -42,15 +37,13 @@ export declare const REGEXP_EMAIL: RegExp;
42
37
  * @param email
43
38
  */
44
39
  export declare function isEMail(email: string): boolean;
45
- export declare const REGEXP_IPV4: RegExp;
46
40
  /**
47
- * --- 是否是 IPv4 ---
41
+ * --- 是否是 IPv4(基于 Node 原生 net.isIP,严格校验) ---
48
42
  * @param ip
49
43
  */
50
44
  export declare function isIPv4(ip: string): boolean;
51
- export declare const REGEXP_IPV6: RegExp;
52
45
  /**
53
- * --- 是否是 IPv6 ---
46
+ * --- 是否是 IPv6(基于 Node 原生 net.isIP,严格校验) ---
54
47
  * @param ip
55
48
  */
56
49
  export declare function isIPv6(ip: string): boolean;
package/lib/text.js CHANGED
@@ -3,6 +3,7 @@
3
3
  * Date: 2019-5-15 16:49:39
4
4
  * Last: 2020-04-06 20:51:06, 2022-9-29 15:18:16, 2022-12-29 00:01:30, 2024-3-6 17:53:14, 2024-5-31 17:29:52, 2025-6-13 15:47:02, 2025-9-23 12:51:49
5
5
  */
6
+ import * as net from 'net';
6
7
  import * as kebab from '#kebab/index.js';
7
8
  import * as lFs from './fs.js';
8
9
  import * as lCore from './core.js';
@@ -219,21 +220,19 @@ export const REGEXP_EMAIL = /^[-_\w.]+@[-_\w.]+\.([a-zA-Z]+)$/i;
219
220
  export function isEMail(email) {
220
221
  return REGEXP_EMAIL.test(email);
221
222
  }
222
- export const REGEXP_IPV4 = /^[0-9]{1,3}(\.[0-9]{1,3}){3}$/i;
223
223
  /**
224
- * --- 是否是 IPv4 ---
224
+ * --- 是否是 IPv4(基于 Node 原生 net.isIP,严格校验) ---
225
225
  * @param ip
226
226
  */
227
227
  export function isIPv4(ip) {
228
- return REGEXP_IPV4.test(ip);
228
+ return net.isIP(ip) === 4;
229
229
  }
230
- export const REGEXP_IPV6 = /^(\w*?:){2,7}[\w.]*$/i;
231
230
  /**
232
- * --- 是否是 IPv6 ---
231
+ * --- 是否是 IPv6(基于 Node 原生 net.isIP,严格校验) ---
233
232
  * @param ip
234
233
  */
235
234
  export function isIPv6(ip) {
236
- return REGEXP_IPV6.test(ip);
235
+ return net.isIP(ip) === 6;
237
236
  }
238
237
  export const REGEXP_DOMAIN = /^.+?\.((?![0-9]).)+$/i;
239
238
  /**
@@ -31,7 +31,7 @@ export declare class Response {
31
31
  /**
32
32
  * --- 获取响应读取流对象 ---
33
33
  */
34
- getStream(): (import("undici/types/readable").default & undici.Dispatcher.BodyMixin) | zlib.Gunzip | zlib.Inflate | zlib.BrotliDecompress | null;
34
+ getStream(): zlib.BrotliDecompress | zlib.Gunzip | zlib.Inflate | (import("undici/types/readable").default & undici.Dispatcher.BodyMixin) | null;
35
35
  /**
36
36
  * --- 获取原生响应读取流对象 ---
37
37
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "9.14.1",
3
+ "version": "9.14.3",
4
4
  "description": "Simple, easy-to-use, and fully-featured Node.js framework that is ready-to-use out of the box.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -47,6 +47,8 @@ export default class extends sCtr.Ctr {
47
47
  coreChecktype(): string;
48
48
  coreCheckschema(): string;
49
49
  coreMuid(): string;
50
+ coreIplimit(): string;
51
+ coreRealiplimit(): string;
50
52
  coreGetlog(): Promise<string>;
51
53
  coreLs(): Promise<string>;
52
54
  coreUpdatecode(): Promise<string>;
@@ -153,6 +153,8 @@ export default class extends sCtr.Ctr {
153
153
  `<br><a href="${this._config.const.urlBase}test/core-checktype">View "test/core-checktype"</a>`,
154
154
  `<br><a href="${this._config.const.urlBase}test/core-checkschema">View "test/core-checkschema"</a>`,
155
155
  `<br><a href="${this._config.const.urlBase}test/core-muid">View "test/core-muid"</a>`,
156
+ `<br><a href="${this._config.const.urlBase}test/core-iplimit">View "test/core-iplimit"</a>`,
157
+ `<br><a href="${this._config.const.urlBase}test/core-realiplimit">View "test/core-realiplimit"</a>`,
156
158
  `<br><a href="${this._config.const.urlBase}test/core-getlog">View "test/core-getlog"</a>`,
157
159
  `<br><a href="${this._config.const.urlBase}test/core-ls">View "test/core-ls"</a>`,
158
160
  `<br><a href="${this._config.const.urlBase}test/core-reload">View "test/core-reload"</a>`,
@@ -1368,6 +1370,24 @@ for (let i = 0; i < 30000; ++i) {
1368
1370
  }
1369
1371
  return echo.join('') + this._getEnd();
1370
1372
  }
1373
+ coreIplimit() {
1374
+ const v6 = '2001:db8:85a3:8d3:1319:8a2e:370:7348';
1375
+ return '<pre>lCore.ipLimit(\'192.168.1.100\');</pre>' + lCore.ipLimit('192.168.1.100') +
1376
+ '<pre>lCore.ipLimit(\'2001:db8:85a3:8d3:1319:8a2e:370:7348\');</pre>' + lCore.ipLimit(v6) +
1377
+ '<pre>lCore.ipLimit(\'2001:db8:85a3:8d3:1319:8a2e:370:7348\', 48);</pre>' + lCore.ipLimit(v6, 48) +
1378
+ '<pre>lCore.ipLimit(\'2001:db8:85a3:8d3:1319:8a2e:370:7348\', 56);</pre>' + lCore.ipLimit(v6, 56) +
1379
+ '<pre>lCore.ipLimit(\'2001:db8:85a3:8d3:1319:8a2e:370:7348\', 128);</pre>' + lCore.ipLimit(v6, 128) +
1380
+ '<pre>lCore.ipLimit(\'::1\');</pre>' + lCore.ipLimit('::1') +
1381
+ '<pre>lCore.ipLimit(\'\');</pre>' + JSON.stringify(lCore.ipLimit('')) +
1382
+ '<br><br>' + this._getEnd();
1383
+ }
1384
+ coreRealiplimit() {
1385
+ return '<pre>lCore.realIP(this);</pre>' + lCore.realIP(this) +
1386
+ '<pre>lCore.realIPLimit(this);</pre>' + lCore.realIPLimit(this) +
1387
+ '<pre>lCore.realIPLimit(this, \'\', 48);</pre>' + lCore.realIPLimit(this, '', 48) +
1388
+ '<pre>lCore.realIPLimit(this, \'\', 56);</pre>' + lCore.realIPLimit(this, '', 56) +
1389
+ '<br><br>' + this._getEnd();
1390
+ }
1371
1391
  async coreGetlog() {
1372
1392
  const path = lTime.format(null, 'Y/m/d/H');
1373
1393
  const log = await lCore.getLog({