#turn #channel #communication-channel #mobility #ip-address #networking #rfc8016

app turntie-cli

Command-line tool for creating unreliable insecure channels over TURN servers

1 unstable release

0.1.0 Mar 28, 2023

#4 in #mobility


296 lines


This tool demostrates usage of turntie library that allows tying two TURN allocations with Mobility extension enabled together, for endpoints to be moved elsewhere and used for communicatinon.


  • Creating a pair of allocations on a TURN server specified by IP, port, username and password and adding relayed addresses as permissions to each other.
  • Serializing TURN client state (including credentials) as not too long base64 lines.
  • Restoring TURN client from those lines and sending stdin lines to the other counterpart as UDP packets to TURN server.
  • Serialized TURN client state (specifier) can be moved to another host / network.
  • Available as a Rust library (for Tokio)


  • Security is iffy: specified line contains TURN credentials in plaintext, communication channel is unreliable and insecure (basically raw UDP packets)
  • TURN client implementation is simplified - does not check authentity of TURN server and may be no production-ready. I haven't read the RFC in full while implementing it.
  • Unconnected channels expire relatively quickly
  • After connecting, an endpoint cannot be moved to next host anymore (in this implementation)


Download a pre-built executable from Github releases or install from source code with cargo install --path crates/turntie-cli or cargo install turntie-cli.


hostA$ turntie tie  myuser  mypassword

hostB$ turntie connect eJwtj?REDACTED?kvUYOw==
> 12345

hostC$ turntie connect eJwtj?REDACTED?xjF6Y=
< 12345

Both turntie connects should be running simultanesouly to work.

Full unredacted specifiers are typically consist of about 150 base64 characters.

CLI options

turntie --help output
Usage: turntie <command> [<args>]

Use TURN server as a communication channel with movable ends Top-level command.

  --help            display usage information

  tie               Create two allocation and return two specifier lines for
                    their resumption
  connect           Connect to one of the lines

Usage: turntie tie <turn_server> <username> <password>

Create two tied allocations and print two specifier lines for usage with 'turntie connect'.

Positional Arguments:
  turn_server       address of TURN server to create allocations in
  username          username to authenticate on TURN server with
  password          password to authenticate on TURN server with

  --help            display usage information

Usage: turntie connect <specifier>

Connect to one of the endpoints created by 'turntie tie' and exchange stdin/stdout lines with the peer which connected to the other endpoint.

Positional Arguments:
  specifier         serialized data describing the channel end

  --help            display usage information


~200K SLoC