The iroh-ble-transport crate
routes iroh over BLE (Bluetooth Low Energy) to allow for P2P connectivity
without the internet.
iroh-ble-transport supports macOS, iOS, Android, and Linux. In the future, it
could support other platforms as well like Windows or Espressif (ESP32 family).
Both iroh’s custom transport API and this crate are experimental. Expect breaking changes.
iroh-ble-transport is open source under the AGPL
license. Commercial licenses are
available for use cases where the AGPL is not suitable. Contact the number0
team or
me@jakebot.org for details.
Bluetooth connections on mobile devices typically max out at about ~3-5
connections per device. Per connection, you can expect about 100kbps in decent
conditions, but it’s very dependent on the surrounding radio environment
and devices that you’re using.
Usage
use iroh::endpoint::presets;
use iroh::{Endpoint, SecretKey};
use iroh_ble_transport::BleTransport;
let secret_key = SecretKey::generate();
let ble = BleTransport::builder().build(secret_key.public()).await?;
let _endpoint = Endpoint::builder(presets::N0DisableRelay)
.hooks(ble.dedup_hook())
.add_custom_transport(ble.as_custom_transport())
.address_lookup(ble.address_lookup())
.secret_key(secret_key.clone())
.clear_ip_transports()
.bind()
.await?;
Feature flag
Custom transport support requires the unstable-custom-transports feature flag.
The API is unstable and subject to change. See
#3845 for background.
[dependencies]
iroh = { version = "*", features = ["unstable-custom-transports"] }