fix(strcuture): refactor responsibilities
This commit is contained in:
24
readme.md
24
readme.md
@ -43,7 +43,7 @@ SmartProxy has been restructured using a modern, modular architecture with a uni
|
||||
│ │ ├── route-manager.ts # Route management system
|
||||
│ │ ├── smart-proxy.ts # Main SmartProxy class
|
||||
│ │ └── ... # Supporting classes
|
||||
│ ├── /network-proxy # NetworkProxy implementation
|
||||
│ ├── /http-proxy # HttpProxy implementation (HTTP/HTTPS handling)
|
||||
│ └── /nftables-proxy # NfTablesProxy implementation
|
||||
├── /tls # TLS-specific functionality
|
||||
│ ├── /sni # SNI handling components
|
||||
@ -79,7 +79,7 @@ SmartProxy has been restructured using a modern, modular architecture with a uni
|
||||
|
||||
### Specialized Components
|
||||
|
||||
- **NetworkProxy** (`ts/proxies/network-proxy/network-proxy.ts`)
|
||||
- **HttpProxy** (`ts/proxies/http-proxy/http-proxy.ts`)
|
||||
HTTP/HTTPS reverse proxy with TLS termination and WebSocket support
|
||||
- **Port80Handler** (`ts/http/port80/port80-handler.ts`)
|
||||
ACME HTTP-01 challenge handler for Let's Encrypt certificates
|
||||
@ -101,7 +101,7 @@ SmartProxy has been restructured using a modern, modular architecture with a uni
|
||||
|
||||
- `IRouteConfig`, `IRouteMatch`, `IRouteAction` (`ts/proxies/smart-proxy/models/route-types.ts`)
|
||||
- `IRoutedSmartProxyOptions` (`ts/proxies/smart-proxy/models/route-types.ts`)
|
||||
- `INetworkProxyOptions` (`ts/proxies/network-proxy/models/types.ts`)
|
||||
- `IHttpProxyOptions` (`ts/proxies/http-proxy/models/types.ts`)
|
||||
- `IAcmeOptions`, `IDomainOptions` (`ts/certificate/models/certificate-types.ts`)
|
||||
- `INfTableProxySettings` (`ts/proxies/nftables-proxy/models/interfaces.ts`)
|
||||
|
||||
@ -749,14 +749,14 @@ Available helper functions:
|
||||
|
||||
While SmartProxy provides a unified API for most needs, you can also use individual components:
|
||||
|
||||
### NetworkProxy
|
||||
### HttpProxy
|
||||
For HTTP/HTTPS reverse proxy with TLS termination and WebSocket support. Now with native route-based configuration support:
|
||||
|
||||
```typescript
|
||||
import { NetworkProxy } from '@push.rocks/smartproxy';
|
||||
import { HttpProxy } from '@push.rocks/smartproxy';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const proxy = new NetworkProxy({ port: 443 });
|
||||
const proxy = new HttpProxy({ port: 443 });
|
||||
await proxy.start();
|
||||
|
||||
// Modern route-based configuration (recommended)
|
||||
@ -781,7 +781,7 @@ await proxy.updateRouteConfigs([
|
||||
},
|
||||
advanced: {
|
||||
headers: {
|
||||
'X-Forwarded-By': 'NetworkProxy'
|
||||
'X-Forwarded-By': 'HttpProxy'
|
||||
},
|
||||
urlRewrite: {
|
||||
pattern: '^/old/(.*)$',
|
||||
@ -1053,7 +1053,7 @@ flowchart TB
|
||||
direction TB
|
||||
RouteConfig["Route Configuration<br>(Match/Action)"]
|
||||
RouteManager["Route Manager"]
|
||||
HTTPS443["HTTPS Port 443<br>NetworkProxy"]
|
||||
HTTPS443["HTTPS Port 443<br>HttpProxy"]
|
||||
SmartProxy["SmartProxy<br>(TCP/SNI Proxy)"]
|
||||
ACME["Port80Handler<br>(ACME HTTP-01)"]
|
||||
Certs[(SSL Certificates)]
|
||||
@ -1439,7 +1439,7 @@ createRedirectRoute({
|
||||
- `getListeningPorts()` - Get all ports currently being listened on
|
||||
- `async updateRoutes(routes: IRouteConfig[])` - Update routes and automatically adjust port listeners
|
||||
|
||||
### NetworkProxy (INetworkProxyOptions)
|
||||
### HttpProxy (IHttpProxyOptions)
|
||||
- `port` (number, required) - Main port to listen on
|
||||
- `backendProtocol` ('http1'|'http2', default 'http1') - Protocol to use with backend servers
|
||||
- `maxConnections` (number, default 10000) - Maximum concurrent connections
|
||||
@ -1452,8 +1452,8 @@ createRedirectRoute({
|
||||
- `useExternalPort80Handler` (boolean) - Use external port 80 handler for ACME challenges
|
||||
- `portProxyIntegration` (boolean) - Integration with other proxies
|
||||
|
||||
#### NetworkProxy Enhanced Features
|
||||
NetworkProxy now supports full route-based configuration including:
|
||||
#### HttpProxy Enhanced Features
|
||||
HttpProxy now supports full route-based configuration including:
|
||||
- Advanced request and response header manipulation
|
||||
- URL rewriting with RegExp pattern matching
|
||||
- Template variable resolution for dynamic values (e.g. `{domain}`, `{clientIp}`)
|
||||
@ -1507,7 +1507,7 @@ NetworkProxy now supports full route-based configuration including:
|
||||
- Ensure domains are publicly accessible for Let's Encrypt validation
|
||||
- For TLS handshake issues, increase `initialDataTimeout` and `maxPendingDataSize`
|
||||
|
||||
### NetworkProxy
|
||||
### HttpProxy
|
||||
- Verify ports, certificates and `rejectUnauthorized` for TLS errors
|
||||
- Configure CORS for preflight issues
|
||||
- Increase `maxConnections` or `connectionPoolSize` under load
|
||||
|
Reference in New Issue
Block a user