Skip to content

Commit a8a752e

Browse files
authored
Merge pull request #260 from gosuda/feature/update-docs
feat: add Portal Agent documentation and enhance wallet and ENS sections
2 parents c3fb3e0 + 5829586 commit a8a752e

15 files changed

Lines changed: 653 additions & 55 deletions

File tree

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,24 @@ portal expose localhost:25565 --name minecraft --tcp
7575
portal expose 3000 --multi-hop-depth 3
7676
```
7777

78+
### Keep tunnels running with Portal Agent
79+
80+
Use `portal agent run` when tunnels should keep running outside your terminal.
81+
It runs as a local OS service, keeps every tunnel in one TOML config alive, and
82+
provides a dashboard for relay and multi-hop management.
83+
84+
```bash
85+
portal agent run --config config.toml
86+
portal agent dashboard --config config.toml
87+
portal agent restart
88+
portal agent stop
89+
90+
# Foreground mode skips OS service installation.
91+
portal agent run --config config.toml --foreground
92+
```
93+
94+
See [Portal Agent](docs/src/routes/portal-agent/+page.md) for the config format.
95+
7896
### Run your own relay
7997

8098
```bash
@@ -130,6 +148,8 @@ Tunnel clients include this registry by default. If you operate a public Portal
130148

131149
- [CLI Reference](cmd/portal-tunnel/README.md)
132150
- [Concepts](docs/src/routes/concepts/+page.md)
151+
- [Portal Agent](docs/src/routes/portal-agent/+page.md)
152+
- [Wallet and ENS](docs/src/routes/wallet-and-ens/+page.md)
133153
- [Security Model](docs/src/routes/security-model/+page.md)
134154
- [Architecture](docs/src/routes/architecture/+page.md)
135155
- [Deployment](docs/src/routes/deployment/+page.md)

cmd/portal-tunnel/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ The agent service owns multiple tunnel definitions from one config file. The
219219
local control API binds to loopback and is authenticated with a token stored in
220220
the agent state directory.
221221

222+
For the full agent workflow, control API, dashboard behavior, and wallet status
223+
auth details, see [Portal Agent](../../docs/src/routes/portal-agent/+page.md)
224+
and [Wallet and ENS](../../docs/src/routes/wallet-and-ens/+page.md).
225+
222226
Useful commands:
223227

224228
- `portal agent run` reads the platform default config path, installs or updates

docs/src/lib/nav.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ export const guidesNavigation: NavSection[] = [
5656
title: 'Guides',
5757
items: [
5858
{ title: 'Self-Hosting', href: '/self-hosting' },
59+
{ title: 'Portal Agent', href: '/portal-agent' },
5960
{ title: 'TCP/UDP Tunneling', href: '/tcp-udp-tunneling' },
60-
{ title: 'SIWE Authentication', href: '/siwe-authentication' },
61+
{ title: 'Wallet and ENS', href: '/wallet-and-ens' },
6162
{ title: 'Deployment', href: '/deployment' },
6263
{ title: 'Configuration', href: '/configuration' }
6364
]

docs/src/routes/api-reference/+page.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ Admin clients authenticate with a wallet signature:
6565
5. Include the cookie in subsequent admin requests
6666
6. Sessions expire after 24 hours
6767

68+
The local agent has its own loopback wallet auth endpoints under
69+
`/v1/agent/auth/*`. Agent wallet sessions can read `/v1/agent/status`; mutating
70+
agent actions require the bearer token stored in the agent state directory. See
71+
[Portal Agent](/portal-agent) for the local control API.
72+
6873
## Endpoint Summary
6974

7075
### SDK Endpoints
@@ -109,7 +114,7 @@ Admin clients authenticate with a wallet signature:
109114
| `GET` | `/healthz` | Health check | None |
110115
| `GET` | `/discovery` | Relay discovery | None |
111116
| `POST` | `/discovery/announce` | Relay discovery self-announce | Signed Descriptor |
112-
| `POST` | `/v1/sign` | Keyless TLS signing | None |
117+
| `POST` | `/v1/sign` | Keyless TLS signing | Access Token |
113118
| `GET` | `/thumbnail/{hostname}` | Cached thumbnail screenshot | None |
114119
| `GET` | `/tunnel/status` | Tunnel connection status | Access Token |
115120

@@ -194,7 +199,11 @@ Submits this relay's signed descriptor to a bootstrap relay so registry-external
194199

195200
### `POST /v1/sign`
196201

197-
Keyless TLS signing endpoint. Used by the relay's keyless TLS infrastructure. Only available when the API server is configured with a TLS private key.
202+
Keyless TLS signing endpoint. Used by the SDK-side tenant TLS server during the
203+
default stream handshake. Requests must include a valid lease access token in
204+
the `X-Portal-Access-Token` header.
205+
206+
Only available when the API server is configured with a TLS private key.
198207

199208
Returns `404 Not Found` if signing is not configured.
200209

docs/src/routes/api-reference/sdk/+page.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,20 @@ Get relay domain and protocol version information. Used by the SDK to verify rel
6666
|-------|------|-------------|
6767
| `protocol_version` | `string` | Protocol version (must match SDK version) |
6868
| `release_version` | `string` | Relay software release version |
69+
| `ens` | `object` | ENS gasless status for this relay |
70+
71+
`ens` fields:
72+
73+
| Field | Type | Description |
74+
|-------|------|-------------|
75+
| `enabled` | `bool` | ENS gasless automation is enabled for a non-local relay domain |
76+
| `verified` | `bool` | DNSSEC is active according to Portal and the last ENS sync succeeded |
77+
| `provider` | `string` | DNS provider used for automation |
78+
| `address` | `string` | Base-domain ENS address, usually the relay identity address |
79+
| `dnssec_state` | `string` | Provider DNSSEC state |
80+
| `ds_record` | `string` | DS record that may need registrar publication |
81+
| `message` | `string` | Provider-specific DNSSEC guidance |
82+
| `last_error` | `string` | Last ENS/DNS sync error |
6983

7084
**Example:**
7185

@@ -80,7 +94,14 @@ curl https://relay.example.com/sdk/domain
8094
"ok": true,
8195
"data": {
8296
"protocol_version": "5",
83-
"release_version": "v2.1.5"
97+
"release_version": "v2.1.5",
98+
"ens": {
99+
"enabled": true,
100+
"verified": true,
101+
"provider": "cloudflare",
102+
"address": "0x1234567890abcdef1234567890abcdef12345678",
103+
"dnssec_state": "active"
104+
}
84105
}
85106
}
86107
```

docs/src/routes/cli-reference/+page.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,22 @@ portal agent restart
206206
| `portal agent restart` | Stop the current agent if present, install or update the service, and start it again |
207207

208208
The local control API binds only to loopback and uses a token in the agent state
209-
directory. See [Configuration Reference](/configuration#configtoml) for the
210-
`config.toml` format.
209+
directory. See [Portal Agent](/portal-agent) for the workflow and
210+
[Configuration Reference](/configuration#configtoml) for the `config.toml`
211+
format.
212+
213+
Agent flags:
214+
215+
| Command | Flag | Default | Description |
216+
|---------|------|---------|-------------|
217+
| `portal agent run` | `--config` | platform default | Agent TOML config path |
218+
| `portal agent run` | `--foreground` | `false` | Run in the current process without installing the OS service |
219+
| `portal agent run` | `--service` | `false` | Internal service entrypoint used by the installed OS service |
220+
| `portal agent dashboard` | `--config` | platform default | Config path used for display and state-dir discovery |
221+
| `portal agent dashboard` | `--state-dir` | config/default | Agent state directory to attach to |
222+
| `portal agent stop` | `--config` | platform default | Config path used to resolve state dir and service name |
223+
| `portal agent stop` | `--state-dir` | config/default | Agent state directory to stop |
224+
| `portal agent restart` | `--config` | platform default | Config path used to reinstall and restart the service |
211225

212226
## `portal update`
213227

@@ -253,6 +267,8 @@ Prints the installed version string and exits.
253267
## Next Steps
254268

255269
- [Getting Started](/getting-started): run your first tunnel
270+
- [Portal Agent](/portal-agent): run durable multi-tunnel services
271+
- [Wallet and ENS](/wallet-and-ens): understand wallet auth and ENS gasless DNS
256272
- [Concepts](/concepts): understand the relay and transport model
257273
- [TCP and UDP Tunneling](/tcp-udp-tunneling): raw TCP and UDP setup
258274
- [Deployment](/deployment): run your own relay server

docs/src/routes/concepts/+page.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ datagram authentication.
160160

161161
Reusing the same identity path keeps the same tunnel identity across runs.
162162

163+
Browser wallet login is separate from tunnel registration. Wallet sessions are
164+
used for relay admin access and optional local agent status access. See
165+
[Wallet and ENS](/wallet-and-ens) for the distinction.
166+
163167
## Domain Boundary
164168

165169
The default stream path prevents the relay from safely injecting `robots.txt`,
@@ -170,5 +174,6 @@ separate wildcard tunnel domain instead of a brand or docs domain.
170174
## Next Steps
171175

172176
- [Getting Started](/getting-started): run your first tunnel
177+
- [Portal Agent](/portal-agent): run durable tunnel configs
173178
- [CLI Reference](/cli-reference): command and flag details
174179
- [Architecture](/architecture): protocol-level design notes

docs/src/routes/configuration/+page.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ Agent fields:
198198
| `state_dir` | Platform default state directory | Stores the local control endpoint token and runtime state |
199199
| `control_addr` | `127.0.0.1:4018` | Loopback-only local control API address |
200200
| `service_name` | `portal-agent` | OS service name |
201-
| `allowed_wallets` | empty | Wallet addresses allowed to sign in to the local agent UI; empty allows any wallet on the loopback UI |
201+
| `allowed_wallets` | empty | Wallet addresses allowed to read local agent status through wallet auth; empty allows any wallet on the loopback auth endpoint |
202+
203+
The local agent dashboard and mutating control API calls use the bearer token in
204+
the agent state directory. Wallet-authenticated agent requests are read-only and
205+
can only read `/v1/agent/status`.
202206

203207
Tunnel fields mirror `portal expose` flags:
204208

@@ -212,9 +216,12 @@ Tunnel fields mirror `portal expose` flags:
212216
| `multi_hop` | string array | Ordered multi-hop relay path |
213217
| `multi_hop_depth` | int | Automatically select one multi-hop route with this depth |
214218
| `identity_path` | string | Tunnel identity JSON file path. When omitted, one tunnel uses the platform default `identity.json`; multiple tunnels use `<state-dir>/<tunnel-id>/identity.json` |
219+
| `identity_json` | string | Identity JSON payload; overrides `identity_path` contents and is persisted there when both are set |
215220
| `udp`, `udp_addr`, `tcp` | bool/string | UDP and raw TCP relay options |
216221
| `description`, `tags`, `owner`, `thumbnail`, `hide` | mixed | Lease metadata shown by relays |
217222

223+
For a task-oriented walkthrough, see [Portal Agent](/portal-agent).
224+
218225
### `identity.json`
219226

220227
Stores the secp256k1 identity used to sign tunnel sessions and relay descriptors. `portal expose` treats `--identity-path` as a direct JSON file path. `relay-server` treats `IDENTITY_PATH` as a state directory and stores this file at `IDENTITY_PATH/identity.json`.
@@ -245,6 +252,8 @@ Set `ACME_DNS_PROVIDER` (or `--acme-dns-provider`) to one of the values below to
245252

246253
When this variable is empty the relay server falls back to manually supplied `fullchain.pem` and `privatekey.pem` files in `IDENTITY_PATH`.
247254

255+
For ENS gasless behavior and wallet authentication details, see [Wallet and ENS](/wallet-and-ens).
256+
248257
### Cloudflare (`cloudflare`)
249258

250259
| Variable | Required | Description |

docs/src/routes/deployment/+page.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ Set `ACME_DNS_PROVIDER` to one of:
5858
- `gcloud`
5959
- `route53`
6060

61+
For a focused explanation of wallet auth and ENS gasless DNS behavior, see
62+
[Wallet and ENS](/wallet-and-ens).
63+
6164
### 3.2 Cloudflare setup
6265

6366
#### Add domain to Cloudflare

docs/src/routes/getting-started/+page.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ verifies its SHA256 checksum, and replaces the current executable.
134134
## Next Steps
135135

136136
- [Concepts](/concepts): understand Portal's relay and transport model
137+
- [Portal Agent](/portal-agent): keep multiple tunnels running from config
137138
- [CLI Reference](/cli-reference): complete command and flag documentation
138139
- [TCP and UDP Tunneling](/tcp-udp-tunneling): raw TCP and UDP examples
139140
- [Deployment](/deployment): run your own public relay

0 commit comments

Comments
 (0)