@push.rocks/smartproxy 3.22.5 → 3.23.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.22.5',
6
+ version: '3.23.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=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@push.rocks/smartproxy",
3
- "version": "3.22.5",
3
+ "version": "3.23.0",
4
4
  "private": false,
5
5
  "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.",
6
6
  "main": "dist_ts/index.js",
package/readme.md CHANGED
@@ -2,6 +2,192 @@
2
2
 
3
3
  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.
4
4
 
5
+ ## Architecture & Flow Diagrams
6
+
7
+ ### Component Architecture
8
+ The diagram below illustrates the main components of SmartProxy and how they interact:
9
+
10
+ ```mermaid
11
+ flowchart TB
12
+ Client([Client])
13
+
14
+ subgraph "SmartProxy Components"
15
+ direction TB
16
+ HTTP80[HTTP Port 80\nSslRedirect]
17
+ HTTPS443[HTTPS Port 443\nNetworkProxy]
18
+ PortProxy[TCP Port Proxy\nwith SNI routing]
19
+ IPTables[IPTablesProxy]
20
+ Router[ProxyRouter]
21
+ ACME[Port80Handler\nACME/Let's Encrypt]
22
+ Certs[(SSL Certificates)]
23
+ end
24
+
25
+ subgraph "Backend Services"
26
+ Service1[Service 1]
27
+ Service2[Service 2]
28
+ Service3[Service 3]
29
+ end
30
+
31
+ Client -->|HTTP Request| HTTP80
32
+ HTTP80 -->|Redirect| Client
33
+ Client -->|HTTPS Request| HTTPS443
34
+ Client -->|TLS/TCP| PortProxy
35
+
36
+ HTTPS443 -->|Route Request| Router
37
+ Router -->|Proxy Request| Service1
38
+ Router -->|Proxy Request| Service2
39
+
40
+ PortProxy -->|Direct TCP| Service2
41
+ PortProxy -->|Direct TCP| Service3
42
+
43
+ IPTables -.->|Low-level forwarding| PortProxy
44
+
45
+ HTTP80 -.->|Challenge Response| ACME
46
+ ACME -.->|Generate/Manage| Certs
47
+ Certs -.->|Provide TLS Certs| HTTPS443
48
+
49
+ classDef component fill:#f9f,stroke:#333,stroke-width:2px;
50
+ classDef backend fill:#bbf,stroke:#333,stroke-width:1px;
51
+ classDef client fill:#dfd,stroke:#333,stroke-width:2px;
52
+
53
+ class Client client;
54
+ class HTTP80,HTTPS443,PortProxy,IPTables,Router,ACME component;
55
+ class Service1,Service2,Service3 backend;
56
+ ```
57
+
58
+ ### HTTPS Reverse Proxy Flow
59
+ This diagram shows how HTTPS requests are handled and proxied to backend services:
60
+
61
+ ```mermaid
62
+ sequenceDiagram
63
+ participant Client
64
+ participant NetworkProxy
65
+ participant ProxyRouter
66
+ participant Backend
67
+
68
+ Client->>NetworkProxy: HTTPS Request
69
+
70
+ Note over NetworkProxy: TLS Termination
71
+
72
+ NetworkProxy->>ProxyRouter: Route Request
73
+ ProxyRouter->>ProxyRouter: Match hostname to config
74
+
75
+ alt Authentication Required
76
+ NetworkProxy->>Client: Request Authentication
77
+ Client->>NetworkProxy: Send Credentials
78
+ NetworkProxy->>NetworkProxy: Validate Credentials
79
+ end
80
+
81
+ NetworkProxy->>Backend: Forward Request
82
+ Backend->>NetworkProxy: Response
83
+
84
+ Note over NetworkProxy: Add Default Headers
85
+
86
+ NetworkProxy->>Client: Forward Response
87
+
88
+ alt WebSocket Request
89
+ Client->>NetworkProxy: Upgrade to WebSocket
90
+ NetworkProxy->>Backend: Upgrade to WebSocket
91
+ loop WebSocket Active
92
+ Client->>NetworkProxy: WebSocket Message
93
+ NetworkProxy->>Backend: Forward Message
94
+ Backend->>NetworkProxy: WebSocket Message
95
+ NetworkProxy->>Client: Forward Message
96
+ NetworkProxy-->>NetworkProxy: Heartbeat Check
97
+ end
98
+ end
99
+ ```
100
+
101
+ ### Port Proxy with SNI-based Routing
102
+ This diagram illustrates how TCP connections with SNI (Server Name Indication) are processed and forwarded:
103
+
104
+ ```mermaid
105
+ sequenceDiagram
106
+ participant Client
107
+ participant PortProxy
108
+ participant Backend
109
+
110
+ Client->>PortProxy: TLS Connection
111
+
112
+ alt SNI Enabled
113
+ PortProxy->>Client: Accept Connection
114
+ Client->>PortProxy: TLS ClientHello with SNI
115
+ PortProxy->>PortProxy: Extract SNI Hostname
116
+ PortProxy->>PortProxy: Match Domain Config
117
+ PortProxy->>PortProxy: Validate Client IP
118
+
119
+ alt IP Allowed
120
+ PortProxy->>Backend: Forward Connection
121
+ Note over PortProxy,Backend: Bidirectional Data Flow
122
+ else IP Rejected
123
+ PortProxy->>Client: Close Connection
124
+ end
125
+ else Port-based Routing
126
+ PortProxy->>PortProxy: Match Port Range
127
+ PortProxy->>PortProxy: Find Domain Config
128
+ PortProxy->>PortProxy: Validate Client IP
129
+
130
+ alt IP Allowed
131
+ PortProxy->>Backend: Forward Connection
132
+ Note over PortProxy,Backend: Bidirectional Data Flow
133
+ else IP Rejected
134
+ PortProxy->>Client: Close Connection
135
+ end
136
+ end
137
+
138
+ loop Connection Active
139
+ PortProxy-->>PortProxy: Monitor Activity
140
+ PortProxy-->>PortProxy: Check Max Lifetime
141
+ alt Inactivity or Max Lifetime Exceeded
142
+ PortProxy->>Client: Close Connection
143
+ PortProxy->>Backend: Close Connection
144
+ end
145
+ end
146
+ ```
147
+
148
+ ### Let's Encrypt Certificate Acquisition
149
+ This diagram shows how certificates are automatically acquired through the ACME protocol:
150
+
151
+ ```mermaid
152
+ sequenceDiagram
153
+ participant Client
154
+ participant Port80Handler
155
+ participant ACME as Let's Encrypt ACME
156
+ participant NetworkProxy
157
+
158
+ Client->>Port80Handler: HTTP Request for domain
159
+
160
+ alt Certificate Exists
161
+ Port80Handler->>Client: Redirect to HTTPS
162
+ else No Certificate
163
+ Port80Handler->>Port80Handler: Mark domain as obtaining cert
164
+ Port80Handler->>ACME: Create account & new order
165
+ ACME->>Port80Handler: Challenge information
166
+
167
+ Port80Handler->>Port80Handler: Store challenge token & key authorization
168
+
169
+ ACME->>Port80Handler: HTTP-01 Challenge Request
170
+ Port80Handler->>ACME: Challenge Response
171
+
172
+ ACME->>ACME: Validate domain ownership
173
+ ACME->>Port80Handler: Challenge validated
174
+
175
+ Port80Handler->>Port80Handler: Generate CSR
176
+ Port80Handler->>ACME: Submit CSR
177
+ ACME->>Port80Handler: Issue Certificate
178
+
179
+ Port80Handler->>Port80Handler: Store certificate & private key
180
+ Port80Handler->>Port80Handler: Mark certificate as obtained
181
+
182
+ Note over Port80Handler,NetworkProxy: Certificate available for use
183
+
184
+ Client->>Port80Handler: Another HTTP Request
185
+ Port80Handler->>Client: Redirect to HTTPS
186
+ Client->>NetworkProxy: HTTPS Request
187
+ Note over NetworkProxy: Uses new certificate
188
+ end
189
+ ```
190
+
5
191
  ## Features
6
192
 
7
193
  - **HTTPS Reverse Proxy** - Route traffic to backend services based on hostname with TLS termination
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartproxy',
6
- version: '3.22.5',
6
+ version: '3.23.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
  }