Source / Input / Active
icecast.server
Start an icecast-compatible server
Type:
(?name : string, ?port : int, ?password : string, ?dedicated_encoder : bool,
?x_forwarded_for_proxy_ips : [string?]?,
?x_forwarded_for : ((
{
headers : [string * string],
ip : string?,
protocol : string,
proxy_ips : [string?],
uri : string
}) -> string?)?,
?format_options : ((string) -> [string * string])?, ?config : string?,
?serve : bool,
?serve_auth : ((
{
body : (?timeout : float) -> string,
data : (?timeout : float) -> string,
headers : [string * string],
http_version : string,
method : string,
path : string,
query : [string * string]
}) -> bool)?,
?serve_json : (([string *
{
content_type : string,
current_metadata : [string * string],
listeners : [
{
ip : string,
protocol : string,
uri : string
}],
mime_type : string?,
name : string,
peak_listeners : int,
started : float
}]) -> string)?,
?serve_html : (([string *
{
content_type : string,
current_metadata : [string * string],
listeners : [
{
ip : string,
protocol : string,
uri : string
}],
mime_type : string?,
name : string,
peak_listeners : int,
started : float
}]) -> string)?) -> unit
Arguments:
name(of typestring, which defaults to"icecast.server"): Telnet command namespaceport(of typeint, which defaults to8000): Port to listen onpassword(of typestring, which defaults to"hackme"): Source password for authenticationdedicated_encoder(of typebool, which defaults tofalse): Whentrue, create a separate encoder instance for each listener. This uses more resources but ensures each listener gets a clean encoder state.x_forwarded_for_proxy_ips(of type[string?]?, which defaults tonull): List of known reverse-proxy IPs. When set, theX-Forwarded-Forheader is walked right-to-left and the first non-proxy IP is used as the listener IP in stats. Use only when liquidsoap is behind a trusted reverse proxy.x_forwarded_for(of type(( { headers : [string * string], ip : string?, protocol : string, proxy_ips : [string?], uri : string }) -> string?)?, which defaults tonull): Advanced: custom callback({ip, headers, proxy_ips, protocol, uri}) -> stringto extract the real listener IP. When set, overrides the defaultX-Forwarded-Forlogic.proxy_ipsin the record is populated fromx_forwarded_for_proxy_ips.format_options(of type((string) -> [string * string])?, which defaults tonull): Callback(string) -> [(string * string)]that returns muxer options for a given container format name. Whennull, falls back tosettings.icecast.server.default_muxer_options.config(of typestring?, which defaults tonull): Optional path to an icecast XML configuration fileserve(of typebool, which defaults totrue): Whenfalse, disable the status page at/and JSON stats at/status.json.serve_auth(of type(( { body : (?timeout : float) -> string, data : (?timeout : float) -> string, headers : [string * string], http_version : string, method : string, path : string, query : [string * string] }) -> bool)?, which defaults tonull): When provided, called with the request and must returntrueto allow access to the status endpoints.serve_json(of type(([string * { content_type : string, current_metadata : [string * string], listeners : [{ip : string, protocol : string, uri : string}], mime_type : string?, name : string, peak_listeners : int, started : float }]) -> string)?, which defaults tonull): When provided, called with the stats list and must return a JSON string for the/status.jsonendpoint.serve_html(of type(([string * { content_type : string, current_metadata : [string * string], listeners : [{ip : string, protocol : string, uri : string}], mime_type : string?, name : string, peak_listeners : int, started : float }]) -> string)?, which defaults tonull): When provided, called with the stats list and must return an HTML string for the/endpoint.
Methods:
get_config(of type(string) -> { format : string?, streams : [ { channel_layout? : string, channels? : int, codec : string, field : string, frame_rate? : float?, height? : int, pixel_format? : string, samplerate? : int, type : string, width? : int }]}?):get_source(of type(string) -> source('A)?):mounts(of type() -> [string]):stats(of type() -> [string * { content_type : string, current_metadata : [string * string], listeners : [{ip : string, protocol : string, uri : string}], mime_type : string?, name : string, peak_listeners : int, started : float }]): Returns a list of(mount, stats)pairs. Each stats record contains: name, content_type, started, listeners, peak_listeners, and current_metadata.
Callbacks:
on_connect(of type(?synchronous : bool, (( { format : string?, headers : [string * string], mount : string, source : source('A) .{on_disconnect : (synchronous : bool, (() -> unit)) -> unit }, streams : [ { channel_layout? : string, channels? : int, codec : string, field : string, frame_rate? : float?, height? : int, pixel_format? : string, samplerate? : int, type : string, width? : int }] }) -> unit)) -> unit): Called when a source connects. Receives a record with mount, source, format, streams, and headers fields.on_disconnect(of type(?synchronous : bool, (({mount : string}) -> unit)) -> unit): Called when a source disconnects. Receives a record with a mount field.
icecast.server.default_prepare
Default prepare function for icecast.server. Builds a standard fallback source and calls output.harbor.
Type:
('f
.{
burst : int?,
copy_encoder : ('a, options : 'b) -> format('c),
dedicated_encoder : bool,
dumpfile : string?,
format : 'a,
headers : [string * string],
mount : string,
muxer_opts : 'b,
port : int,
source_headers : 'e,
streams : 'd,
timeout : float,
transport : http_transport
}) ->
('g
.{
fallback : source('c)?,
mime_type : string?,
on_listener_connect : (
{
headers : [string * string],
ip : string,
protocol : string,
uri : string
}) -> unit,
on_listener_disconnect : (string) -> unit,
source : source('c)
}) ->
{
clock : clock,
last_metadata : () -> [string * string]?,
shutdown : () -> unit}
Arguments:
(unlabeled)(of type'f .{ burst : int?, copy_encoder : ('a, options : 'b) -> format('c), dedicated_encoder : bool, dumpfile : string?, format : 'a, headers : [string * string], mount : string, muxer_opts : 'b, port : int, source_headers : 'e, streams : 'd, timeout : float, transport : http_transport })
icecast.server.ssl_transport
SSL transport for icecast.server using http.transport.ssl. Overrides TLS transport when both are available.
Type:
(string?, string?) -> http_transport
Arguments:
(unlabeled)(of typestring?)(unlabeled)(of typestring?)
Methods:
default_port(of typeint): Transport default portname(of typestring): Transport nameprotocol(of typestring): Transport protocol
icecast.server.tls_transport
TLS transport for icecast.server using http.transport.tls.
Type:
(string?, string?) -> http_transport
Arguments:
(unlabeled)(of typestring?)(unlabeled)(of typestring?)
Methods:
default_port(of typeint): Transport default portname(of typestring): Transport nameprotocol(of typestring): Transport protocol
icecast.server.x_forwarded_for
Default X-Forwarded-For IP extraction for icecast.server. Walks the X-Forwarded-For header from right to left, skipping any IP present in proxy_ips, and returns the first non-proxy IP. When proxy_ips is empty, returns the rightmost entry unconditionally (trust-all mode).
Type:
('a.{headers : [string * string], ip : string?, proxy_ips : [string?]}) ->
string?
Arguments:
(unlabeled)(of type'a.{headers : [string * string], ip : string?, proxy_ips : [string?]})
settings.icecast.server.default_muxer_options
Default muxer options applied when remuxing incoming streams via copy_encoder, keyed by container format name. Used to enable live/streaming-compatible output for formats that require explicit opt-in.
Type:
() -> [string * [string * string]]
settings.icecast.server.tls_transport
Preferred TLS transport for icecast.server. A pair of (name, factory) where factory takes a certificate path and an optional private key path and returns an HTTP transport.
Type:
() ->
string *
(('a, 'b) -> http_transport
.{default_port : int, name : string, protocol : string})