@push.rocks/smartproxy 17.0.0 → 18.0.0
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/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/core/utils/shared-security-manager.js +3 -3
- package/dist_ts/forwarding/handlers/base-handler.d.ts +5 -2
- package/dist_ts/forwarding/handlers/base-handler.js +12 -9
- package/dist_ts/forwarding/handlers/http-handler.js +8 -4
- package/dist_ts/proxies/smart-proxy/models/interfaces.d.ts +2 -2
- package/dist_ts/proxies/smart-proxy/models/route-types.d.ts +22 -29
- package/dist_ts/proxies/smart-proxy/models/route-types.js +1 -1
- package/dist_ts/proxies/smart-proxy/route-connection-handler.js +3 -3
- package/dist_ts/proxies/smart-proxy/route-manager.js +5 -5
- package/dist_ts/proxies/smart-proxy/security-manager.d.ts +7 -8
- package/dist_ts/proxies/smart-proxy/security-manager.js +8 -9
- package/package.json +1 -1
- package/readme.plan.md +133 -188
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/core/utils/shared-security-manager.ts +2 -2
- package/ts/forwarding/handlers/base-handler.ts +14 -8
- package/ts/forwarding/handlers/http-handler.ts +8 -3
- package/ts/proxies/smart-proxy/models/interfaces.ts +2 -2
- package/ts/proxies/smart-proxy/models/route-types.ts +31 -27
- package/ts/proxies/smart-proxy/route-connection-handler.ts +3 -3
- package/ts/proxies/smart-proxy/route-manager.ts +4 -4
- package/ts/proxies/smart-proxy/security-manager.ts +7 -8
|
@@ -213,8 +213,8 @@ export class RouteManager extends plugins.EventEmitter {
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
// Check blocked IPs first
|
|
216
|
-
if (security.
|
|
217
|
-
for (const pattern of security.
|
|
216
|
+
if (security.ipBlockList && security.ipBlockList.length > 0) {
|
|
217
|
+
for (const pattern of security.ipBlockList) {
|
|
218
218
|
if (this.matchIpPattern(pattern, clientIp)) {
|
|
219
219
|
return false; // IP is blocked
|
|
220
220
|
}
|
|
@@ -222,8 +222,8 @@ export class RouteManager extends plugins.EventEmitter {
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
// If there are allowed IPs, check them
|
|
225
|
-
if (security.
|
|
226
|
-
for (const pattern of security.
|
|
225
|
+
if (security.ipAllowList && security.ipAllowList.length > 0) {
|
|
226
|
+
for (const pattern of security.ipAllowList) {
|
|
227
227
|
if (this.matchIpPattern(pattern, clientIp)) {
|
|
228
228
|
return true; // IP is allowed
|
|
229
229
|
}
|
|
@@ -63,16 +63,15 @@ export class SecurityManager {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
* Check if an IP is authorized using
|
|
66
|
+
* Check if an IP is authorized using security rules
|
|
67
67
|
*
|
|
68
68
|
* This method is used to determine if an IP is allowed to connect, based on security
|
|
69
|
-
* rules configured in the
|
|
70
|
-
* typically derived from
|
|
71
|
-
* DomainConfigManager.getEffectiveIPRules().
|
|
69
|
+
* rules configured in the route configuration. The allowed and blocked IPs are
|
|
70
|
+
* typically derived from route.security.ipAllowList and ipBlockList.
|
|
72
71
|
*
|
|
73
72
|
* @param ip - The IP address to check
|
|
74
|
-
* @param allowedIPs - Array of allowed IP patterns from
|
|
75
|
-
* @param blockedIPs - Array of blocked IP patterns from
|
|
73
|
+
* @param allowedIPs - Array of allowed IP patterns from security.ipAllowList
|
|
74
|
+
* @param blockedIPs - Array of blocked IP patterns from security.ipBlockList
|
|
76
75
|
* @returns true if IP is authorized, false if blocked
|
|
77
76
|
*/
|
|
78
77
|
public isIPAuthorized(ip: string, allowedIPs: string[], blockedIPs: string[] = []): boolean {
|
|
@@ -94,10 +93,10 @@ export class SecurityManager {
|
|
|
94
93
|
* Check if the IP matches any of the glob patterns from security configuration
|
|
95
94
|
*
|
|
96
95
|
* This method checks IP addresses against glob patterns and handles IPv4/IPv6 normalization.
|
|
97
|
-
* It's used to implement IP filtering based on the
|
|
96
|
+
* It's used to implement IP filtering based on the route.security configuration.
|
|
98
97
|
*
|
|
99
98
|
* @param ip - The IP address to check
|
|
100
|
-
* @param patterns - Array of glob patterns from
|
|
99
|
+
* @param patterns - Array of glob patterns from security.ipAllowList or ipBlockList
|
|
101
100
|
* @returns true if IP matches any pattern, false otherwise
|
|
102
101
|
*/
|
|
103
102
|
private isGlobIPMatch(ip: string, patterns: string[]): boolean {
|