boreの使い方
概要
- /ngrok/のOSS版
- ngrokが数分でexpireすることに比べて制限がない
- cargoでインストールできる
- サーブするホストを自分で所有できる(セキュリティで多少有利か)
- サポートするプロトコルはTCP
- 暗黙のコントールポートは
7835
でこれの公開が必要 - macOSでlaunchdでサービス化できる
- TCPのアイドルタイムアウト等の影響で終了することがあり、whileループで再接続するのが手軽
インストール
cargoでインストール
$ cargo install bore-cli
macOS
$ brew install bore-cli
localの22をyour_host_or_ipの2022に転送
- your_host_or_ipはbore serverが起動しているホスト
- your_host_or_ip:2022にアクセスするとローカルの22にアクセスできる
- リモート側に2022が空きがない場合は接続失敗する
$ bore local 22 --to your_host_or_ip --port 2022
boreのサーバを立ち上げる
7835
ポートを公開する必要がある
どのアクセスでも受け入れる場合
$ bore server
簡単な鍵を設定する場合
$ bore server --secret my_secret_string
ローカルのjupyterのポートを転送
- bore serverが起動しているサーバ(oci.hut42.tech)にローカルの8888ポートを転送する
- 終了時に2秒待って再接続する
$ while :; do bore local 8888 --to oci.hut42.tech --port 8888; echo "bore exited ($?)"; sleep 2; done
2025-08-31T06:55:17.882125Z INFO bore_cli::client: connected to server remote_port=8888
2025-08-31T06:55:17.882153Z INFO bore_cli::client: listening at oci.hut42.tech:8888
Linuxでsystemdでサービス化する場合
~/.config/systemd/user/bore-server.service
を作成するsystemctl --user daemon-reload
systemctl --user enable bore-server.service
systemctl --user start bore-server.service
~/.config/systemd/user/bore-server.service
[Unit]
Description=Bore Server
After=network.target
[Service]
Type=simple
ExecStart=/home/myname/.cargo/bin/bore server --secret MY_SECRET_HERE
Restart=always
RestartSec=5
[Install]
# ユーザーログイン時に自動起動する設定
WantedBy=default.target