@push.rocks/smartproxy 3.28.6 → 3.29.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.
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.iptablesproxy.d.ts +79 -7
- package/dist_ts/classes.iptablesproxy.js +662 -67
- package/dist_ts/classes.networkproxy.d.ts +46 -1
- package/dist_ts/classes.networkproxy.js +347 -8
- package/dist_ts/classes.portproxy.d.ts +36 -0
- package/dist_ts/classes.portproxy.js +464 -365
- package/package.json +2 -2
- package/readme.md +80 -10
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.iptablesproxy.ts +786 -68
- package/ts/classes.networkproxy.ts +417 -7
- package/ts/classes.portproxy.ts +652 -485
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@push.rocks/smartproxy',
|
|
6
|
-
version: '3.
|
|
6
|
+
version: '3.29.1',
|
|
7
7
|
description: 'A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, and dynamic routing with authentication options.'
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx3QkFBd0I7SUFDOUIsT0FBTyxFQUFFLFFBQVE7SUFDakIsV0FBVyxFQUFFLDRMQUE0TDtDQUMxTSxDQUFBIn0=
|
|
@@ -1,40 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a port range for forwarding
|
|
3
|
+
*/
|
|
4
|
+
export interface IPortRange {
|
|
5
|
+
from: number;
|
|
6
|
+
to: number;
|
|
7
|
+
}
|
|
1
8
|
/**
|
|
2
9
|
* Settings for IPTablesProxy.
|
|
3
10
|
*/
|
|
4
11
|
export interface IIpTableProxySettings {
|
|
5
|
-
fromPort: number
|
|
6
|
-
toPort: number
|
|
12
|
+
fromPort: number | IPortRange | Array<number | IPortRange>;
|
|
13
|
+
toPort: number | IPortRange | Array<number | IPortRange>;
|
|
7
14
|
toHost?: string;
|
|
8
15
|
preserveSourceIP?: boolean;
|
|
9
16
|
deleteOnExit?: boolean;
|
|
17
|
+
protocol?: 'tcp' | 'udp' | 'all';
|
|
18
|
+
enableLogging?: boolean;
|
|
19
|
+
ipv6Support?: boolean;
|
|
20
|
+
allowedSourceIPs?: string[];
|
|
21
|
+
bannedSourceIPs?: string[];
|
|
22
|
+
forceCleanSlate?: boolean;
|
|
23
|
+
addJumpRule?: boolean;
|
|
24
|
+
checkExistingRules?: boolean;
|
|
25
|
+
netProxyIntegration?: {
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
redirectLocalhost?: boolean;
|
|
28
|
+
sslTerminationPort?: number;
|
|
29
|
+
};
|
|
10
30
|
}
|
|
11
31
|
/**
|
|
12
32
|
* IPTablesProxy sets up iptables NAT rules to forward TCP traffic.
|
|
13
|
-
*
|
|
33
|
+
* Enhanced with multi-port support, IPv6, and integration with PortProxy/NetworkProxy.
|
|
14
34
|
*/
|
|
15
35
|
export declare class IPTablesProxy {
|
|
16
36
|
settings: IIpTableProxySettings;
|
|
17
|
-
private
|
|
37
|
+
private rules;
|
|
18
38
|
private ruleTag;
|
|
39
|
+
private customChain;
|
|
19
40
|
constructor(settings: IIpTableProxySettings);
|
|
20
41
|
/**
|
|
21
|
-
*
|
|
22
|
-
|
|
42
|
+
* Validates settings to prevent command injection and ensure valid values
|
|
43
|
+
*/
|
|
44
|
+
private validateSettings;
|
|
45
|
+
/**
|
|
46
|
+
* Normalizes port specifications into an array of port ranges
|
|
47
|
+
*/
|
|
48
|
+
private normalizePortSpec;
|
|
49
|
+
/**
|
|
50
|
+
* Gets the appropriate iptables command based on settings
|
|
51
|
+
*/
|
|
52
|
+
private getIptablesCommand;
|
|
53
|
+
/**
|
|
54
|
+
* Checks if a rule already exists in iptables
|
|
55
|
+
*/
|
|
56
|
+
private ruleExists;
|
|
57
|
+
/**
|
|
58
|
+
* Sets up a custom chain for better rule management
|
|
59
|
+
*/
|
|
60
|
+
private setupCustomChain;
|
|
61
|
+
/**
|
|
62
|
+
* Add a source IP filter rule
|
|
63
|
+
*/
|
|
64
|
+
private addSourceIPFilter;
|
|
65
|
+
/**
|
|
66
|
+
* Adds a port forwarding rule
|
|
67
|
+
*/
|
|
68
|
+
private addPortForwardingRule;
|
|
69
|
+
/**
|
|
70
|
+
* Special handling for NetworkProxy integration
|
|
71
|
+
*/
|
|
72
|
+
private setupNetworkProxyIntegration;
|
|
73
|
+
/**
|
|
74
|
+
* Rolls back rules that were added in case of error
|
|
75
|
+
*/
|
|
76
|
+
private rollbackRules;
|
|
77
|
+
/**
|
|
78
|
+
* Sets up iptables rules for port forwarding with enhanced features
|
|
23
79
|
*/
|
|
24
80
|
start(): Promise<void>;
|
|
25
81
|
/**
|
|
26
|
-
* Removes
|
|
82
|
+
* Removes all added iptables rules
|
|
27
83
|
*/
|
|
28
84
|
stop(): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Synchronous version of stop, for use in exit handlers
|
|
87
|
+
*/
|
|
88
|
+
stopSync(): void;
|
|
29
89
|
/**
|
|
30
90
|
* Asynchronously cleans up any iptables rules in the nat table that were added by this module.
|
|
31
91
|
* It looks for rules with comments containing "IPTablesProxy:".
|
|
32
92
|
*/
|
|
33
93
|
static cleanSlate(): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Internal implementation of cleanSlate with IPv6 support
|
|
96
|
+
*/
|
|
97
|
+
private static cleanSlateInternal;
|
|
34
98
|
/**
|
|
35
99
|
* Synchronously cleans up any iptables rules in the nat table that were added by this module.
|
|
36
100
|
* It looks for rules with comments containing "IPTablesProxy:".
|
|
37
101
|
* This method is intended for use in process exit handlers.
|
|
38
102
|
*/
|
|
39
103
|
static cleanSlateSync(): void;
|
|
104
|
+
/**
|
|
105
|
+
* Internal implementation of cleanSlateSync with IPv6 support
|
|
106
|
+
*/
|
|
107
|
+
private static cleanSlateSyncInternal;
|
|
108
|
+
/**
|
|
109
|
+
* Logging utility that respects the enableLogging setting
|
|
110
|
+
*/
|
|
111
|
+
private log;
|
|
40
112
|
}
|