4

编译UDPXY新版本

 2 years ago
source link: https://3mile.github.io/archives/2019/1106111732/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

编译UDPXY新版本

2019-11-06

发布在 Openwrt

A beautiful sunrise

udpxy本身就在Openwrt的官方package list当中,只是其版本才是2016年1.0-23.10版本,如果你直接在openwrt当中安装udpxy那么版本会比较老,最新版本的udpxy已经更新到1.0-23.12,其中有不少的特性更新和加强,所以手动编译udpxy相比udp2raw会比较简单,因为官方版本的Openwrt package list已经提供了官方的Makefile,直接修改其中对应的github repo的版本号和commit id即可实现最新版本的udpxy编译。

1、编译环境准备

ubuntu 18.04 lts

2、udpxy源码准备

udpxy本身就在Openwrt的官方package list中,所以定位到编译环境当中的opx64/package/,任意名称创建一个文件夹,这里以openwrt-udpxy为例,然后下载官方package list当中的udpxy的Makefile相关文件:

https://github.com/openwrt/packages/tree/master/net/udpxy

一个文件Makefile,一个files文件夹,全部放置于openwrt-udpxy文件夹当中即可。

然后修改Makefile当中对应的git repo信息,udpxy的github源在‘https://github.com/pcherenkov/udpxy.git’

我们打开后可以发现最后的commit是1.0-24.0,‘21d9189789da46d66c30f6b30129d849a13e94f9’

PKG_SOURCE_VERSION行 PKG_SOURCE_VERSION:=21d9189789da46d66c30f6b30129d849a13e94f9

PKG_VERSION行 PKG_VERSION:=2019-08-023-$(PKG_SOURCE_VERSION)

其中PKG_SOURCE_VERSION行是对应git repo的commit id,使用最新的id即代表使用最新的源代码版本,同时修改PKG_VERSION为对应的版本号,以便识别。

3、开始编译 定位到Openwrt的根目录,本例当中为opx64,开始编译

make package/openwrt-udpxy/compile V=s

不出意外编译完成,到目录opx64/bin/packages/x86_64/base/找到对应的udpxy的ipk到实际的Openwrt当中安装即可 如果出现错误,同样参考

《udp2raw解决运营商封锁大量UDP流量问题》当中相关错误的部分即可。

直接在使用环境当中输入udpxy即可看到官方帮助,摘录如下

udpxy 1.0-23.12 (prod) standard [Linux 4.14.105 x86_64]
usage: udpxy [-vTS] [-a listenaddr] -p port [-m mcast_ifc_addr] [-c clients] [-l logfile] [-B sizeK] [-n nice_incr]
    -v : enable verbose output [default = disabled]
    -S : enable client statistics [default = disabled]
    -T : do NOT run as a daemon [default = daemon if root]
    -a : (IPv4) address/interface to listen on [default = 0.0.0.0]
    -p : port to listen on
    -m : (IPv4) address/interface of (multicast) source [default = 0.0.0.0]
    -c : max clients to serve [default = 3, max = 5000]
    -l : log output to file [default = stderr]
    -B : buffer size (65536, 32Kb, 1Mb) for inbound (multicast) data [default = 2048 bytes]
    -R : maximum messages to store in buffer (-1 = all) [default = 1]
    -H : maximum time (sec) to hold data in buffer (-1 = unlimited) [default = 1]
    -n : nice value increment [default = 0]
    -M : periodically renew multicast subscription (skip if 0 sec) [default = 0 sec]
Examples:
  udpxy -p 4022 
    listen for HTTP requests on port 4022, all network interfaces
  udpxy -a lan0 -p 4022 -m lan1
    listen for HTTP requests on interface lan0, port 4022;
    subscribe to multicast groups on interface lan1

作者实际使用情况下,是如下的参数

/usr/bin/udpxy -T -S -a 192.168.1.1 -p 4022 -m pppoe-iptv -c 5 -l /var/log/udpxy -B 2097152 -R 10 -M 300

-T -S参数即字面意思,实际正常使用的时候都需要 -a 192.168.1.1 -p 4022:即udpxy监听地址和端口 -m pppoe-iptv:即接受的数据端口,实际上是iptv拨号的端口,>作者的环境是在Openwrt当中做iptv的拨号 -c:即允许多少个客户端连接到udpxy -l:即log日志地址,方便debug -B:即缓冲区大小,设置最大2097152 -R:即向组播组请求10个消息,并储存起来,在iptv当中即代表一次缓冲10s的数据 -M:每5分钟重新加入一次组播组,以免网络有些问题的时候丢失组播连接。

对应openwrt当中的配置文件如下,/etc/config/udpxy

config udpxy
        option respawn '0'
        option verbose '0'
        option status '1'
        option bind '192.168.1.1'
        option port '4022'
        option source 'pppoe-iptv'
        option max_clients '5'
        option log_file '/var/log/udpxy'
        option buffer_size '2097152'
        option buffer_messages '10'
        option mcsub_renew '300'
        option disabled '0'

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK