UDPXY手册

源码下载地址:http://www.udpxy.com/

 

udpxy的作用是将组播的数据流变成TCP协议的单播流,避免了在数据链路层广播,在无线网络中尤为需要。同时电视也不支持udp格式的视频流。

udpxy在官方的软件源中,直接安装即可

udpxy没有独立的配置文件,修改参数直接在启动脚本中完成

udpxy手册页 udpxy - UDP到HTTP多播流量中继守护程序。

概要

udpxy [-vTS] [-a <listenaddr>] [-m <mcast_ifc_addr>] [-c <clients>] [-l <logfile>] [-B <sizeK>] [-R <msgs>] [-H <sec>] [-n <nice_incr>] [-M <sec>] -p <port>

描述

udpxy是UDP到HTTP多播流量中继守护程序:它将UDP流量从给定的多播订阅转发到请求的HTTP客户端。

udpxy监听(在专用地址/端口上)客户端发出的HTTP请求。客户请求的结构应为:

http://{ address }:{ port }/{ cmd }/{ mgroup_address }[ SEP ]{ mgroup_port }
[SEP]
:|%|〜| + | - | ^

{cmd},在
UDP | RTP

其中地址和端口与udpxy 的侦听地址/端口组合匹配,mgroup_address:mgroup_port标识要预订的多播组/通道。

UDP
# udp命令将对已知类型的有效负载(例如MPEG-TS和MPEG-TS上的RTP)进行udpxy探测;

RTP
# rtp命令使udpxy假定RTP超过MPEG-TS有效载荷,从而跳过探测器。

udpxy将为每个新的中继请求启动一个单独的客户端进程(在活动客户端的指定限制内​​)。客户端进程将(从UDP套接字)接收的所有网络流量从指定的多播组中继/转发到请求的HTTP连接。

udpxy还支持一些管理请求:

状态

http:// address:port / status /发回带有守护程序状态和客户端统计信息的HTML页面。

重新开始

http:// address:port / restart /关闭所有活动连接并重启。

例子

http://192.168.0.12:5056/udp/224.0.2.26:24012

http://192.168.0.12:5056/rtp/224.0.2.26:24012

http://192.168.0.15:5056/rtp/224.0.2.26^24055

http://192.168.0.15:5056/status/

选项

udpxy接受以下选项:

-v
# 启用详细输出[default = disabled ]。

-S
# 启用客户端统计信息[default = disabled ]。

-T
# 不要作为守护进程运行[default = daemon if root ]。

-a <listenaddr>
# 要侦听的IPv4地址/接口[default = 0.0.0.0 ]。

-m <mcast_ifc_addr>
# (组播)源的IPv4地址/接口[默认= 0.0.0.0 ]。

-c <clients>
# 要接受的最大客户端数[default = 3,max = 5000 ]。

-l <logfile>
# 将输出记录到文件[default = stderr ]。

-B <sizeK>
# 入站(多播)数据的缓冲区大小(65536,32Kb,1Mb)[默认= 2048字节 ]。

-R <msgs>
# 要缓冲的最大消息数(-1 = 全部)[default = 1 ]。

-H <sec>
# 在缓冲区中保存数据的最长时间(以秒为单位)(- 1 = 无限制)[默认值= 1 ]。

-n <nice_incr>
# 好的值增量[default = 0 ]。

-M <sec>
# 每M秒更新一次多播订阅(如果为0则跳过)[default = 0 ]。

-p <port>
# 端口。

有效载荷类型和处理 udpxy 通过中继数据包中的MPEG-TS有效载荷识别MPEG-TS和RTP ; 如果udpxy遇到RTP有效载荷,它会自动将其“转换”为MPEG-TS(通过剥离RTP头),以便不识别RTP的媒体播放器仍然可以播放该流。

到目前为止,没有为其他有效负载类型执行转换。

录制Mpeg流量 udpxy包括将捕获的流量记录为原始MPEG-TS流到文件中的功能。此功能通过udpxrec启用:与udpxy链接在一起的捆绑应用程序(作为一个可执行文件)。

udpxrec通过符号链接(名为udpxrec)调用udpxy可执行文件(即不重命名 udpxy可执行文件)。

udpxrec创建封装MPEG-TS段的MPEG文件; 某些媒体播放器不会播放此类文件; 为了使它们可播放,必须将流转码为MPEG-PS; vlc’知道’如何进行这样的转码,这是一个命令行示例:

vlc input-ts.mpg --sout =“#std {access = file,mux = ps,dst = out-ps.mpg}”

由此产生的MPEG-PS文件可以由大多数媒体播放器播放。

环境

udpxy利用以下环境变量来补充其命令行选项; 变量被考虑用于大多数人不需要经常更改的选项(或者从命令行使用简单不方便)。

注意:如果存在与功能环境变量相交的命令行开关,则交换机始终具有更高的优先级。

UDPXY_RCV_TMOUT
# 入站数据流(多播)的超时(秒),默认= 5 ;

UDPXY_DHOLD_TMOUT
# 在发送/刷新到客户端之前保持缓冲数据的超时(秒),默认值= 1 ;

UDPXY_SREAD_TMOUT
# 从监听socked(处理HTTP请求)读取超时(秒),默认= 1 ;

UDPXY_SWRITE_TMOUT
# 写入侦听socked(处理HTTP请求)的超时(秒),默认值= 1 ;

UDPXY_SSEL_TMOUT
# 在服务器循环中选择(2)的超时(秒)(如果使用pselect(2)则未使用),默认值= 30 ;

UDPXY_LQ_BACKLOG
# 侦听器套接字的backlog大小,默认值= 16 ;

UDPXY_SRV_RLWMARK
# 接收(m-cast)套接字上的低watermaek,默认= 0(未设置);

UDPXY_SSOCKBUF_NOSYNC
# 不同步入站(UDP)套接字的缓冲区大小(由-B设置的值),默认= 1(同步);

UDPXY_DSOCKBUF_NOSYNC
# 不同步出站(TCP)套接字的缓冲区大小(由-B设置的值),默认= 1(同步);

UDPXY_TCP_NODELAY
# 在新接受的套接字上禁用Nagle算法(更快的频道切换),默认= 1 ;

UDPXY_HTTP200_FTR_FILE
# 将给定文本文件的内容追加到HTTP 200响应中,default = none ;

UDPXY_HTTP200_FTR_LN
# 将文本(行)附加到HTTP 200响应,默认= 无 ;

UDPXY_ALLOW_PAUSES
# 如果在写入(2)上被阻塞,则继续读取数据直到缓冲区(-B <sizeK>)已满,默认= 禁用 ;

UDPXY_PAUSE_MSEC
# 在写入时阻塞时仅允许N毫秒读取数据(2)。

UDPXY_CONTENT_TYPE
# 在HTTP响应中指定自定义Content-Type。

 

#
# Copyright 2008-2012 Pavel V. Cherenkov (pcherenkov@gmail.com)
#
#  This file is part of udpxy.
#
#  udpxy is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  udpxy is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with udpxy.  If not, see <http://www.gnu.org/licenses/>.
#

Summary
--------------

udpxy is a UDP-to-HTTP multicast traffic relay daemon:
it forwards UDP traffic from a given multicast subscription
to the requesting HTTP client.

udpxy is released under GPL v.3

Project status
--------------

udpxy has not been extended or supported for 4+ years, having been
replaced by Gigapxy - a superior enterprise-oriented product.
Please see more info at <http://gigapxy.com>, thank you.


Building and installing
--------------

Untar the *.tgz source distribution into a directory of your choice by
running
        tar -xzvf udpxy.X.Y-ZZ.tgz
    or
        gzip -dc udpxy.X.Y-ZZ.tgz | tar -xvf -

Make sure GNU make and gcc are available (gcc 3.x and up should work, lower
versions are not guaranteed to build the source correctly); for compilers
other than gcc alterations to Makefile might be needed.

Running 'make' without a target will build the 'release' version of
udpxy (no asserts, no debug symbols, verbose mode on).

Other make targets are:
    debug (asserts, debug symbols, verbose mode on);
    lean  (no asserts, no debug symbols, verbose mode off);
    rdebug (same as 'release' but with debug symbols);
    ldebug (same as 'lean' but with debug symbols);

Once the make has succeeded, the udpxy executable file could be
copied to a location of one's choice and run from there - no additional
installation steps are required.

udpxy can be started with a number of configuration parameters,
such as listening address/port, multicast interface name, etc.
A brief usage summary is provided when udpxy is invoked from command line
without parameters.

HTTP commands
--------------

udpxy responds to HTTP (GET) commands to receive data from
a dedicated multicast group and forward it to the initiating (HTTP)
connection.

The command to relay traffic is in the format as below:

http://address:port/cmd/mgroup_address[SEP]mgroup_port/

[SEP] ::= :|%|~|+|-|^
i.e:
    http://ip:port/cmd/mgroup_address:mgroup_port/
    http://ip:port/cmd/mgroup_address%mgroup_port/
    http://ip:port/cmd/mgroup_address~mgroup_port/
    ......
    http://ip:port/cmd/mgroup_address^mgroup_port/

are acceptable and should all work in the same manner.

cmd ::= udp | rtp

where ip and port match the listening address/port combination of udpxy,
and mgroup_address:mgroup_port identify the multicast group to subscribe to.

Using 'udp' command will instruct udpxy to probe for known types of payload
(such as MPEG-TS and RTP over MPEG-TS); using 'rtp' makes udpxy assume RTP
over MPEG-TS payload, thus skipping the probes.

udpxy will start a 'client' process for each new relay request as long as
their number would not exceed a pre-set maximum (see usage summary).

udpxy also supports a few additional HTTP requests, such as:

http://address:port/status/  - to display basic daemon's statistics
http://address:port/restart/ - to close all active connections and restart

Payload types and handling
--------------

udpxy recognizes MPEG-TS and RTP (over MPEG-TS) payloads within relayed packets;
if udpxy encounters RTP payload it automatically 'translates' it to MPEG-TS so that
media players not recognizing RTP on TCP could still play back the stream.

So far, no translation is performed for other payload types.

Recording MPEG traffic
--------------
udpxy (in builds >0.33) includes functionality to record captured traffic as
raw MPEG-TS stream into a file. This functionality is enabled through udpxrec:
a bundled-in application that is linked together with udpxy (as one executable).

udpxrec is invoked by a symbolic link (named udpxrec) to the udpxy executable
(NB: do not rename udpxy executable).

udpxrec creates MPEG files encapsulating MPEG-TS segments; most media players
will *NOT* play such files; to make them playable the stream must be transcoded
to MPEG-PS; vlc knows how to do such transcoding, here is a command-line example:

vlc input-ts.mpg --sout="#std{access=file,mux=ps,dst=out-ps.mpg}"

The resulting PS file can be played back by most media players.

Portability
--------------
udpxy was written to run on 'POSIX-compliant' systems;
so far all builds have been tested to build and run on Linux 2.4, 2.6, 3.x (IA32, ARM)
and *some* (but not all) on HP-UX 11.11 (PA-RISC 1.1, 2.0w).

Build 12 of version 1.0 (Chipmunk) was ported to compile under FreeBSD 7.1
using GNU make 3.8; later builds have been tested to compile under later
versions of FreeBSD (up to 9.0);

Certain builds have been ported to build under cygwin; cygwin is
*NOT* considered to be a fully supported platform yet there is an
ongoing effort to make udpxy run on it as well.

Environment variables
--------------
udpxy utilizes the following environment variables to compliment its
command-line options; the variables are considered for the options that
most people would not need to change too often (or simply inconvenient
to use from the command line).

NB: If there is a command-line switch that would intersect in functionality
with an environment variable, the switch *always* has the higher priority.

UDPXY_RCV_TMOUT         - timeout (sec) on the inbound data stream (multicast), default=5;
UDPXY_DHOLD_TMOUT       - timeout (sec) to hold buffered data before sending/flushing to client(s), default=1;

UDPXY_SREAD_TMOUT       - timeout (sec) to read from the listening socked (handling HTTP requests), default=1;
UDPXY_SWRITE_TMOUT      - timeout (sec) to write to the listening socked (handling HTTP requests), default=1;
UDPXY_SSEL_TMOUT        - timeout (sec) to select(2) in server loop (unused if pselect(2) is employed), default=30;
UDPXY_LQ_BACKLOG        - size of the listener socket's backlog, default=16;
UDPXY_SRV_RLWMARK       - low watermaek on the receiving (m-cast) socket, default=0 (not set);
UDPXY_SSOCKBUF_NOSYNC   - do not sync inbound (UDP) socket's buffer size (with value set by -B), default=1 (sync);
UDPXY_DSOCKBUF_NOSYNC   - do not sync outbound (TCP) socket's buffer size (with value set by -B), default=1 (sync);

UDPXY_TCP_NODELAY       - disable Nagle algorithm on the newly accepted socket (faster channel switching), default=1;

UDPXY_HTTP200_FTR_FILE - append contents of the given file to the HTTP 200 response, default=none;
UDPXY_HTTP200_FTR_LN   - append the text (line) to the  HTTP 200 response, default=none;

UDPXY_ALLOW_PAUSES     - if blocked on a write, keep reading data until the buffer (-B size) is full, default=disabled;
UDPXY_PAUSE_MSEC       - allow only N milliseconds of reading data when blocked on a write.
UDPXY_CONTENT_TYPE     - specify custom Content-Type in HTTP responses.

--EOF--
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值