@push.rocks/smartproxy 3.28.5 → 3.29.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.
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartproxy',
6
- version: '3.28.5',
6
+ version: '3.29.0',
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
- * It only supports basic port forwarding and uses iptables comments to tag rules.
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 rulesInstalled;
37
+ private rules;
18
38
  private ruleTag;
39
+ private customChain;
19
40
  constructor(settings: IIpTableProxySettings);
20
41
  /**
21
- * Sets up iptables rules for port forwarding.
22
- * The rules are tagged with a unique comment so that they can be identified later.
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 the iptables rules that were added in start(), by matching the unique comment.
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
  }