@push.rocks/smartproxy 19.3.6 → 19.3.9
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/proxies/smart-proxy/http-proxy-bridge.js +16 -3
- package/dist_ts/proxies/smart-proxy/route-connection-handler.d.ts +4 -0
- package/dist_ts/proxies/smart-proxy/route-connection-handler.js +120 -187
- package/dist_ts/proxies/smart-proxy/route-manager.js +13 -4
- package/package.json +1 -1
- package/readme.hints.md +42 -1
- package/readme.md +18 -0
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/proxies/smart-proxy/http-proxy-bridge.ts +15 -2
- package/ts/proxies/smart-proxy/route-connection-handler.ts +173 -248
- package/ts/proxies/smart-proxy/route-manager.ts +12 -3
- package/readme.plan.md +0 -179
package/readme.plan.md
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
# SmartProxy v19.4.0 - Completed Refactoring
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
SmartProxy has been successfully refactored with clearer separation of concerns between HTTP/HTTPS traffic handling and low-level connection routing. Version 19.4.0 introduces global ACME configuration and enhanced route management.
|
|
6
|
-
|
|
7
|
-
## Current Architecture (v19.4.0)
|
|
8
|
-
|
|
9
|
-
### HttpProxy (formerly NetworkProxy)
|
|
10
|
-
**Purpose**: Handle all HTTP/HTTPS traffic with TLS termination
|
|
11
|
-
|
|
12
|
-
**Current Responsibilities**:
|
|
13
|
-
- TLS termination for HTTPS
|
|
14
|
-
- HTTP/1.1 and HTTP/2 protocol handling
|
|
15
|
-
- HTTP request/response parsing
|
|
16
|
-
- HTTP to HTTPS redirects
|
|
17
|
-
- ACME challenge handling
|
|
18
|
-
- Static route handlers
|
|
19
|
-
- WebSocket protocol upgrades
|
|
20
|
-
- Connection pooling for backend servers
|
|
21
|
-
- Certificate management integration
|
|
22
|
-
|
|
23
|
-
### SmartProxy
|
|
24
|
-
**Purpose**: Central API for all proxy needs with route-based configuration
|
|
25
|
-
|
|
26
|
-
**Current Responsibilities**:
|
|
27
|
-
- Port management (listen on multiple ports)
|
|
28
|
-
- Route-based connection routing
|
|
29
|
-
- TLS passthrough (SNI-based routing)
|
|
30
|
-
- NFTables integration
|
|
31
|
-
- Certificate management via SmartCertManager
|
|
32
|
-
- Raw TCP proxying
|
|
33
|
-
- Connection lifecycle management
|
|
34
|
-
- Global ACME configuration (v19+)
|
|
35
|
-
|
|
36
|
-
## Completed Implementation
|
|
37
|
-
|
|
38
|
-
### Phase 1: Rename and Reorganize ✅
|
|
39
|
-
- NetworkProxy renamed to HttpProxy
|
|
40
|
-
- Directory structure reorganized
|
|
41
|
-
- All imports and references updated
|
|
42
|
-
|
|
43
|
-
### Phase 2: Certificate Management ✅
|
|
44
|
-
- Unified certificate management in SmartCertManager
|
|
45
|
-
- Global ACME configuration support (v19+)
|
|
46
|
-
- Route-level certificate overrides
|
|
47
|
-
- Automatic renewal system
|
|
48
|
-
- Renamed `network-proxy.ts` to `http-proxy.ts`
|
|
49
|
-
- Updated `NetworkProxy` class to `HttpProxy` class
|
|
50
|
-
- Updated all type definitions and interfaces
|
|
51
|
-
|
|
52
|
-
3. **Update exports**
|
|
53
|
-
- Updated exports in `ts/index.ts`
|
|
54
|
-
- Fixed imports across the codebase
|
|
55
|
-
|
|
56
|
-
### Phase 2: Extract HTTP Logic from SmartProxy ✅
|
|
57
|
-
|
|
58
|
-
1. **Create HTTP handler modules in HttpProxy**
|
|
59
|
-
- Created handlers directory with:
|
|
60
|
-
- `redirect-handler.ts` - HTTP redirect logic
|
|
61
|
-
- `static-handler.ts` - Static/ACME route handling
|
|
62
|
-
- `index.ts` - Module exports
|
|
63
|
-
|
|
64
|
-
2. **Move HTTP parsing from RouteConnectionHandler**
|
|
65
|
-
- Updated `handleRedirectAction` to delegate to `RedirectHandler`
|
|
66
|
-
- Updated `handleStaticAction` to delegate to `StaticHandler`
|
|
67
|
-
- Removed duplicated HTTP parsing logic
|
|
68
|
-
|
|
69
|
-
3. **Clean up references and naming**
|
|
70
|
-
- Updated all NetworkProxy references to HttpProxy
|
|
71
|
-
- Renamed config properties: `useNetworkProxy` → `useHttpProxy`
|
|
72
|
-
- Renamed config properties: `networkProxyPort` → `httpProxyPort`
|
|
73
|
-
- Fixed HttpProxyBridge methods and references
|
|
74
|
-
|
|
75
|
-
### Phase 3: Simplify SmartProxy
|
|
76
|
-
|
|
77
|
-
1. **Update RouteConnectionHandler**
|
|
78
|
-
- Remove embedded HTTP parsing
|
|
79
|
-
- Delegate HTTP routes to HttpProxy
|
|
80
|
-
- Focus on connection routing only
|
|
81
|
-
|
|
82
|
-
2. **Simplified route handling**
|
|
83
|
-
```typescript
|
|
84
|
-
// Simplified handleRedirectAction
|
|
85
|
-
private handleRedirectAction(socket, record, route) {
|
|
86
|
-
// Delegate to HttpProxy
|
|
87
|
-
this.httpProxy.handleRedirect(socket, route);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Simplified handleStaticAction
|
|
91
|
-
private handleStaticAction(socket, record, route) {
|
|
92
|
-
// Delegate to HttpProxy
|
|
93
|
-
this.httpProxy.handleStatic(socket, route);
|
|
94
|
-
}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
3. **Update NetworkProxyBridge**
|
|
98
|
-
- Rename to HttpProxyBridge
|
|
99
|
-
- Update integration points
|
|
100
|
-
|
|
101
|
-
### Phase 4: Consolidate HTTP Utilities ✅
|
|
102
|
-
|
|
103
|
-
1. **Move HTTP types to http-proxy**
|
|
104
|
-
- Created consolidated `http-types.ts` in `ts/proxies/http-proxy/models/`
|
|
105
|
-
- Includes HTTP status codes, error classes, and interfaces
|
|
106
|
-
- Added helper functions like `getStatusText()`
|
|
107
|
-
|
|
108
|
-
2. **Clean up ts/http directory**
|
|
109
|
-
- Kept only router functionality
|
|
110
|
-
- Replaced local HTTP types with re-exports from HttpProxy
|
|
111
|
-
- Updated imports throughout the codebase to use consolidated types
|
|
112
|
-
|
|
113
|
-
### Phase 5: Update Tests and Documentation ✅
|
|
114
|
-
|
|
115
|
-
1. **Update test files**
|
|
116
|
-
- Renamed NetworkProxy references to HttpProxy
|
|
117
|
-
- Renamed test files to match new naming
|
|
118
|
-
- Updated imports and references throughout tests
|
|
119
|
-
- Fixed certificate manager method names
|
|
120
|
-
|
|
121
|
-
2. **Update documentation**
|
|
122
|
-
- Updated README to reflect HttpProxy naming
|
|
123
|
-
- Updated architecture descriptions
|
|
124
|
-
- Updated usage examples
|
|
125
|
-
- Fixed all API documentation references
|
|
126
|
-
|
|
127
|
-
## Migration Steps
|
|
128
|
-
|
|
129
|
-
1. Create feature branch: `refactor/http-proxy-consolidation`
|
|
130
|
-
2. Phase 1: Rename NetworkProxy (1 day)
|
|
131
|
-
3. Phase 2: Extract HTTP logic (2 days)
|
|
132
|
-
4. Phase 3: Simplify SmartProxy (1 day)
|
|
133
|
-
5. Phase 4: Consolidate utilities (1 day)
|
|
134
|
-
6. Phase 5: Update tests/docs (1 day)
|
|
135
|
-
7. Integration testing (1 day)
|
|
136
|
-
8. Code review and merge
|
|
137
|
-
|
|
138
|
-
## Benefits
|
|
139
|
-
|
|
140
|
-
1. **Clear Separation**: HTTP/HTTPS handling is clearly separated from TCP routing
|
|
141
|
-
2. **Better Naming**: HttpProxy clearly indicates its purpose
|
|
142
|
-
3. **No Duplication**: HTTP parsing logic exists in one place
|
|
143
|
-
4. **Maintainability**: Easier to modify HTTP handling without affecting routing
|
|
144
|
-
5. **Testability**: Each component has a single responsibility
|
|
145
|
-
6. **Performance**: Optimized paths for different traffic types
|
|
146
|
-
|
|
147
|
-
## Future Enhancements
|
|
148
|
-
|
|
149
|
-
After this refactoring, we can more easily add:
|
|
150
|
-
|
|
151
|
-
1. HTTP/3 (QUIC) support in HttpProxy
|
|
152
|
-
2. Advanced HTTP features (compression, caching)
|
|
153
|
-
3. HTTP middleware system
|
|
154
|
-
4. Protocol-specific optimizations
|
|
155
|
-
5. Better HTTP/2 multiplexing
|
|
156
|
-
|
|
157
|
-
## Breaking Changes from v18 to v19
|
|
158
|
-
|
|
159
|
-
1. `NetworkProxy` class renamed to `HttpProxy`
|
|
160
|
-
2. Import paths change from `network-proxy` to `http-proxy`
|
|
161
|
-
3. Global ACME configuration now available at the top level
|
|
162
|
-
4. Certificate management unified under SmartCertManager
|
|
163
|
-
|
|
164
|
-
## Future Enhancements
|
|
165
|
-
|
|
166
|
-
1. HTTP/3 (QUIC) support in HttpProxy
|
|
167
|
-
2. Advanced HTTP features (compression, caching)
|
|
168
|
-
3. HTTP middleware system
|
|
169
|
-
4. Protocol-specific optimizations
|
|
170
|
-
5. Better HTTP/2 multiplexing
|
|
171
|
-
6. Enhanced monitoring and metrics
|
|
172
|
-
|
|
173
|
-
## Key Features in v19.4.0
|
|
174
|
-
|
|
175
|
-
1. **Global ACME Configuration**: Default settings for all routes with `certificate: 'auto'`
|
|
176
|
-
2. **Enhanced Route Management**: Better separation between routing and certificate management
|
|
177
|
-
3. **Improved Test Coverage**: Fixed test exports and port bindings
|
|
178
|
-
4. **Better Error Messages**: Clear guidance for ACME configuration issues
|
|
179
|
-
5. **Non-Privileged Port Support**: Examples for development environments
|