feat(cli): make connect-url --relay a full anywhere pairing link

- --relay links now carry both routes: direct LAN plus relay fallback,
  matching the UI's Anywhere pairing; devices prefer the direct route
- pairing sessions created by the CLI are marked with usesRelay, and the
  server reconciles relay demand on a timer, so a headless instance
  brings the relay up on its own after connect-url --relay
- warn with LAN_UNREACHABLE when the link's direct route points at
  loopback and other devices cannot use it
- document the --relay flow and the --lan binding caveat in Connect a
  Device and Remote Instances across all locales
This commit is contained in:
Bohdan Triapitsyn
2026-07-10 18:29:15 +03:00
parent de92b8fef4
commit 6ec1797583
21 changed files with 182 additions and 87 deletions
@@ -42,11 +42,23 @@ description: 1 回限りの QR コードで、スマートフォン、デスク
サーバーがヘッドレス(UI を開いていない状態)で動いている場合は、そのマシンのターミナルから接続リンクを作成できます。
同じネットワーク上のデバイス用にはこちらです。
```bash
openchamber connect-url --port 3000 --qr
```
出力されるリンクと QR コードは、設定ダイアログから作成したものとまったく同じように機能します。
**どこからでも**接続するデバイス用 — ダイアログで **どこでも** を選ぶのと同等 — にはこちらです。
```bash
openchamber connect-url --relay --qr
```
`--relay` リンクには、ダイアログと同様に両方の経路が含まれます。デバイスはサーバーに到達できるときはローカルネットワーク経由で直接接続し、外出先では [Private Relay](/private-relay/) にフォールバックします。リレーは自動的に起動します。実行中のインスタンスは 1 分以内にリンクを拾い、停止中のインスタンスは次回の起動時に拾います。
> 直接経路は、サーバーが実際にネットワーク上で待ち受けている場合にのみ機能します。デフォルトでは OpenChamber はそのマシン上でのみ待ち受けます。Wi-Fi 経由で到達できるようにするには `--lan` を付けて起動してください。リンクの直接経路が他のデバイスから使えない場合、コマンドは警告(`[LAN_UNREACHABLE]`)を表示します。その場合でも `--relay` リンクは機能しますが、常にリレー経由になります。
出力されるリンクと QR コードは、設定ダイアログから作成したものとまったく同じように機能します — 1 回限りで、期限切れになり、無効化できます。
## 関連
@@ -36,7 +36,7 @@ SSH と UI のパスワードを保存するか、毎回入力するかを選べ
openchamber connect-url --port 3000 --server http://your-host:3000 --qr
```
`connect-url` は、そのポートで何も実行されていなければ先にサーバーを起動します。ヘッドレスサーバーには `--api-only`、起動時に LAN にバインドするには `--lan`、ブラウザアクセスを保護するには `--ui-password`、保存接続にラベルを付けるには `--name` を追加します。
`connect-url` は、そのポートで何も実行されていなければ先にサーバーを起動します。ヘッドレスサーバーには `--api-only`、起動時に LAN にバインドするには `--lan`、ブラウザアクセスを保護するには `--ui-password`、保存接続にラベルを付けるには `--name` を追加します。ローカルネットワークの外でも使えるリンクには `--relay` を追加します。デバイスは到達可能なときは直接接続を優先し、外出先では [Private Relay](/private-relay/) にフォールバックします。リレーはインスタンスが自動的に立ち上げます。
生成されたリンクには 1 回限りのペアリングシークレットが含まれます。インポートすると、デバイスは専用のクライアントトークンを保持します。これはブラウザ UI パスワードとは別で、発行元サーバーで無効化するまでサーバー再起動後も残ります。