mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-11-03 04:17:17 -05:00
Added namespace support for aggregating relays
This commit is contained in:
parent
85a09dac6a
commit
4ce4616be3
@ -118,6 +118,7 @@
|
||||
<port>8001</port>
|
||||
<username>relay</username>
|
||||
<password>hackme</password>
|
||||
<namespace>master1</namespace>
|
||||
<on-demand>1</on-demand>
|
||||
</master>
|
||||
-->
|
||||
|
@ -35,6 +35,9 @@ can be setup such that all that needs to be done is configure the slave server w
|
||||
will also periodically check the master server to see if any new mountpoints have attached and if so will relay those
|
||||
as well. </p>
|
||||
|
||||
<p>This "master-slave" type relay has been extended to support aggregation so that multiple masters can be given
|
||||
and the slave will "aggregate" all of the mountpoints for those master servers. </p>
|
||||
|
||||
<p>The second type of relay is a “single-broadcast” relay. In this case, the slave server is configured with a
|
||||
server IP, port and mount and only the mountpoint specified is relayed. In order to relay a broadcast stream on
|
||||
a Shoutcast server, you must use the “single-broadcast” relay and specify a mountpoint of <code>/</code>.</p>
|
||||
@ -61,6 +64,36 @@ be identical to those on the master server. </p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="article">
|
||||
<h3 id="setting-up-a-master-slave-aggregating-relay">Setting Up a Master-Slave Aggregating Relay</h3>
|
||||
<p>In order to setup a relay of this type all servers (the one you wish to relay and the one doing the relaying)
|
||||
need to be Icecast 2 servers. The following configuration snippet is used as an example:</p>
|
||||
|
||||
<div class="highlight"><pre><code class="language-xml" data-lang="xml"><span class="nt"><master-update-interval></span>120<span class="nt"></master-update-interval></span>
|
||||
<span class="nt"><master></span>
|
||||
<span class="nt"><server></span>192.168.1.11<span class="nt"></server></span>
|
||||
<span class="nt"><port></span>8001<span class="nt"></port></span>
|
||||
<span class="nt"><namespace></span>/upstream1<span class="nt"></namespace></span>
|
||||
<span class="nt"><password></span>hackme<span class="nt"></password></span>
|
||||
<span class="nt"><on-demand></span>1<span class="nt"></on-demand></span>
|
||||
<span class="nt"></master></span>
|
||||
<span class="nt"><master></span>
|
||||
<span class="nt"><server></span>192.168.1.12<span class="nt"></server></span>
|
||||
<span class="nt"><port></span>8001<span class="nt"></port></span>
|
||||
<span class="nt"><password></span>hackme<span class="nt"></password></span>
|
||||
<span class="nt"></master></span>
|
||||
</code></pre></div>
|
||||
|
||||
<p>In this example, this configuration is setup in the server which will be doing the relaying (slave server).
|
||||
The master servers in this case need not be configured (and actually they are unaware of the relaying being performed)
|
||||
as relays. When the slave server is started, it will connect to each of the master servers located at 192.168.1.11:8001
|
||||
and 192.168.1.12:8001 and will begin to relay all mountpoints connected to the master servers. Additionally,
|
||||
every master-update-interval (120 seconds in this case) the slave server will poll the master servers to see if any new
|
||||
mountpoints have connected, and if so, the slave server will relay those as well. Note that all mountpoints of the master
|
||||
server at 192.168.1.11:8001 will have the namespace "/upstream1" prepended to it's mountpoints. </p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="article">
|
||||
<h3 id="setting-up-a-single-broadcast-relay">Setting Up a Single-Broadcast Relay</h3>
|
||||
<p>In this case, the master server need not be an Icecast 2 server. Supported master servers for a single-broadcast
|
||||
|
@ -1653,6 +1653,11 @@ static void _parse_master(xmlDocPtr doc,
|
||||
xmlFree(master->password);
|
||||
master->password = (char *)xmlNodeListGetString(doc,
|
||||
node->xmlChildrenNode, 1);
|
||||
} else if (xmlStrcmp(node->name, XMLSTR("namespace")) == 0) {
|
||||
if (master->namespace)
|
||||
xmlFree(master->namespace);
|
||||
master->namespace = (char *)xmlNodeListGetString(doc,
|
||||
node->xmlChildrenNode, 1);
|
||||
} else if (xmlStrcmp(node->name, XMLSTR("on-demand")) == 0) {
|
||||
tmp = (char *)xmlNodeListGetString(doc, node->xmlChildrenNode, 1);
|
||||
master->on_demand = util_str_to_bool(tmp);
|
||||
|
11
src/slave.c
11
src/slave.c
@ -72,6 +72,8 @@ master_server *master_free (master_server *master)
|
||||
xmlFree (master->username);
|
||||
if (master->password)
|
||||
xmlFree (master->password);
|
||||
if (master->namespace)
|
||||
xmlFree(master->namespace);
|
||||
free (master);
|
||||
return next;
|
||||
}
|
||||
@ -688,7 +690,14 @@ static int update_from_master(master_server *master)
|
||||
}
|
||||
|
||||
r->mount = strdup(parsed_uri->path);
|
||||
r->localmount = strdup(parsed_uri->path);
|
||||
if (master->namespace)
|
||||
{
|
||||
int mountlen = strlen(master->namespace) + strlen(parsed_uri->path) + 1;
|
||||
r->localmount = malloc(mountlen);
|
||||
snprintf(r->localmount, mountlen, "%s%s", master->namespace, parsed_uri->path);
|
||||
} else {
|
||||
r->localmount = strdup(parsed_uri->path);
|
||||
}
|
||||
r->mp3metadata = 1;
|
||||
r->on_demand = master->on_demand;
|
||||
r->next = new_relays;
|
||||
|
@ -21,6 +21,7 @@ typedef struct _master_server {
|
||||
char *username;
|
||||
char *password;
|
||||
int on_demand;
|
||||
char *namespace;
|
||||
struct _master_server *next;
|
||||
} master_server;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user