Command line
goryu <config.json>
goryu <srt-input-uri> <srt-output-uri>
goryu --version
The config-file form is the one to use. The two-URI form takes SRT socket
options directly from each URI's query string (transtype, groupconnect,
latency, rcvlatency, passphrase, pbkeylen) and listens for status on
port 8081. The environment variable SRT_BONDING_STATUS_PORT moves that port; it is
the only way to do so in this form, and it overrides status_port of a config file
too. A value that is not a port number (1 to 65535) is ignored, and the log says so
(SRT_BONDING_STATUS_PORT is not a port number ... ignored). The variable keeps its
name from before the rename to Goryu.
goryu.json
{
"input_host": "0.0.0.0",
"input_port": 10081,
"output_host": "127.0.0.1",
"output_port": 10080,
"status_port": 8081,
"passphrase": "secret-value"
}
| Field | Meaning |
|---|---|
input_host |
Interface the SRT listener binds to (an IPv4 address; 0.0.0.0 for all) |
input_port |
UDP port encoders connect to, bonded or plain |
output_host |
Downstream SRT server host |
output_port |
Downstream SRT server port |
status_port |
TCP port of the status API, bound to 127.0.0.1 only |
passphrase |
SRT passphrase for the input, and for the output unless output_passphrase is set; 10 to 79 characters; "" disables encryption |
output_passphrase |
Optional. The passphrase for the downstream connection only: "" for a downstream without encryption, or a different passphrase. Left out, the output uses passphrase |
The first six fields are required (output_passphrase is optional), the three ports
must be whole numbers from 1 to 65535 and each passphrase must be empty or 10 to 79
characters. Anything else makes
Goryu exit at startup with Bad config file <path>: <reason> and a non-zero
status, where the reason names the key or the byte where the file stopped making
sense (never a value). The file is a flat JSON object read by a small scanner
(why), so keep it to these
keys and no comments:
- A duplicate key, a nested object or array, a missing or trailing comma, or text after the closing brace is refused.
- A key Goryu does not know is ignored, with a log line naming the first one
(
Config file <path>: ignoring 1 unknown key(s), the first is "outpt_passphrase"; check the spelling). It is not refused so that a config with an extra key still starts, but a misspelledoutput_passphrasewould otherwise change what the relay does without a word. - In a string only the escapes
\",\\and\/are understood; any other is refused.
In this mode the input listener runs transtype=live with latency=240 ms and
group connections enabled, and the downstream connection is a caller with
transtype=live and latency=200 ms. The negotiated values are reported in the
status API.
Streamid routing
Goryu does not interpret the streamid. It accepts any streamid an encoder
sends, keys that stream's state on it, and copies it verbatim onto the
downstream connection. One listener can therefore serve many logical streams,
each landing on whatever the downstream does with that streamid (for example, a
publish authorization hook that checks it as a stream key).
Only one publisher per streamid is active at a time; see duplicate publishers.
Passphrase
When passphrase is set, Goryu sets SRTO_PASSPHRASE on the input listener and
leaves validation to libsrt's normal encrypted handshake. Encoders must use the same
passphrase. By default the output connection uses it too, so the downstream server
needs the same one. To run unencrypted end to end, use "".
The passphrase is also the only thing that keeps strangers out: a caller without it
is refused in the handshake and never gets a session. With "", anyone who can reach
the input port can publish and hold sessions until the table's 256 are full, so leave
it empty only where a firewall or a private network limits who can reach the port.
Destination passphrase
The downstream server does not have to share the encoder's passphrase. Add
output_passphrase to give the output connection its own:
passphrase |
output_passphrase |
Encoders to Goryu | Goryu to the downstream |
|---|---|---|---|
"A..." |
left out | encrypted with A | encrypted with A |
"A..." |
"" |
encrypted with A | not encrypted |
"A..." |
"B..." |
encrypted with A | encrypted with B |
"" |
"B..." |
not encrypted | encrypted with B |
The usual case is a downstream on the same host or a trusted network that does not
use a passphrase, while the encoders cross the internet. Leaving the key out keeps
the earlier behavior, so existing configs are unchanged. An empty output_passphrase
is deliberate and does not fall back to passphrase: if the downstream still requires
one, the connection is refused and retried like any rejecting downstream (see
Reliability).
libsrt accepts only 10 to 79 bytes. Goryu checks the length at startup and refuses to run otherwise, and every other SRT option it applies is checked the same way, so a refused option stops the relay instead of being ignored (the reason). The passphrase is not written to the log; see Architecture.
The two-URI command line follows the same rule for a passphrase in either URI.
Every local user can read a process's command line (ps, /proc/<pid>/cmdline), so
Goryu overwrites a passphrase there with * as soon as it has read it. It is still
visible for that first moment and in your shell history, which is another reason to
use the config file.
A caller with a wrong passphrase is rejected by libsrt during the handshake, before Goryu is handed a connection, so Goryu never learns the caller's address for those attempts. See what is not logged.