feat: connect through the OpenChamber private relay
A server can now be added by pasting an openchamber://connect pairing link. The one-time secret is redeemed over the first reachable candidate (direct addresses first, then the relay), and the device token is stored with the connection, so later launches reconnect without the link. The relay candidate carries the relay WebSocket URL, the host's routing id and its P-256 public key. The new transport opens one encrypted tunnel to the relay: P-256 ECDH + HKDF-SHA256 derive one AES-256-GCM key per direction; frames carry a version, a 12-byte IV and the GCM tag; a small mux carries HTTP, SSE and WebSocket sub-streams with fragmentation and ping/pong. Every request and the terminal socket ride it; WebSocket upgrades first mint the short-lived oc_url_token over the tunnel, since upgrades cannot send headers. Only the host's legacy path is negotiated (no batching, downstream flow control or body gzip). Pairing while connected switches servers like picking one in the list, which exposed and fixes a ChatScreen crash when app.chat is cleared during the switch. 0.4.4 (404).
This commit is contained in:
1 parent
a7bc380ac0
commit
902f1e18bb
20 files changed
+1918
-75
No files matched your search
@@ -761,8 +761,9 @@ class _SessionListPaneState extends State<SessionListPane> {
|
||||
for (final c in app.connections) ...[
|
||||
ListTile(
|
||||
title: Text(c.label),
|
||||
subtitle:
|
||||
Text(c.proxy.isEmpty ? c.url : '${c.url}\n经由 ${c.proxy}'),
|
||||
subtitle: Text(c.isRelay
|
||||
? '经由 Relay · ${c.serverId}'
|
||||
: (c.proxy.isEmpty ? c.url : '${c.url}\n经由 ${c.proxy}')),
|
||||
trailing: app.conn?.id == c.id
|
||||
? Text('已连接',
|
||||
style: TextStyle(
|
||||
@@ -784,6 +785,15 @@ class _SessionListPaneState extends State<SessionListPane> {
|
||||
));
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.qr_code_2),
|
||||
title: const Text('配对链接'),
|
||||
subtitle: const Text('直连地址或 OpenChamber Relay'),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
showPairingDialog(context, app);
|
||||
},
|
||||
),
|
||||
if (app.client != null)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.link_off),
|
||||
|
||||
Reference in new issue
Block a user