Skip to content

Transport

This page shows how to choose the transports clients use to reach the server, and the addresses it listens on and advertises.

The server runs the transports named in server.transports (or --transports), and only those. The default is UDX alone, the transport the mobile clients speak.

Name Example listen address Security and streams Typical clients
udx (default) /ip4/0.0.0.0/udp/55223/udx Noise, Yamux Ricochet’s Go and Dart clients, phones
tcp /ip4/0.0.0.0/tcp/55223 Noise, Yamux Any libp2p stack
quic-v1 /ip4/0.0.0.0/udp/55224/quic-v1 TLS 1.3 and streams from QUIC Any libp2p stack with QUIC
websocket /ip4/0.0.0.0/tcp/55225/ws, /ip4/0.0.0.0/tcp/443/tls/ws Noise, Yamux Browsers, hosts behind HTTP proxies
webtransport /ip4/0.0.0.0/udp/55224/quic-v1/webtransport TLS 1.3 and streams from QUIC Browsers

webrtc-direct is refused: go-libp2p’s WebRTC transport depends on a DTLS library with an unfixed advisory (GO-2026-4479). Use webtransport for browsers.

A transport that is listed but has no listen address only dials out.

Whichever transport carries it, every connection authenticates both ends by their Ed25519 identity keys, so the server knows which peer is on every connection, and every access check uses that peer ID. See Identity keys.

Ricochet protocols (/sf-network/..., /ricochet/...)
|
Yamux stream multiplexing
|
Noise encryption and mutual authentication
|
UDX reliable transport over UDP: ordered streams, congestion and flow control
|
UDP

TCP and WebSocket replace the UDX layer and keep Noise and Yamux. QUIC and WebTransport replace all three layers: QUIC brings its own TLS 1.3 handshake and its own streams.

The server tunes Yamux for mobile clients: a keepalive every 15 seconds and a 10-second write timeout, so a dead connection is detected within about 25 seconds. A Yamux connection accepts up to 512 concurrent inbound streams. These settings apply to UDX, TCP and WebSocket. QUIC and WebTransport keep connections alive on quic-go’s own 15-second period.

Every listen address needs its transport in server.transports. This file runs all five:

/etc/ricochet/config.yaml
server:
transports: [udx, tcp, quic-v1, websocket, webtransport]
listen_addresses:
- /ip4/0.0.0.0/udp/55223/udx
- /ip4/0.0.0.0/tcp/55223
- /ip4/0.0.0.0/udp/55224/quic-v1
- /ip4/0.0.0.0/udp/55224/quic-v1/webtransport
- /ip4/0.0.0.0/tcp/55225/ws

Or on the command line:

Terminal window
ricochet --transports udx,tcp,quic-v1 \
--listen-addrs /ip4/0.0.0.0/udp/55223/udx,/ip4/0.0.0.0/tcp/55223,/ip4/0.0.0.0/udp/55224/quic-v1

The rules for ports:

  • UDX and QUIC need different UDP ports. UDX holds its own UDP socket, and quic-v1 and webtransport share another. Put them on one port and the server refuses to start.
  • QUIC and WebTransport may share a port, as above.
  • TCP and WebSocket may share a port. When both run, they share one TCP listener and go-libp2p tells the connections apart by their first bytes.
  • TCP and UDP may use the same number, as UDX and TCP do on 55223 above.

--port (or LISTEN_PORT on the .deb install) moves every listen address, UDP and TCP, to one port. That works for UDX with TCP and WebSocket. A server that runs UDX beside quic-v1 or webtransport needs two UDP ports, so set them in listen_addresses and leave --port unset. The file’s server.port rewrites only the default address: once you set listen_addresses, put the ports in them.

The server checks all of this at startup and refuses a configuration that breaks a rule, with a message that names the address and the fix:

listen address "/ip4/0.0.0.0/tcp/55223" needs transport "tcp"; add it to server.transports

Listen addresses are multiaddrs. Some variations:

Address Listens on
/ip4/0.0.0.0/udp/55223/udx UDX on every IPv4 interface (default)
/ip4/10.0.0.5/udp/55223/udx UDX on one IPv4 interface
/ip6/::/udp/55223/udx UDX on every IPv6 interface; on Linux, IPv4 as well through the dual-stack socket
/ip4/0.0.0.0/tcp/55223 TCP on every IPv4 interface

Browsers on an HTTPS page can only open secure WebSockets. You have two ways to serve them.

Give the server a certificate. It then listens on a /tls/ws address itself:

/etc/ricochet/config.yaml
server:
transports: [udx, websocket]
listen_addresses:
- /ip4/0.0.0.0/udp/55223/udx
- /ip4/0.0.0.0/tcp/443/tls/ws
websocket_tls:
cert_file: /etc/letsencrypt/live/ricochet.example.com/fullchain.pem
key_file: /etc/letsencrypt/live/ricochet.example.com/privkey.pem

Both files are PEM. The server reloads the certificate when its file changes, so a renewal needs no restart. If a renewed certificate cannot be loaded, the previous one keeps serving. Binding port 443 needs root or CAP_NET_BIND_SERVICE; any other port works the same way.

Or terminate TLS in a reverse proxy. The server listens on plain /ws behind it, and you advertise the proxy’s address in external_addresses:

/etc/ricochet/config.yaml
server:
transports: [udx, websocket]
listen_addresses:
- /ip4/0.0.0.0/udp/55223/udx
- /ip4/127.0.0.1/tcp/55225/ws
external_addresses:
- /dns4/ricochet.example.com/tcp/443/wss

A /tls/ws or /wss listen address without websocket_tls stops startup.

WebTransport needs no certificate from you. go-libp2p creates a self-signed certificate and adds its hashes to the address, so the address the server prints ends in /certhash/... components. A browser checks the server against those hashes instead of a certificate authority. go-libp2p rotates the certificate, so the hashes change over time: give clients the address the server currently advertises, not a copy from weeks ago.

The server advertises addresses to peers through libp2p’s Identify protocol. By default those are its listen addresses as seen on its own interfaces. On most cloud VMs and behind a 1:1 NAT those are private, and a client that reconnects after a dropped connection has nothing it can reach. Tell the server its public address.

The simplest way is external_ip. The server advertises every listen address on that IP, one per transport:

/etc/ricochet/config.yaml
server:
external_ip: 203.0.113.10

Or --external-ip 203.0.113.10. With the five listen addresses above, the server advertises /ip4/203.0.113.10/udp/55223/udx, /ip4/203.0.113.10/tcp/55223 and so on, and WebTransport’s certificate hashes are added to its address as usual. Listen addresses of the other IP family and those bound to loopback are left out. On the .deb install, set EXTERNAL_IP in /etc/ricochet/env instead; see Process supervision.

To name addresses one by one, such as a DNS name or a reverse proxy’s /wss address, use external_addresses (or --external-addrs, comma-separated):

/etc/ricochet/config.yaml
server:
external_addresses:
- /dns4/ricochet.example.com/tcp/443/wss

You can set both; the server advertises the union. Every external address needs its transport in server.transports, and an address that does not parse stops startup.

At startup the server logs advertising external addresses with the count, and host advertised addresses with the full list.

Open every listen port inbound with its protocol: UDP for udx, quic-v1 and webtransport, TCP for tcp and websocket. The default is UDP 55223 alone. Keep the ops port (TCP 9090) closed to the outside; it binds to loopback by default. See Health & readiness.

With the relay service on (the default), the server also accepts Circuit Relay v2 reservations and relays connections between peers that cannot reach each other directly. Those relayed connections ride on whichever transport each peer used to reach the server. See NAT traversal & relay.

Terminal window
# Which sockets the process holds
sudo ss -ulpn | grep ricochet
sudo ss -tlpn | grep ricochet

In the log, transports configured lists the transports, server started lists the listen addresses (field addrs), and registered protocols lists every protocol ID the host serves.

  • Clients time out connecting: check that the port is open end to end with the right protocol, including any cloud security group. A TCP port check tells you nothing about a UDP transport.
  • Clients connect once, then cannot reconnect: the server advertises only private addresses. Set external_ip.
  • A stock libp2p host cannot connect: the server runs UDX only, the default. Enable tcp, quic-v1, websocket or webtransport.
  • Startup fails with both claim udp port: UDX and QUIC share a UDP port, often because --port or LISTEN_PORT moved them together. Give them different ports in listen_addresses.
  • Startup fails binding the port: another process holds it, or you listed both an IPv6 wildcard and an IPv4 wildcard on the same port.