Difference between revisions of "AceStream 3.0/en"

From Ace Stream Wiki
Jump to: navigation, search
(Как запустить без удаления старой версии)
(Where to download)
 
(19 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
==Where to download==
 
==Where to download==
You can download the latest alpha-versions of the engine here:
+
https://wiki.acestream.media/Download
* Ubuntu 12 amd64: http://dl.acestream.org/ubuntu/12/acestream_3.0.0-a5_ubuntu_12_amd64.tar.gz
 
* CentOS 6 amd64: http://dl.acestream.org/centos/6/acestream_3.0.0-a5_centos_6_amd64.tar.gz
 
  
 
==Changelog==
 
==Changelog==
 +
''3.0.2''
 +
*ability to filter traffic at special nodes is added (look at [[#Traffic filtration|Traffic filtration]])
 +
 +
''3.0.1''
 +
*a large-scale optimization of all modules was held
 +
 +
''3.0.0-a18''
 +
*bug, because of which some support nodes could lose connection with the source, was fixed
 +
*parameter <tt>--title</tt> became required (this parameter transfers "readable" name of broadcast which is displayed at users' players during playback)
 +
*two required parameters for the source are added:
 +
**<tt>--quality</tt> - channel's quality; possible values:
 +
***SD
 +
***HD
 +
**<tt>--category</tt> - channel's category; possible values:
 +
***informational
 +
***entertaining
 +
***educational
 +
***movies
 +
***documentaries
 +
***sport
 +
***fashion
 +
***music
 +
***regional
 +
***ethnic
 +
***religion
 +
***teleshop
 +
***erotic_18_plus
 +
***other_18_plus
 +
***cyber_games
 +
***amateur
 +
***webcam
 +
 +
''3.0.0-a12''
 +
*CPU usage was significantly optimized
 +
*memory leaks were eliminated
 +
 
''3.0.0-a5''
 
''3.0.0-a5''
 
*start nodes are added
 
*start nodes are added
Line 14: Line 48:
 
''3.0.0-a1''
 
''3.0.0-a1''
 
*the first alpha-version
 
*the first alpha-version
 +
 +
==How to install over the old version==
 +
* download package for your OS
 +
* unzip to a temporary folder (for example, to /tmp/acestream)
 +
* copy appropriate files from temporary folder to root folders /usr/bin/ and /usr/share/acestream (all old files and folders can be deleted)
 +
 +
IMPORTANT: For the work of a new engine package <tt>python-setuptools</tt> must be installed.
  
 
==How to launch without deleting an old version==
 
==How to launch without deleting an old version==
Line 43: Line 84:
 
Also this script automatically passes the path to libraries to the engine through the parameter --lib-path, so there is no need to specify it additionally.
 
Also this script automatically passes the path to libraries to the engine through the parameter --lib-path, so there is no need to specify it additionally.
  
==Изменения в параметрах запуска==
+
==Changes in launch parameters==
В новой версии есть некоторые отличия по параметрам запуска.
+
In a new version there are some differences on launch parameters.
  
===Новые флаги для запуска движка в разных режимах===
+
===New flags for the engine launch in different modes===
*--stream-source-node (вместо --stream-source)
+
*--stream-source-node (instead of --stream-source)
*--stream-support-node (вместо --stream-node)
+
*--stream-support-node (instead of --stream-node)
  
===Новые параметры для настройки кеша===
+
===New parameters for setting up cache===
*--live-cache-type (string) - тип кеша: disk - хранить кеш на диске в папке, указанной параметром --cache-dir, memory - хранить кеш в оперативной памяти (по умолчанию: disk)
+
*--live-cache-type (string) - cache type: disk - store the cache on the disk in the folder specified by parameter --cache-dir, memory - store the cache in random-access memory (by default: disk)
*--live-cache-size (integer) - максимальный размер кеша в байтах (по умолчанию: 209715200 байт (200 Мб))
+
*--live-cache-size (integer) - maximum size of the cache in bytes (by default: 209715200 bytes (200 Mb))
  
===Новые параметры для конфигурации инфраструктуры узлов поддержки===
+
===New parameters for configuration of support nodes infrastructure===
*--private-node (0 or 1) - если указать 1, то узел будет приватным (по умолчанию 0)
+
*--private-node (0 or 1) - if you specify 1, the node will be private (by default: 0)
*--download-from (string) - добавить адрес к списку узлов, с которых данному узлу разрешено получать данные. Адрес должен задаваться в формате ipv4_address:port. Этот параметр может встречаться несколько раз.
+
*--download-from (string) - add the address to a list of nodes from which this node is allowed to receive data. The address must be specified in a format ipv4_address:port. This parameter may occur more than once.
*--upload-to (string) - добавить адрес к списку узлов, которым данному узлу разрешено отдавать данные. Адрес должен задаваться в формате ipv4_address:port. Этот параметр может встречаться несколько раз.
+
*--upload-to (string) - add the address to the list of nodes to which this node is allowed to give data. The address must be specified in a format ipv4_address:port. This parameter may occur more than once.
*--monitor-node-ip (string) - ipv4 адрес мониторинг-сервера
+
*--monitor-node-ip (string) - ipv4 address of monitoring-server
  
===Новые параметры для запуска источника===
+
===New parameters to launch the source===
*--metatracker (string) - добавить адрес метатрекера в транспортный файл
+
*--metatracker (string) - add the address of metatracker to the transport file
  
===Эти параметры уже не используются===
+
===These parameters are not used any more===
*--stream-source (изменен на --stream-source-node)
+
*--stream-source (is changed to --stream-source-node)
*--stream-node (изменен на --stream-support-node)
+
*--stream-node (is changed to --stream-support-node)
*--add-authorized-peers (список авторизированных пиров больше не добавляется в транспортный файл)
+
*--add-authorized-peers (list of authorized peers is not added to transport file any more)
*--private-source (заменен на --private-node)
+
*--private-source (is changed to --private-node)
 
*--support-node
 
*--support-node
 
*--source-node
 
*--source-node
Line 74: Line 115:
 
*--allow-peers-download
 
*--allow-peers-download
  
==Новый функционал==
+
==New functional==
  
===Настройка узлов поддержки===
+
===Setting up support nodes===
В новой версии узлам поддержки необходимо явным образом указывать, с каких узлов они должны скачивать данные. Для этого используется параметр <tt>--download-from</tt>. Список узлов, с которых разрешено скачивание, может быть изменен без перезапуска узла поддержки через веб-интерфейс узла (см. ниже). Например, если по адресу 192.168.1.2:7764 запущен узел-источник и мы хотим запустить узел поддержки, который будет качать данные только с источника, то команда для запуска узла поддержки будет выглядеть так:
+
In a new version it is necessary to explicitly specify to support nodes from which nodes they have to download data. For this, parameter <tt>--download-from</tt> is used. A list of nodes, from which downloading is allowed, can be changed without restarting support node through node's web-interface (look below). For example, if  node-source is launched by address 192.168.1.2:7764 and we want to launch support node which loads data only from the source, a command to launch support node will be following:
 
  <nowiki>acestreamengine \
 
  <nowiki>acestreamengine \
 
  --stream-support-node \
 
  --stream-support-node \
Line 84: Line 125:
 
  --download-from "192.168.1.2:7764"</nowiki>
 
  --download-from "192.168.1.2:7764"</nowiki>
  
===Приватные узлы===
+
===Private nodes===
Приватный узел отдает данные только узлам, которые явным образом добавлены в его список разрешенных. Для того, чтобы сделать узел приватным, нужно запустить его с параметром <tt>--private-node 1</tt>. Для добавления адреса в список разрешенных на отдачу используется параметр <tt>--upload-to</tt>. Приватным может быть как узел-источник, так узел поддержки. Приватный узел отбивает входящие соединения со всех адресов, кроме указанных параметрами <tt>--download-from</tt>, <tt>--upload-to</tt> и <tt>--monitor-node-ip</tt>. Для фильтрации используется только ip-адрес (порт не используется). Параметр <tt>--monitor-node-ip</tt> задает ip-адрес сервера мониторинга и используется в том случае, если нужно обеспечить мониторинг приватного узла (без указание этого параметра приватный узел будет отбивать все запросы от сервера мониторинга).
+
Private node gives data only to nodes that explicitly are added to its list of allowed. In order to make a node private you have to launch it with a parameter <tt>--private-node 1</tt>. To add the address to the list of allowed to upload a parameter <tt>--upload-to</tt> is used. Both, node-source and support node, can be private. Private node repulses incoming connections from all addresses except specified by parameters <tt>--download-from</tt>, <tt>--upload-to</tt> and <tt>--monitor-node-ip</tt>. To filter only ip-address is used (port is not used). Parameter <tt>--monitor-node-ip</tt> sets ip-address of the monitoring server and is used in case if there is a need to provide monitoring of the private node (without specifying this parameter private node will repulse all requests from the monitoring server).
  
Пример запуска приватного источника, который будет отдавать данные только узлу поддержки из предыдущего примера:
+
Example of launching the private source which will give data only to support node from the previous example:
 
  <nowiki>acestreamengine \
 
  <nowiki>acestreamengine \
 
   --stream-source-node \
 
   --stream-source-node \
Line 100: Line 141:
 
   --upload-to "192.168.1.3:8631"</nowiki>
 
   --upload-to "192.168.1.3:8631"</nowiki>
  
===Стартовые узлы===
+
===Start nodes===
Стартовый узел предназначен для обеспечения максимально быстрого старта трансляции у пользователей.
+
Start node is intended to provide the fastest possible start of a broadcast from users' side.
  
Особенность работы стартового узла - постоянная ротация соединений. При получении новых входящих соединений стартовый узел разрывает соединения с узлами, которые подключились ранее и уже скачали определенный объем данных.
+
A special feature of the start node is a constant rotation of connections. When new incoming connections are received the start node terminates connections to nodes which were connected earlier and have already downloaded certain amount of data.
  
Для запуска движка в режиме стартового узла используется параметр <tt>--stream-startup-node</tt>.
+
To launch the engine in the start node mode parameter <tt>--stream-startup-node</tt> is used.
  
Стартовый узел принимает такой же набор параметров, как и узел поддержки.
+
The start node takes the same set of parameters as the support node.
 
<!--
 
<!--
 
Стартовый узел принимает такой же набор параметров, как и узел поддержки, плюс некоторые дополнительные параметры:
 
Стартовый узел принимает такой же набор параметров, как и узел поддержки, плюс некоторые дополнительные параметры:
Line 116: Line 157:
 
-->
 
-->
  
Пример запуска стартового узла:
+
Example of launching the start node:
 
  <nowiki>acestreamengine \
 
  <nowiki>acestreamengine \
 
  --stream-startup-node \
 
  --stream-startup-node \
Line 123: Line 164:
 
  --download-from "192.168.1.2:7764"</nowiki>
 
  --download-from "192.168.1.2:7764"</nowiki>
  
===Метатрекеры===
+
===Metatrackers===
  
Метатрекер - это сервер, который сообщает узлам о доступных трекерах и стартовых узлах.
+
Metatracker is a server which informs nodes about available trackers and start nodes.
  
URL метатрекера задается на источнике при создании трансляции и записывается в транспортный файл.
+
Metatracker's URL is given at the source when creating a broadcast and is recorded to the transport file.
  
Метатрекеры позволяют динамически добавлять трекеры и/или стартовые узлы для трансляции без необходимости перезапуска трансляции и пересоздания транспортного файла.
+
Metatrackers allow to add trackers and/or start nodes for the broadcast automatically without the need to restart the broadcast and recreate the transport file.
  
Пример запуска источника с метатрекером:
+
Example of launching a source with the metatracker:
 
  <nowiki>acestreamengine \
 
  <nowiki>acestreamengine \
 
   --stream-source-node \
 
   --stream-source-node \
Line 145: Line 186:
 
   --upload-to "192.168.1.3:8631"</nowiki>
 
   --upload-to "192.168.1.3:8631"</nowiki>
  
Метатрекер принимает запросы по протоколу HTTP и выдает ответ в формате JSON, поэтому метатрекер может быть реализован на базе любого веб-сервера.
+
Metatracker accepts requests via HTTP protocol and gives responds in JSON format, therefore the metatracker can be implemented on the basis of any web server.
  
Каждый узел при запуске трансляции отправляет на метатрекер HTTP GET запрос с параметром <tt>infohash</tt> (хеш трансляции в виде hex-строки). Пример запроса на метатрекер:
+
When broadcast starts, each node sends to the metatracker HTTP GET request with parameter <tt>infohash</tt> (broadcast hash as a hex-string). Example of the request to the metatracker:
 
  <nowiki>http://example.org/metatracker.php?infohash=a94a8fe5ccb19ba61c4c0873d391e987982fbbd3</nowiki>
 
  <nowiki>http://example.org/metatracker.php?infohash=a94a8fe5ccb19ba61c4c0873d391e987982fbbd3</nowiki>
  
Формат ответа:
+
Respond format:
 
  <nowiki>{
 
  <nowiki>{
 
     "trackers": ["tracker_url_1", "tracker_url_2", ...],
 
     "trackers": ["tracker_url_1", "tracker_url_2", ...],
Line 157: Line 198:
 
}</nowiki>
 
}</nowiki>
  
где
+
where
*tracker_url_1, tracker_url_2 - URL трекеров
+
*tracker_url_1, tracker_url_2 - trackers' URL
*node1_address, node2_address - адреса стартовых узлов в виде строк в формате ip:port (например, 192.168.1.2:8632)
+
*node1_address, node2_address - start nodes' addresses as strings in ip:port format (for example, 192.168.1.2:8632)
*UPDATE_INTERVAL_IN_SECONDS - интервал обновления в секундах (как часто каждый клиент должен повторно обращаться на метатрекер)
+
*UPDATE_INTERVAL_IN_SECONDS - update interval in seconds (how often each client has to reapply to metatreker)
  
Пример ответа:
+
Respond example:
 
  <nowiki>{
 
  <nowiki>{
 
     "trackers":["udp:\/\/tracker.example.org:2710\/announce"],
 
     "trackers":["udp:\/\/tracker.example.org:2710\/announce"],
Line 169: Line 210:
 
}</nowiki>
 
}</nowiki>
  
Пример серверного кода метатрекера на PHP:
+
Example of a server code on PHP:
 
  <nowiki><?php
 
  <nowiki><?php
 
$infohash = isset($_GET['infohash']) ? $_GET['infohash'] : '';
 
$infohash = isset($_GET['infohash']) ? $_GET['infohash'] : '';
Line 190: Line 231:
 
echo json_encode($data);</nowiki>
 
echo json_encode($data);</nowiki>
  
===Веб-интерфейс узла===
+
===Node's web-interface===
 +
Every node has web-interface to view current status, as well as options to change some of the parameters "on the fly" (without restarting the node).
 +
 
 +
Web-interface works on the main port of the node (specified by parameter <tt>--port</tt>).
 +
 
 +
By default web-interface is available only from the same machine, from which the node was launched.
 +
To allow  remote access, you have to launch the node with option <tt>--service-remote-access</tt>.
 +
Also you can set a password for web-interface to prevent unauthorized access, using option <tt>--service-access-token</tt>
 +
 
 +
Full list of options to customize web-interface:
 +
*<tt>--stats-report-interval</tt> - frequency of node's statistics update, in seconds (by default 60)
 +
*<tt>--stats-report-peers</tt> - if this option is set, a list of nodes that are currently connected to the node will be shown in monitoring (by default node list is not displayed).
 +
*<tt>--service-remote-access</tt> - allow remote access to web-interface
 +
*<tt>--service-access-token</tt> - set a password for web-interface
 +
 
 +
Access to web-interface is performed via HTTP-GET request to the node's port:
 +
*monitoring - <nowiki>http://node.address:PORT/app/TOKEN/monitoring</nowiki>
 +
*control - <nowiki>http://node.address:PORT/app/TOKEN/update</nowiki>
 +
 
 +
If node was launched without option <tt>--service-access-token</tt>, then TOKEN is not specified in the request.
 +
<br/>Responses are given in JSON format.
 +
 
 +
Examples:
 +
*request to the node without the password for web-interface:
 +
<nowiki>http://192.168.1.3:8640/app/monitor</nowiki>
 +
*request to the node with the password "qwerty" for web-interface:
 +
<nowiki>http://192.168.1.3:8640/app/qwerty/monitor</nowiki>
 +
 
 +
====Monitoring====
 +
Interface of monitoring gives the following information:
 +
*<tt>version</tt> - node's version
 +
*<tt>max_connections</tt> - maximum number of TCP-connections
 +
*<tt>max_peers</tt> - maximum number of concurrently connected nodes
 +
*<tt>max_upload_slots</tt> - maximum number of opened upload slots
 +
*<tt>download_speed</tt> - current speed of data download (byte/s)
 +
*<tt>upload_speed</tt> - current speed of data upload (byte/s)
 +
*<tt>connected_peers_count</tt> - number of connected nodes
 +
*<tt>connected_peers</tt> - list of connected nodes (empty, if option --stats-report-peers is not set)
 +
*<tt>upload_slots</tt> - current number of upload slots
 +
 
 +
====Management====
 +
To change node's parameters "on the fly" you have to send a request of the following kind to web-interface:
 +
<nowiki>http://192.168.1.3:8640/app/update?param1=value1&param2=value2...</nowiki>
 +
param1 and param2 set names of parameters that have to be updated, value1 and value2 are new values for the parameters.
 +
 
 +
Available for updating parameters:
 +
*<tt>max_peers</tt>
 +
*<tt>max_upload_slots</tt>
 +
 
 +
Example:
 +
<nowiki>http://192.168.1.3:8640/app/update?max_peers=100&max_upload_slots=30</nowiki>
 +
(keep the connection with 100 nodes simultaneously and open 30 upload slots)
 +
 
 +
===Traffic filtration===
 +
Starting from version 3.0.2 an ability to filter traffic at special nodes (source, support node and start node) was added. You can filter by ip-addresses or by geotargeting. Rules for the filtration should be put in a separate configuration file, path to which is passed in a special node in parameter --ip-filter-config.
 +
 
 +
Configuration file is a text file in JSON format with the following structure:
 +
<tt>{
 +
  "groups": {
 +
    "<group_1>": {
 +
      "addresses": ["<ip_address_1>", "<ip_address_2>", ...],
 +
      "countries": ["<country_code_1>", "<country_code_2>", ...]
 +
    },
 +
    "<group_2>": {
 +
      "addresses": ["<ip_address_1>", "<ip_address_2>", ...],
 +
      "countries": ["<country_code_1>", "<country_code_2>", ...]
 +
    },
 +
  },
 +
  "blacklist": {
 +
    "addresses": ["<ip_address_1>", "<ip_address_2>", ...],
 +
    "countries": ["<country_code_1>", "<country_code_2>", ...],
 +
    "groups": ["<group_1>", "<group_2>", ...]
 +
  },
 +
  "whitelist": {
 +
    "addresses": ["<ip_address_1>", "<ip_address_2>", ...],
 +
    "countries": ["<country_code_1>", "<country_code_2>", ...],
 +
    "groups": ["<group_1>", "<group_2>", ...]
 +
  },
 +
  "limit_groups": {
 +
    "<group_1>": "30%",
 +
    "<group_2>": "10%"
 +
  }
 +
}</tt>
 +
 
 +
Section <tt>groups</tt> is used to create named groups, that can be referenced in other sections of the file.
 +
Each group may consist of an array ip-addresses (<tt>addresses</tt>) or country codes (<tt>countries</tt>).
 +
 
 +
Array <tt>addresses</tt> may contain addresses of individual hosts, as well as addresses of subnetworks in the format xx.xx.xx.xx/yy. At this moment it is allowed to use only subnetworks /24, /16 and /8.
 +
 
 +
Array <tt>countries</tt> has to contain country codes in uppercase (according to the base [https://www.maxmind.com MaxMind])
 +
 
 +
Section <tt>whitelist</tt> sets a white list. The node rejects connections from all addresses that are not included in a white list.
  
====Мониторинг====
+
Section <tt>blacklist</tt> sets a black list. The node rejects connections from all addresses from a black list.
скоро будет
 
  
====Управление====
+
Section <tt>limit_groups</tt> sets limits on the maximum number of connections for each group (in percentage of the total maximum number of connections).
скоро будет
 

Latest revision as of 12:58, 17 October 2021

Where to download

https://wiki.acestream.media/Download

Changelog

3.0.2

3.0.1

  • a large-scale optimization of all modules was held

3.0.0-a18

  • bug, because of which some support nodes could lose connection with the source, was fixed
  • parameter --title became required (this parameter transfers "readable" name of broadcast which is displayed at users' players during playback)
  • two required parameters for the source are added:
    • --quality - channel's quality; possible values:
      • SD
      • HD
    • --category - channel's category; possible values:
      • informational
      • entertaining
      • educational
      • movies
      • documentaries
      • sport
      • fashion
      • music
      • regional
      • ethnic
      • religion
      • teleshop
      • erotic_18_plus
      • other_18_plus
      • cyber_games
      • amateur
      • webcam

3.0.0-a12

  • CPU usage was significantly optimized
  • memory leaks were eliminated

3.0.0-a5

  • start nodes are added

3.0.0-a2

  • support nodes are added
  • options for configuration of private nodes and schemes of distribution of traffic between support nodes and a source are added

3.0.0-a1

  • the first alpha-version

How to install over the old version

  • download package for your OS
  • unzip to a temporary folder (for example, to /tmp/acestream)
  • copy appropriate files from temporary folder to root folders /usr/bin/ and /usr/share/acestream (all old files and folders can be deleted)

IMPORTANT: For the work of a new engine package python-setuptools must be installed.

How to launch without deleting an old version

Alpha-version can be launched on a server simultaneously with any release version.

For the launching you need to:

  • download archive for your OS
  • unpack archive in any folder (for example, /opt/acestream/engine_new)
  • launch acestreamengine file in the unpacked folder with a parameter --lib-path /path/to/acestream_libraries. Example:
/opt/acestream/engine_new/acestreamengine --lib-path /opt/acestream/engine_new

Parameter --lib-path sets the path to Ace Stream libraries. By default the path /usr/share/acestream is used. If the release version of the engine is already installed on the server, it will be launched without specifying the parameter --lib-path. To know for sure which version was launched, you can check the version from command line. For example, if version 2.1.6 is already installed, the result without specifying --lib-path will be following:

# /opt/acestream/engine_new/acestreamengine --version
version: 2.1.6 revision: 293

With specifying --lib-path a new version will be launched:

# /opt/acestream/engine_new/acestreamengine --lib-path /opt/acestream/engine_new --version
version: 3.0.0-a1 revision: 565

Launch on CentOS

On CentOS there are some features of the engine launch.

Standard library openssl on CentOS do not support some necessary for the engine functions. In this regard, together with the engine for CentOS there is a recompiled library openssl and module python-m2crypto, which is superstructure over openssl. These libraries are in the folder usr in archieve with the engine. To use them you have to copy folders "lib64" and "local" from the folder "usr" into appropriate folders in /usr. If the engine of the previous version is installed on the server, these libraries are in your system and there is no need to copy them.

To launch the engine under CentOS script start.sh is used instead of acestreamengine in the folder with the engine.

This script sets an environment variable LD_LIBRARY_PATH=/usr/local/ssl/lib before the engine launch, so the recompiled version of the library openssl was used.

Also this script automatically passes the path to libraries to the engine through the parameter --lib-path, so there is no need to specify it additionally.

Changes in launch parameters

In a new version there are some differences on launch parameters.

New flags for the engine launch in different modes

  • --stream-source-node (instead of --stream-source)
  • --stream-support-node (instead of --stream-node)

New parameters for setting up cache

  • --live-cache-type (string) - cache type: disk - store the cache on the disk in the folder specified by parameter --cache-dir, memory - store the cache in random-access memory (by default: disk)
  • --live-cache-size (integer) - maximum size of the cache in bytes (by default: 209715200 bytes (200 Mb))

New parameters for configuration of support nodes infrastructure

  • --private-node (0 or 1) - if you specify 1, the node will be private (by default: 0)
  • --download-from (string) - add the address to a list of nodes from which this node is allowed to receive data. The address must be specified in a format ipv4_address:port. This parameter may occur more than once.
  • --upload-to (string) - add the address to the list of nodes to which this node is allowed to give data. The address must be specified in a format ipv4_address:port. This parameter may occur more than once.
  • --monitor-node-ip (string) - ipv4 address of monitoring-server

New parameters to launch the source

  • --metatracker (string) - add the address of metatracker to the transport file

These parameters are not used any more

  • --stream-source (is changed to --stream-source-node)
  • --stream-node (is changed to --stream-support-node)
  • --add-authorized-peers (list of authorized peers is not added to transport file any more)
  • --private-source (is changed to --private-node)
  • --support-node
  • --source-node
  • --allow-source-download
  • --allow-support-download
  • --allow-peers-download

New functional

Setting up support nodes

In a new version it is necessary to explicitly specify to support nodes from which nodes they have to download data. For this, parameter --download-from is used. A list of nodes, from which downloading is allowed, can be changed without restarting support node through node's web-interface (look below). For example, if node-source is launched by address 192.168.1.2:7764 and we want to launch support node which loads data only from the source, a command to launch support node will be following:

acestreamengine \
 --stream-support-node \
 --url http://192.168.1.2/transport/test.acelive \
 --port 8631 \
 --download-from "192.168.1.2:7764"

Private nodes

Private node gives data only to nodes that explicitly are added to its list of allowed. In order to make a node private you have to launch it with a parameter --private-node 1. To add the address to the list of allowed to upload a parameter --upload-to is used. Both, node-source and support node, can be private. Private node repulses incoming connections from all addresses except specified by parameters --download-from, --upload-to and --monitor-node-ip. To filter only ip-address is used (port is not used). Parameter --monitor-node-ip sets ip-address of the monitoring server and is used in case if there is a need to provide monitoring of the private node (without specifying this parameter private node will repulse all requests from the monitoring server).

Example of launching the private source which will give data only to support node from the previous example:

acestreamengine \
  --stream-source-node \
  --port 7764 \
  --source "http://brodilo.tv/channel.php" \
  --name "test" \
  --title "test" \
  --bitrate 350000 \
  --publish-dir /var/www/transport \
  --cache-dir /var/cache/acestream \
  --private-node 1 \
  --upload-to "192.168.1.3:8631"

Start nodes

Start node is intended to provide the fastest possible start of a broadcast from users' side.

A special feature of the start node is a constant rotation of connections. When new incoming connections are received the start node terminates connections to nodes which were connected earlier and have already downloaded certain amount of data.

To launch the engine in the start node mode parameter --stream-startup-node is used.

The start node takes the same set of parameters as the support node.

Example of launching the start node:

acestreamengine \
 --stream-startup-node \
 --url http://192.168.1.2/transport/test.acelive \
 --port 8632 \
 --download-from "192.168.1.2:7764"

Metatrackers

Metatracker is a server which informs nodes about available trackers and start nodes.

Metatracker's URL is given at the source when creating a broadcast and is recorded to the transport file.

Metatrackers allow to add trackers and/or start nodes for the broadcast automatically without the need to restart the broadcast and recreate the transport file.

Example of launching a source with the metatracker:

acestreamengine \
  --stream-source-node \
  --port 7764 \
  --source "http://brodilo.tv/channel.php" \
  --metatracker "http://example.org/metatracker.php"
  --name "test" \
  --title "test" \
  --bitrate 350000 \
  --publish-dir /var/www/transport \
  --cache-dir /var/cache/acestream \
  --private-node 1 \
  --upload-to "192.168.1.3:8631"

Metatracker accepts requests via HTTP protocol and gives responds in JSON format, therefore the metatracker can be implemented on the basis of any web server.

When broadcast starts, each node sends to the metatracker HTTP GET request with parameter infohash (broadcast hash as a hex-string). Example of the request to the metatracker:

http://example.org/metatracker.php?infohash=a94a8fe5ccb19ba61c4c0873d391e987982fbbd3

Respond format:

{
    "trackers": ["tracker_url_1", "tracker_url_2", ...],
    "startup_nodes": ["node1_address", "node2_address", ...],
    "interval": UPDATE_INTERVAL_IN_SECONDS
}

where

  • tracker_url_1, tracker_url_2 - trackers' URL
  • node1_address, node2_address - start nodes' addresses as strings in ip:port format (for example, 192.168.1.2:8632)
  • UPDATE_INTERVAL_IN_SECONDS - update interval in seconds (how often each client has to reapply to metatreker)

Respond example:

{
    "trackers":["udp:\/\/tracker.example.org:2710\/announce"],
    "startup_nodes":["192.168.1.2:8632"],
    "interval":3600
}

Example of a server code on PHP:

<?php
$infohash = isset($_GET['infohash']) ? $_GET['infohash'] : '';

$trackers = array(
    'udp://tracker.example.org:2710/announce',
);

$startup_nodes = array(
    '192.168.1.2:8632',
);

$data = array(
    'trackers'      => $trackers,
    'startup_nodes' => $startup_nodes,
    'interval'      => 30,
);

header('Content-Type: application/json');
echo json_encode($data);

Node's web-interface

Every node has web-interface to view current status, as well as options to change some of the parameters "on the fly" (without restarting the node).

Web-interface works on the main port of the node (specified by parameter --port).

By default web-interface is available only from the same machine, from which the node was launched. To allow remote access, you have to launch the node with option --service-remote-access. Also you can set a password for web-interface to prevent unauthorized access, using option --service-access-token

Full list of options to customize web-interface:

  • --stats-report-interval - frequency of node's statistics update, in seconds (by default 60)
  • --stats-report-peers - if this option is set, a list of nodes that are currently connected to the node will be shown in monitoring (by default node list is not displayed).
  • --service-remote-access - allow remote access to web-interface
  • --service-access-token - set a password for web-interface

Access to web-interface is performed via HTTP-GET request to the node's port:

  • monitoring - http://node.address:PORT/app/TOKEN/monitoring
  • control - http://node.address:PORT/app/TOKEN/update

If node was launched without option --service-access-token, then TOKEN is not specified in the request.
Responses are given in JSON format.

Examples:

  • request to the node without the password for web-interface:
http://192.168.1.3:8640/app/monitor
  • request to the node with the password "qwerty" for web-interface:
http://192.168.1.3:8640/app/qwerty/monitor

Monitoring

Interface of monitoring gives the following information:

  • version - node's version
  • max_connections - maximum number of TCP-connections
  • max_peers - maximum number of concurrently connected nodes
  • max_upload_slots - maximum number of opened upload slots
  • download_speed - current speed of data download (byte/s)
  • upload_speed - current speed of data upload (byte/s)
  • connected_peers_count - number of connected nodes
  • connected_peers - list of connected nodes (empty, if option --stats-report-peers is not set)
  • upload_slots - current number of upload slots

Management

To change node's parameters "on the fly" you have to send a request of the following kind to web-interface:

http://192.168.1.3:8640/app/update?param1=value1&param2=value2...

param1 and param2 set names of parameters that have to be updated, value1 and value2 are new values for the parameters.

Available for updating parameters:

  • max_peers
  • max_upload_slots

Example:

http://192.168.1.3:8640/app/update?max_peers=100&max_upload_slots=30
(keep the connection with 100 nodes simultaneously and open 30 upload slots)

Traffic filtration

Starting from version 3.0.2 an ability to filter traffic at special nodes (source, support node and start node) was added. You can filter by ip-addresses or by geotargeting. Rules for the filtration should be put in a separate configuration file, path to which is passed in a special node in parameter --ip-filter-config.

Configuration file is a text file in JSON format with the following structure:

{
 "groups": {
   "<group_1>": {
     "addresses": ["<ip_address_1>", "<ip_address_2>", ...],
     "countries": ["<country_code_1>", "<country_code_2>", ...]
   },
   "<group_2>": {
     "addresses": ["<ip_address_1>", "<ip_address_2>", ...],
     "countries": ["<country_code_1>", "<country_code_2>", ...]
   },
 },
 "blacklist": {
   "addresses": ["<ip_address_1>", "<ip_address_2>", ...],
   "countries": ["<country_code_1>", "<country_code_2>", ...],
   "groups": ["<group_1>", "<group_2>", ...]
 },
 "whitelist": {
   "addresses": ["<ip_address_1>", "<ip_address_2>", ...],
   "countries": ["<country_code_1>", "<country_code_2>", ...],
   "groups": ["<group_1>", "<group_2>", ...]
 },
 "limit_groups": {
   "<group_1>": "30%",
   "<group_2>": "10%"
 }
}

Section groups is used to create named groups, that can be referenced in other sections of the file. Each group may consist of an array ip-addresses (addresses) or country codes (countries).

Array addresses may contain addresses of individual hosts, as well as addresses of subnetworks in the format xx.xx.xx.xx/yy. At this moment it is allowed to use only subnetworks /24, /16 and /8.

Array countries has to contain country codes in uppercase (according to the base MaxMind)

Section whitelist sets a white list. The node rejects connections from all addresses that are not included in a white list.

Section blacklist sets a black list. The node rejects connections from all addresses from a black list.

Section limit_groups sets limits on the maximum number of connections for each group (in percentage of the total maximum number of connections).