Bifrost – matoken's blog https://matoken.org/blog Is there no plan B? Mon, 04 May 2026 20:55:08 +0000 ja hourly 1 https://wordpress.org/?v=7.0.1 https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9-32x32.jpeg Bifrost – matoken's blog https://matoken.org/blog 32 32 スマートフォンとPC間のファイルのやり取りをするBifrost https://matoken.org/blog/2026/05/05/bifrost/ https://matoken.org/blog/2026/05/05/bifrost/#respond Mon, 04 May 2026 20:55:07 +0000 https://matoken.org/blog/?p=5450

AndroidスマートフォンとPC間のファイル転送にBluetoothをよく使っていました.最近2.4GHzのWi-Fiを使っているせいか転送に失敗することが多いです.
有線だと確実ですが少し面倒.アドホックにファイル転送用のhttpdを起動してスマートフォン<→PC間のファイルのやり取りが出来るBifrostというものを知ったので試した見ました.

導入

導入はGithub Releasesからビルド済バイナリをダウンロードするか, go install github.com/axiom0x0/bifrost@latest で導入できます.Linux armhfもあるのが嬉しい.

利用例

$ bifrost
bifrost v1.1.0 — bridge files to your phone via QR code

Usage:
  bifrost <file> [port]              send a file (+ upload)
  bifrost -f <file> [-p port]        send a file (+ upload)
  bifrost -r [-o dir] [-p port]      receive files only
  bifrost -d <dir> [-p port]         browse a directory (+ upload)

  Add -e to any mode for encrypted transfers.

Flags:
  -1	exit after first completed transfer
  -d string
    	directory to browse and serve
  -e	enable end-to-end encryption
  -f string
    	file to serve (send mode)
  -o string
    	output directory for received files (default ".")
  -p int
    	port to serve on (default 8888)
  -r	receive-only mode
  -v	print version and exit

Examples:
  bifrost myfile.gpx              send file, allow uploads back
  bifrost -f photo.jpg -p 9090    send on custom port
  bifrost -r -o ~/Downloads       receive files only
  bifrost -d ~/Photos             browse directory
  bifrost -e myfile.gpx           send with encryption
  bifrost -e -r                   receive with encryption

ファイル転送時にはQR codeが表示されるのでそれをスマートフォン側で読み込むと便利です.勿論URLの入力でもok.

pcからスマートフォンへのファイル送信例
$ bifrost file.txt

█████████████████████████████████
█████████████████████████████████
████ ▄▄▄▄▄ █ ▄ ▀▀▀▄█▄█ ▄▄▄▄▄ ████
████ █   █ █▀ ▀▄█▄▀▀▄█ █   █ ████
████ █▄▄▄█ ███ █▄▀▄█▀█ █▄▄▄█ ████
████▄▄▄▄▄▄▄█ █ █▄█▄█ █▄▄▄▄▄▄▄████
████ █  █ ▄▄▀▀▀▀▄ █ ▄█ ▀▀▄█ ▄████
██████▀▄ ▀▄ ▄▄█▄█▀█▄▄▄██ ▀▀██████
████▄██ █▄▄▄▀▄ ▀ ▀▄█ ▀ █▀█▄▄ ████
████▀▄ █▀▄▄▄ ▄█ █▄▄▄▄█▀▄█▀▄▄▀████
███████▄▄▄▄▄▀█ █▄█▄█ ▄▄▄ ▄▄▄ ████
████ ▄▄▄▄▄ █ █▀▀█ ██ █▄█ ▄▄▄ ████
████ █   █ █▀▄ ██▄██ ▄▄ ▄█▀▄▀████
████ █▄▄▄█ █▄▀ ▀▀▀▄██ ██ ▄ ▄█████
████▄▄▄▄▄▄▄█▄██▄▄████▄█▄▄▄▄▄▄████
█████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

  Mode:  send
  File:  file.txt (126.6 KB)
  URL:   http://192.168.100.22:8888
  Port:  8888

Scan QR to download (uploads also accepted).
Press Ctrl+C to stop.

受診時には -r オプションと, -o で受信先(既定値はカレントディレクトリ)を指定します.

ファイル受信例
$ bifrost -r -o ~/Downloads/

E2EEを有効にしたいときは -e オプションを,そのままだと起動しっぱなしなので, -1 オプションや,timeoutコマンドを挟むと終了し忘れがなくて良さそうです.

timeoutで300秒に制限.1回だけ,E2EEを有効にして受信
$ timeout 300 bifrost -1 -e -r -o ~/Downloads/

█████████████████████████████████████████████
█████████████████████████████████████████████
████ ▄▄▄▄▄ █▄▀▄ █▀▄  ▄█ ▄▄▄█▀  █ █ ▄▄▄▄▄ ████
████ █   █ █▀▀▄▀▄▀█▄▄▄▀██▄ ▀ ▀▄▀██ █   █ ████
████ █▄▄▄█ █ ██▀ ▀▀   ▄▀▀ ▄▄ ██▄██ █▄▄▄█ ████
████▄▄▄▄▄▄▄█ ▀▄▀▄▀▄▀ █▄▀▄▀ ▀▄█▄█▄█▄▄▄▄▄▄▄████
████▄▀██▄▀▄▄▄█  █▀█▄▄█▀ ▄ ▀ ▄ ▀▄▀▄▄▄ ▄█▀▄████
█████▀ ▄█ ▄  ▄█▄ █▄ ▀▀  ▀  ▄███ █▄▄▀▄█ ▀█████
████▀  ▀ ▀▄▀▀▄▀▄▄▄▄█▀█▀█▀ █▀▀▀▄ █▀▄▀▀▀▄▄ ████
████▀▄▀██▄▄███▀ ▀   █ ▀█    ██▄  █▄▄█▄ ██████
████▀ ▀█  ▄ ▄▄▄▀█▄ ▄▀█▄ ▀▄▄ █▀▀▄▀ ▄█    ▄████
████▀ █ █ ▄▀ ██▀█  █▄ ▀█▄▀▄ ▄██ ▄ ▀▀▀█▀▀█████
████ ▀██▀█▄▄██ ▄▀▄▄ ▀ █▄█▄ ▀▀█  ▄█▄▀▀█▄▀█████
████▄▀▀▀ ▄▄█▄▀ ▄███▄ █▄█ ▀█▄██▄▄▄▀▀    ▀█████
████ ▀ █  ▄ █▄▄ ▄▀ ▄▄█▀▀▄██▄██▄▀▀ ▄▄▀▄▄▄▄████
████████▀ ▄ ▄ █▀▀█▀ ▀▀▀ ▀▀ ▄ ▄▄▄▀▀ ▀▄█ ▀▀████
████▄▄█▄██▄█▀▄▄▀ ▄ ▀▀█▀▀▄ ▄▀▀█▄▀ ▄▄▄ █▀▄▄████
████ ▄▄▄▄▄ █▄█▄▄  ▀▄█ ▀█▀█▀▄██▀▀ █▄█  ▀▀█████
████ █   █ █▄▀▀ ▄▄ ▄▀▀▄ ▀█▄▀▀▀▄▀▄▄  ▄▀ ▄▀████
████ █▄▄▄█ ██▀▀▀▄ ▀█▄▀▄█▄ █ ▄▄█▄▄▀ ▀▀▀ ▀█████
████▄▄▄▄▄▄▄█▄▄█▄███▄▄██▄▄▄▄███▄▄██▄██▄▄▄▄████
█████████████████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

  Mode:  receive 🔒
  Save:  /home/matoken/Downloads
  URL:   http://192.168.100.22:8888#redMu2lgAsN_jmLduAoaM6lVmvxslMGNDl917QrfZ8g
  Port:  8888

Scan QR to upload files.
Press Ctrl+C to stop.

環境

$ bifrost -v
bifrost v1.1.0
$ lsb_release -dr
Description:	Debian GNU/Linux forky/sid
Release:	n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2026/05/05/bifrost/feed/ 0