TURN(1)
π TURN(1) π
okay bestie, welcome to the turnutils cinematic universe π this is the home page for a whole squad of turnutils_* programs β a set of utility functionality you use for testing and for setting up the TURN server. no cap. let's meet the cast π
β¨ GENERAL INFORMATION β¨
turnutils_uclientβ emulates multiple UDP, TCP, TLS or DTLS clients. (this program is provided for the testing purposes only !) The compiled binary image of this program is located inbin/sub-directory.turnutils_peerβ a simple stateless UDP-only "echo" server, to be used as the final server in relay pattern ("peer"). For every incoming UDP packet, it simply echoes it back. (this program is provided for the testing purposes only !) When the test clients are communicating in the client-to-client manner (when theturnutils_uclientprogram is used with-yoption) then theturnutils_peeris not needed.
The compiled binary image of this program is located in bin/ subdirectory.
turnutils_stunclientβ a simple STUN client example. The compiled binary image of this program is located inbin/subdirectory.turnutils_rfc5769checkβ a utility that checks the correctness of the STUN/TURN protocol implementation. This utility is used only for the compilation check procedure, it is not copied to the installation destination.
In the examples/scripts subdirectory, you will find the examples of command lines to be used to run the programs. The scripts are meant to be run from examples/ subdirectory, for example:
$ cd examples
$ ./scripts/secure_relay.sh
turnutils_natdiscoveryβ a utility that provides NAT behavior discovery according RFC5780. This utility discovers the actual NAT Mapping and Filtering behavior, etc. Be aware that on TURN server side two different listening IP addresses should be configured to be able to work properly!turnutils_oauthβ a utility that provides OAuth access_token generation (AEAD encryption), validation and decryption. This utility inputs all the keys and lifetimes and any related information that needed for creation and validation of an access_token. It outputs a JSON with all OAuth PoP parameters that need to pass to the client. Output is generated according RFC7635 Appendix B, Figure 8.
For more details, and for the access_token structure, read rfc7635, and see script in examples/scripts/oauth.sh.
π NAME π
turnutils_uclient β this client emulation application is supplied for the test purposes only.
πΈ SYNOPSIS πΈ
$ turnutils_uclient [-tTSvsyhcxg] [options] <TURN-Server-IP-address>
π DESCRIPTION π
It was designed to simulate multiple clients. It uses asynch IO API in libevent to handle multiple clients. A client connects to the relay, negotiates the session, and sends multiple (configured number) messages to the server (relay), expecting the same number of replies. The length of the messages is configurable. The message is an arbitrary octet stream. The number of the messages to send is configurable.
Flags:
-tβ Use TCP for communications between client and TURN server (default is UDP).-bβ Use SCTP for communications between client and TURN server (default is UDP).-Tβ Use TCP for the relay transport (default - UDP). Implies options-t,-y,-c, and ignores flags and options-s,-e,-rand-g. Can be used together with-b.-Pβ Passive TCP (RFC6062 with active peer). Implies-T.-Sβ Secure SSL connection: SSL/TLS for TCP, DTLS for UDP, TLS/SCTP for SCTP.-Uβ Secure unencrypted connection (suite eNULL): SSL/TLS for TCP, DTLS for UDP.-vβ Verbose.-sβ Use "Send" method in TURN; by default, it uses TURN Channels.-yβ Use client-to-client connections: RTP/RTCP pair of channels to another RTP/RTCP pair of channels. With this option theturnutils_peerapplication is not used, as the allocated relay endpoints are talking to each other.-hβ Hang on indefinitely after the last sent packet.-cβ Do not create rtcp connections.-xβ Request IPv6 relay address (RFC6156).-Xβ IPv4 relay address explicitly requested.-gβ Set DONT_FRAGMENT parameter in TURN requests.-Dβ Do mandatory channel padding even for UDP (likepjnath).-Nβ do negative tests (some limited cases only).-Rβ do negative protocol tests.-Oβ DOS attack mode.-Mβ Use TURN ICE Mobility.-Iβ Do not set permissions on TURN relay endpoints (for testing the non-standard server relay functionality).-Gβ Generate extra requests (create permissions, channel bind).-Bβ Random disconnect after a few initial packets.-Zβ Dual allocation (SSODA). Implies-coption.-Jβ Use oAuth with default test keyskid='north','union'or'oldempire'.-Yβ Load-generator mode: packet floods data through a single TURN allocation as fast as possible, alloc creates allocations as fast as possible, and invalid sends small invalid packets to the TURN listener as fast as possible. Load-generator modes imply-cand do not support-y.--no-even-portβ Never attach an EVEN-PORT attribute to ALLOCATE requests. The defaultclnet_allocatepath picks0or-1randomly even under-c, which the turnserver--multiplex-peermode strictly rejects with error400. Use--no-even-portfor clean alloc-flood runs and any other testing against--multiplex-peer.--listener-threads <N>β Number of receive (listener) threads on the loadgen (also available as-K N). Default auto:0for-m < 4, bumped to1when-m >= 4.0keeps the legacy single-event-base behaviour. Each listener owns its own libevent base; sessions are sharded round-robin. Max 4.--sender-threads <N>β Number of send (timer-driven) threads on the loadgen. Default auto:0for-m < 4, bumped to2when-m >= 4.0keeps the legacy single-threaded send (main thread'stimer_handleriterates all sessions). Each sender owns its own libevent base and a session shard; per-tick sends coalesce into one UDP-GSOsendmsg(or onesendmmsgwhen GSO is unavailable). Max 4.
π« Options with required values π«
-lβ Message length (Default: 100 Bytes).-iβ Certificate file (for secure connections only, optional).-kβ Private key file (for secure connections only).-Eβ CA file for server certificate verification, if the server certificate to be verified.-pβ TURN Server port (Defaults: 3478 unsecure, 5349 secure).-nβ Number of messages to send (Default: 5). In load-generator mode,-nis the number of operations per client. If omitted there, the client runs until interrupted.-dβ Local interface device (optional, Linux only).-Lβ Local IP address (optional).-mβ Number of clients (Default: 1, 2 or 4, depending on options).-eβ Peer address.-rβ Peer port (Default: 3480).-zβ Per-session packet interval in milliseconds (Default: 20). In packet and invalid load-generator modes the default is 0 ms.-uβ STUN/TURN user name.-wβ STUN/TURN user password.-Wβ TURN REST API secret. The "plain text" secret e.g. "north" that is stored in the value column of theturn_secrettable in the database if dynamic, or thestatic-auth-secretvalue set in the configuration file if using static.-Cβ This is the timestamp/username separator symbol (character) in TURN REST API. The default value is:.-Fβ Cipher suite for TLS/DTLS. Default value isDEFAULT.-oβ the ORIGIN STUN attribute value.-aβ Bandwidth for the bandwidth request in ALLOCATE. The default value is zero.
π¦ Notes for load-generator mode π¦
- packet mode still performs the normal TURN allocation/setup and then starts sending immediately with no pacing.
- alloc mode does not require
-e; it repeatedly establishes new allocations and closes them again. - alloc mode does not require
-e; it repeatedly establishes new allocations, uses a unique client local port for each one, attaches each one to a unique synthetic peer ip:port, and closes them again. - invalid mode does not require
-e; by default it uses 16-byte payloads unless-lis specified.
See the examples in the examples/scripts directory.
π«Ά NAME π«Ά
turnutils_peer β a simple UDP-only echo backend server.
π SYNOPSIS π
$ turnutils_peer [-v] [options]
π DESCRIPTION π
This application is used for the test purposes only, as a peer for the turnutils_uclient application.
Options with required values:
-pβ Listening UDP port (Default: 3480).-dβ Listening interface device (optional).-Lβ Listening address ofturnutils_peerserver. Multiple listening addresses can be used, IPv4 and IPv6. If no listener address(es) defined, then it listens on all IPv4 and IPv6 addresses.-vβ Verbose.
π« NAME π« β turnutils_stunclient
π SYNOPSIS
$ turnutils_stunclient [options] <STUN-Server-IP-address>
π DESCRIPTION
Okay so bestie, this one is literally just a basic STUN client. It sends a "new" STUN RFC 5389 request (over UDP, btw) and then shows you the reply information it got back. no cap, that's the whole job. π
Options with required values β yes, every single one of these needs a value, no freeloaders allowed:
-pβ STUN server port. (Default:3478.)-Lβ Local address to use (optional).-fβ Force RFC 5780 processing.-cβ Continuously send STUN binding requests and report round-trip latency until interrupted. it's giving "runs forever until you Ctrl-C it" π-iβ Interval between continuous requests in milliseconds. (Default:1000.)-tβ Response timeout in milliseconds. (Default:3000.)
Then here's the plot twist: turnutils_stunclient checks the results of that first request, and if it finds out that the STUN server supports RFC 5780 β and the binding response is the thing that reveals that, iykyk β then it makes a couple more requests with different parameters, to demonstrate the NAT discovery capabilities. main character behavior, fr fr β¨
Continuous mode reports every single response or timeout, and when you interrupt it with Ctrl-C it prints packet loss plus the minimum/average/maximum round-trip latency. π so thorough of it.
Heads up bestie: this utility does not support the "old" "classic" STUN protocol (RFC 3489). Not even a little bit. It is not on the guest list. π«
π§ͺ NAME π§ͺ β turnutils_rfc5769check
π SYNOPSIS
$ turnutils_rfc5769check
π DESCRIPTION
turnutils_rfc5769check tests the correctness of STUN protocol implementation against the test vectors predefined in RFC 5769, and prints the results of the tests on the screen. and it's only used for the compilation check procedure β it is not copied to the installation destination. so it's the backstage bestie that never goes on stage. π
Usage:
$ turnutils_rfc5769check
π¦ NAME π¦ β turnutils_natdiscovery
π SYNOPSIS
$ turnutils_natdiscovery [options] <STUN-Server-FQDN-or-IP-address>
π DESCRIPTION
turnutils_natdiscovery discovers the NAT Mapping and Filtering behavior β to determine if that NAT is currently using Endpoint-Independent, Address-Dependent, or Address and Port-Dependent Mapping, and/or to determine if that NAT is currently using Endpoint-Independent, Address-Dependent, or Address and Port-Dependent Filtering. it's a full-on vibe check for your NAT, bestie. π
Use either -m, -f, -c, -H flag to discover NAT behavior.
Flags:
-mβ NAT mapping behavior discovery-fβ NAT filtering behavior discovery-tβ NAT mapping lifetime behavior discovery. Requires a timer (-T).-cβ NAT collision behavior discovery-Hβ NAT hairpinning behavior discovery-Pβ Add 1500 byte Padding to the behavior discovery. Applicable with all except NAT mapping Lifetime discovery.
Options with required values:
-pβ STUN server port (Default:3478)-Lβ Local address to use (optional)-lβ Local port to use (use with-L)-Aβ Secondary Local address (optional). Required for collision discovery.-Tβ Mapping lifetime timer (sec). Used by mapping lifetime behavior discovery.
Usage:
$ turnutils_natdiscovery -m -f stun.example.com
π NAME π β turnutils_oauth
π SYNOPSIS
$ turnutils_oauth [options]
π DESCRIPTION
turnutils_oauth is the utility that helps with OAuth access_token generation/encryption and validation/decryption, and it's genuinely so useful. It provides help in OAuth access_token encryption and/or decryption with AEAD (Authenticated Encryption with Associated Data). It helps an Auth Server in access_token creation, and for debugging purposes it also helps the access_token validation and decryption. π«Ά
This utility inputs all the keys and lifetimes and any related information that are needed for encryption or decryption of an access_token. It outputs a JSON with all OAuth PoP parameters that need to pass to the client. Output is generated according to RFC7635 Appendix B, Figure 8.
This utility could help you build an Auth Server service β but be aware, bestie, of what it does not do: this utility does not generate "session key" / "mac_key", and it does not verify the lifetime of "session key" / "mac_key" or "Auth key". so don't come for it about that. π
For more details, and for the access_token structure, read rfc7635, and see the example in examples/scripts/oauth.sh.
Use either -e and/or -d flag to encrypt or decrypt access_token.
Flags:
-h,--helpβ usage-v,--verboseβ verbose mode-e,--encryptβ encrypt token-d,--decryptβ decrypt validate token
Options with required values:
-i,--server-nameβ server name (max. 255 char)-j,--auth-key-idβ Auth key id (max. 32 char)-k,--auth-keyβ base64 encoded Auth key-l,--auth-key-timestampβ Auth key timestamp (sec since epoch)-m,--auth-key-lifetimeβ Auth key lifetime in sec-n,--auth-key-as-rs-algβ Authorization Server(AS) - Resource Server(RS) encryption algorithm-o,--token-nonceβ base64 encoded noncebase64(12 octet)= 16 char-p,--token-mac-keyβ base64 encoded MAC keybase64(32 octet)= 44 char-q,--token-timestampβ timestamp in format 64 bit unsigned (Native format - Unix), so 48 bit for secs since epoch UTC + 16 bit for 1/64000 fractions of a second. e.g.: the actual unixtimestamp 16 bit left shifted. (Default: actual gmtime)-r,--token-lifetimeβ lifetime in sec (Default:3600)-t,--tokenβ base64 encoded encrypted token for validation and decryption-u,--hmac-algβ stun client hmac algorithm
Usage:
$ turnutils_natdiscovery
okay so yes, that usage line really does sayturnutils_natdiscoveryon theturnutils_oauthpage. iconic. not me fixing it. we keep the lore exactly as written. π
π DOCS π
After installation, run the command:
$ man turnutils
or, if you're hanging out in the project root directory:
$ man -M man turnutils
and boom, you've got the man page. β¨
ποΈ FILES ποΈ
/etc/turnserver.conf/var/db/turndb/usr/local/var/db/turndb/var/lib/turn/turndb/usr/local/etc/turnserver.conf
π DIRECTORIES π
/usr/local/share/turnserver/usr/local/share/doc/turnserver/usr/local/share/examples/turnserver
π STANDARDS π
- new STUN RFC 5389
- TURN RFC 5766
- TURN-TCP extension RFC 6062
- TURN IPv6 extension RFC 6156
- STUN/TURN test vectors RFC 5769
- STUN NAT behavior discovery RFC 5780
π SEE ALSO π
turnserverturnadmin
π WEB RESOURCES π
project page:
https://github.com/coturn/coturn/
Wiki page:
https://github.com/coturn/coturn/wiki
forum:
https://groups.google.com/forum/?fromgroups=#!forum/turn-server-project-rfc5766-turn-server/
π AUTHORS π
See the AUTHORS.md file in the coturn source distribution. that's where the whole squad is credited. π
and that's a wrap on TURN(1), bestie! π this beauty is dated 17 May 2026 and it's part of the coturn source, version-tagged TURN(1) β so go forth, read your man pages, and slay. π β¨
π¦ where this page comes from
- arch rolling: coturn 4.18.0-2 Β· LicenseRef-coturn
- epel 10: coturn-utils 4.18.0-1.el10_3 Β· BSD-3-Clause AND MIT
- epel 9: coturn-utils 4.18.0-1.el9 Β· BSD-3-Clause AND MIT
- fedora 43: coturn-utils 4.18.0-1.fc43 Β· BSD-3-Clause AND MIT
- fedora 44: coturn-utils 4.18.0-1.fc44 Β· BSD-3-Clause AND MIT
- nixos 26.05: coturn 4.16.0
- nixpkgs unstable: coturn 4.17.2
- opensuse-leap 16.0: coturn-utils 4.14.0-bp160.1.1 Β· BSD-3-Clause
- opensuse-leap 16.0: coturn-utils 4.14.0-bp160.1.1 Β· BSD-3-Clause
- opensuse-leap 16.0: coturn-utils 4.14.0-bp160.1.1 Β· BSD-3-Clause
- opensuse-leap 16.0: coturn-utils 4.14.0-bp160.1.1 Β· BSD-3-Clause
- ubuntu stonking: coturn 4.18.0-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms