@serve.zone/remoteingress 3.0.0 → 3.0.2
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/package.json +1 -1
- package/readme.hints.md +9 -3
- package/readme.md +163 -55
- package/ts/00_commitinfo_data.ts +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@serve.zone/remoteingress',
|
|
6
|
-
version: '3.0.
|
|
6
|
+
version: '3.0.2',
|
|
7
7
|
description: 'Edge ingress tunnel for DcRouter - accepts incoming TCP connections at network edge and tunnels them to DcRouter SmartProxy preserving client IP via PROXY protocol v1.'
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSwyQkFBMkI7SUFDakMsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLHlLQUF5SztDQUN2TCxDQUFBIn0=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serve.zone/remoteingress",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Edge ingress tunnel for DcRouter - accepts incoming TCP connections at network edge and tunnels them to DcRouter SmartProxy preserving client IP via PROXY protocol v1.",
|
|
6
6
|
"main": "dist_ts/index.js",
|
package/readme.hints.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
*
|
|
2
|
-
*
|
|
3
|
-
*
|
|
1
|
+
* This module is part of the @serve.zone stack
|
|
2
|
+
* v3.0.0+ uses a Hub/Edge architecture with a Rust core binary (`remoteingress-bin`)
|
|
3
|
+
* TypeScript classes `RemoteIngressHub` and `RemoteIngressEdge` bridge to Rust via `@push.rocks/smartrust` RustBridge IPC
|
|
4
|
+
* Custom multiplexed binary frame protocol over TLS for tunneling TCP connections
|
|
5
|
+
* PROXY protocol v1 preserves client IP when forwarding to SmartProxy/DcRouter
|
|
6
|
+
* Edge authenticates to Hub via shared secret over TLS
|
|
7
|
+
* STUN-based public IP discovery at the edge (Cloudflare STUN server)
|
|
8
|
+
* Cross-compiled Rust binary for linux/amd64 and linux/arm64
|
|
9
|
+
* Old `ConnectorPublic`/`ConnectorPrivate` classes no longer exist (removed in v2.0.0/v3.0.0)
|
package/readme.md
CHANGED
|
@@ -1,107 +1,215 @@
|
|
|
1
1
|
# @serve.zone/remoteingress
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Edge ingress tunnel for DcRouter — accepts incoming TCP connections at the network edge and tunnels them to a DcRouter SmartProxy instance, preserving the original client IP via PROXY protocol v1.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Issue Reporting and Security
|
|
6
|
+
|
|
7
|
+
For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
## Install
|
|
8
10
|
|
|
9
11
|
```sh
|
|
10
|
-
|
|
12
|
+
pnpm install @serve.zone/remoteingress
|
|
11
13
|
```
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
## 🏗️ Architecture
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
`@serve.zone/remoteingress` uses a **Hub ↔ Edge** topology with a high-performance Rust core and a TypeScript API surface:
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
```
|
|
20
|
+
┌─────────────────────┐ TLS Tunnel ┌─────────────────────┐
|
|
21
|
+
│ Network Edge │ ◄══════════════════════════► │ Private Cluster │
|
|
22
|
+
│ │ (multiplexed frames + │ │
|
|
23
|
+
│ RemoteIngressEdge │ shared-secret auth) │ RemoteIngressHub │
|
|
24
|
+
│ Listens on :80,:443│ │ Forwards to │
|
|
25
|
+
│ Accepts client TCP │ │ SmartProxy on │
|
|
26
|
+
│ │ │ local ports │
|
|
27
|
+
└─────────────────────┘ └─────────────────────┘
|
|
28
|
+
▲ │
|
|
29
|
+
│ TCP from end users ▼
|
|
30
|
+
Internet DcRouter / SmartProxy
|
|
31
|
+
```
|
|
18
32
|
|
|
19
|
-
|
|
33
|
+
| Component | Role |
|
|
34
|
+
|-----------|------|
|
|
35
|
+
| **RemoteIngressEdge** | Deployed at the network edge (e.g. a VPS or cloud instance). Listens on public ports, accepts raw TCP connections, and multiplexes them over a single TLS tunnel to the hub. |
|
|
36
|
+
| **RemoteIngressHub** | Deployed alongside DcRouter/SmartProxy in a private cluster. Accepts edge connections, demuxes streams, and forwards each to SmartProxy with a PROXY protocol v1 header so the real client IP is preserved. |
|
|
37
|
+
| **Rust Binary** (`remoteingress-bin`) | The performance-critical networking core. Managed via `@push.rocks/smartrust` RustBridge IPC — you never interact with it directly. Cross-compiled for `linux/amd64` and `linux/arm64`. |
|
|
20
38
|
|
|
21
|
-
|
|
39
|
+
### 🔑 Key Features
|
|
22
40
|
|
|
23
|
-
|
|
41
|
+
- 🔒 **TLS-encrypted tunnel** between edge and hub (auto-generated self-signed cert or bring your own)
|
|
42
|
+
- 🔀 **Multiplexed streams** — thousands of client connections flow over a single tunnel
|
|
43
|
+
- 🌐 **PROXY protocol v1** — SmartProxy sees the real client IP, not the tunnel IP
|
|
44
|
+
- 🔐 **Shared-secret authentication** — edges must present valid credentials to connect
|
|
45
|
+
- 📡 **STUN-based public IP discovery** — the edge automatically discovers its public IP via Cloudflare STUN
|
|
46
|
+
- 🔄 **Auto-reconnect** with exponential backoff if the tunnel drops
|
|
47
|
+
- 📢 **Event-driven** — both Hub and Edge extend `EventEmitter` for real-time monitoring
|
|
48
|
+
- ⚡ **Rust core** — all frame encoding, TLS, and TCP proxying happen in native code for maximum throughput
|
|
24
49
|
|
|
25
|
-
|
|
50
|
+
## Usage
|
|
26
51
|
|
|
27
|
-
|
|
52
|
+
Both classes are imported from the package and communicate with the Rust binary under the hood. All you need to do is configure and start them.
|
|
28
53
|
|
|
29
|
-
|
|
54
|
+
### Setting up the Hub (private cluster side)
|
|
30
55
|
|
|
31
56
|
```typescript
|
|
32
|
-
import {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
57
|
+
import { RemoteIngressHub } from '@serve.zone/remoteingress';
|
|
58
|
+
|
|
59
|
+
const hub = new RemoteIngressHub();
|
|
60
|
+
|
|
61
|
+
// Listen for events
|
|
62
|
+
hub.on('edgeConnected', ({ edgeId }) => {
|
|
63
|
+
console.log(`✅ Edge ${edgeId} connected`);
|
|
64
|
+
});
|
|
65
|
+
hub.on('edgeDisconnected', ({ edgeId }) => {
|
|
66
|
+
console.log(`❌ Edge ${edgeId} disconnected`);
|
|
67
|
+
});
|
|
68
|
+
hub.on('streamOpened', ({ edgeId, streamId }) => {
|
|
69
|
+
console.log(`🔗 Stream ${streamId} opened from edge ${edgeId}`);
|
|
70
|
+
});
|
|
71
|
+
hub.on('streamClosed', ({ edgeId, streamId }) => {
|
|
72
|
+
console.log(`🔗 Stream ${streamId} closed from edge ${edgeId}`);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Start the hub — it will listen for incoming edge TLS connections
|
|
76
|
+
await hub.start({
|
|
77
|
+
tunnelPort: 8443, // port edges connect to (default: 8443)
|
|
78
|
+
targetHost: '127.0.0.1', // SmartProxy host to forward streams to (default: 127.0.0.1)
|
|
42
79
|
});
|
|
43
|
-
```
|
|
44
80
|
|
|
45
|
-
|
|
81
|
+
// Register which edges are allowed to connect
|
|
82
|
+
await hub.updateAllowedEdges([
|
|
83
|
+
{ id: 'edge-nyc-01', secret: 'supersecrettoken1' },
|
|
84
|
+
{ id: 'edge-fra-02', secret: 'supersecrettoken2' },
|
|
85
|
+
]);
|
|
86
|
+
|
|
87
|
+
// Check status at any time
|
|
88
|
+
const status = await hub.getStatus();
|
|
89
|
+
console.log(status);
|
|
90
|
+
// {
|
|
91
|
+
// running: true,
|
|
92
|
+
// tunnelPort: 8443,
|
|
93
|
+
// connectedEdges: [
|
|
94
|
+
// { edgeId: 'edge-nyc-01', connectedAt: 1700000000, activeStreams: 12 }
|
|
95
|
+
// ]
|
|
96
|
+
// }
|
|
97
|
+
|
|
98
|
+
// Graceful shutdown
|
|
99
|
+
await hub.stop();
|
|
100
|
+
```
|
|
46
101
|
|
|
47
|
-
|
|
102
|
+
### Setting up the Edge (network edge side)
|
|
48
103
|
|
|
49
104
|
```typescript
|
|
50
|
-
import {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
105
|
+
import { RemoteIngressEdge } from '@serve.zone/remoteingress';
|
|
106
|
+
|
|
107
|
+
const edge = new RemoteIngressEdge();
|
|
108
|
+
|
|
109
|
+
// Listen for events
|
|
110
|
+
edge.on('tunnelConnected', () => {
|
|
111
|
+
console.log('🟢 Tunnel to hub established');
|
|
112
|
+
});
|
|
113
|
+
edge.on('tunnelDisconnected', () => {
|
|
114
|
+
console.log('🔴 Tunnel to hub lost — will auto-reconnect');
|
|
115
|
+
});
|
|
116
|
+
edge.on('publicIpDiscovered', ({ ip }) => {
|
|
117
|
+
console.log(`🌐 Public IP: ${ip}`);
|
|
59
118
|
});
|
|
119
|
+
|
|
120
|
+
// Start the edge — it connects to the hub and starts listening for clients
|
|
121
|
+
await edge.start({
|
|
122
|
+
hubHost: 'hub.example.com', // hostname or IP of the hub
|
|
123
|
+
hubPort: 8443, // must match hub's tunnelPort (default: 8443)
|
|
124
|
+
edgeId: 'edge-nyc-01', // unique edge identifier
|
|
125
|
+
secret: 'supersecrettoken1', // must match the hub's allowed edge secret
|
|
126
|
+
listenPorts: [80, 443], // public ports to accept TCP connections on
|
|
127
|
+
stunIntervalSecs: 300, // STUN refresh interval in seconds (default: 300)
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// Check status at any time
|
|
131
|
+
const status = await edge.getStatus();
|
|
132
|
+
console.log(status);
|
|
133
|
+
// {
|
|
134
|
+
// running: true,
|
|
135
|
+
// connected: true,
|
|
136
|
+
// publicIp: '203.0.113.42',
|
|
137
|
+
// activeStreams: 5,
|
|
138
|
+
// listenPorts: [80, 443]
|
|
139
|
+
// }
|
|
140
|
+
|
|
141
|
+
// Graceful shutdown
|
|
142
|
+
await edge.stop();
|
|
60
143
|
```
|
|
61
144
|
|
|
62
|
-
###
|
|
145
|
+
### API Reference
|
|
63
146
|
|
|
64
|
-
|
|
147
|
+
#### `RemoteIngressHub`
|
|
65
148
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
149
|
+
| Method / Property | Description |
|
|
150
|
+
|-------------------|-------------|
|
|
151
|
+
| `start(config?)` | Spawns the Rust binary and starts the tunnel listener. Config: `{ tunnelPort?: number, targetHost?: string }` |
|
|
152
|
+
| `stop()` | Gracefully shuts down the hub and kills the Rust process. |
|
|
153
|
+
| `updateAllowedEdges(edges)` | Dynamically update which edges are authorized. Each edge: `{ id: string, secret: string }` |
|
|
154
|
+
| `getStatus()` | Returns current hub status including connected edges and active stream counts. |
|
|
155
|
+
| `running` | `boolean` — whether the Rust binary is alive. |
|
|
69
156
|
|
|
70
|
-
|
|
157
|
+
**Events:** `edgeConnected`, `edgeDisconnected`, `streamOpened`, `streamClosed`
|
|
71
158
|
|
|
72
|
-
|
|
159
|
+
#### `RemoteIngressEdge`
|
|
73
160
|
|
|
74
|
-
|
|
161
|
+
| Method / Property | Description |
|
|
162
|
+
|-------------------|-------------|
|
|
163
|
+
| `start(config)` | Spawns the Rust binary, connects to the hub, and starts listening on the specified ports. |
|
|
164
|
+
| `stop()` | Gracefully shuts down the edge and kills the Rust process. |
|
|
165
|
+
| `getStatus()` | Returns current edge status including connection state, public IP, and active streams. |
|
|
166
|
+
| `running` | `boolean` — whether the Rust binary is alive. |
|
|
75
167
|
|
|
76
|
-
|
|
168
|
+
**Events:** `tunnelConnected`, `tunnelDisconnected`, `publicIpDiscovered`
|
|
77
169
|
|
|
78
|
-
|
|
170
|
+
### 🔌 Wire Protocol
|
|
79
171
|
|
|
80
|
-
|
|
172
|
+
The tunnel uses a custom binary frame protocol over TLS:
|
|
81
173
|
|
|
82
|
-
|
|
174
|
+
```
|
|
175
|
+
[stream_id: 4 bytes][type: 1 byte][length: 4 bytes][payload: N bytes]
|
|
176
|
+
```
|
|
83
177
|
|
|
84
|
-
|
|
178
|
+
| Frame Type | Value | Direction | Purpose |
|
|
179
|
+
|------------|-------|-----------|---------|
|
|
180
|
+
| `OPEN` | `0x01` | Edge → Hub | Open a new stream; payload is PROXY v1 header |
|
|
181
|
+
| `DATA` | `0x02` | Edge → Hub | Client data flowing upstream |
|
|
182
|
+
| `CLOSE` | `0x03` | Edge → Hub | Client closed the connection |
|
|
183
|
+
| `DATA_BACK` | `0x04` | Hub → Edge | Response data flowing downstream |
|
|
184
|
+
| `CLOSE_BACK` | `0x05` | Hub → Edge | Upstream (SmartProxy) closed the connection |
|
|
85
185
|
|
|
86
|
-
|
|
186
|
+
Max payload size per frame: **16 MB**.
|
|
187
|
+
|
|
188
|
+
### Example Scenarios
|
|
87
189
|
|
|
88
|
-
|
|
190
|
+
1. **Expose a private Kubernetes cluster to the internet** — Deploy an Edge on a public VPS, configure your DNS to point to the VPS IP. The Edge tunnels all traffic to the Hub running inside the cluster, which hands it off to SmartProxy/DcRouter. Your cluster stays fully private — no public-facing ports needed.
|
|
191
|
+
|
|
192
|
+
2. **Multi-region edge ingress** — Run multiple Edges in different geographic regions (NYC, Frankfurt, Tokyo) all connecting to a single Hub. Use GeoDNS to route users to their nearest Edge. The Hub sees the real client IPs via PROXY protocol regardless of which edge they connected through.
|
|
193
|
+
|
|
194
|
+
3. **Secure API exposure** — Your backend runs on a private network with no direct internet access. An Edge on a minimal cloud instance acts as the only public entry point. TLS tunnel + shared-secret auth ensure only your authorized Edge can forward traffic.
|
|
89
195
|
|
|
90
196
|
## License and Legal Information
|
|
91
197
|
|
|
92
|
-
This repository contains open-source code
|
|
198
|
+
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [LICENSE](./LICENSE) file.
|
|
93
199
|
|
|
94
200
|
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
|
95
201
|
|
|
96
202
|
### Trademarks
|
|
97
203
|
|
|
98
|
-
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein.
|
|
204
|
+
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.
|
|
205
|
+
|
|
206
|
+
Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
|
|
99
207
|
|
|
100
208
|
### Company Information
|
|
101
209
|
|
|
102
|
-
Task Venture Capital GmbH
|
|
103
|
-
Registered at District
|
|
210
|
+
Task Venture Capital GmbH
|
|
211
|
+
Registered at District Court Bremen HRB 35230 HB, Germany
|
|
104
212
|
|
|
105
|
-
For any legal inquiries or
|
|
213
|
+
For any legal inquiries or further information, please contact us via email at hello@task.vc.
|
|
106
214
|
|
|
107
215
|
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
package/ts/00_commitinfo_data.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@serve.zone/remoteingress',
|
|
6
|
-
version: '3.0.
|
|
6
|
+
version: '3.0.2',
|
|
7
7
|
description: 'Edge ingress tunnel for DcRouter - accepts incoming TCP connections at network edge and tunnels them to DcRouter SmartProxy preserving client IP via PROXY protocol v1.'
|
|
8
8
|
}
|