Browse Source

udpspeeder: Add new package udpspeeder to implement Forward Error Correction (FEC) for UDP VPNs like OpenVPN

Maintainer: @codemarauder
Compile tested: Yes
Run tested: x86_64 PCEngines APU

Description:

A Tunnel which Improves your Network Quality on a High-latency Lossy Link by using Forward Error Correction,for All Traffics(TCP/UDP/ICMP)
It does it by sending redundant packets and re-arranging them to account for packet loss over the link. It uses Reed–Solomon code.

Signed-off-by: Nishant Sharma <codemarauder@gmail.com>
lilik-openwrt-22.03
Nishant Sharma 4 years ago
parent
commit
9db02bec15
3 changed files with 203 additions and 0 deletions
  1. +59
    -0
      net/udpspeeder/Makefile
  2. +30
    -0
      net/udpspeeder/files/udpspeeder-config
  3. +114
    -0
      net/udpspeeder/files/udpspeeder-init

+ 59
- 0
net/udpspeeder/Makefile View File

@ -0,0 +1,59 @@
#
# Copyright (c) 2017 Yu Wang <wangyucn@gmail.com>
# Copyright (c) 2020 Nishant Sharma <nishant@hopbox.in>
#
# This is free software, licensed under MIT
#
include $(TOPDIR)/rules.mk
PKG_NAME:=UDPspeeder
PKG_VERSION:=20200818.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/wangyu-/$(PKG_NAME)/tar.gz/$(PKG_VERSION)?
PKG_HASH:=54bc6dc1283630ed78c033ae26b0f6af24bb92da17784ec64ae56d6e5ca73dd6
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Nishant Sharma <nishant@hopbox.in>
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
define Package/UDPspeeder
SECTION:=net
CATEGORY:=Network
TITLE:=UDP Network Speed-Up Tool
URL:=https://github.com/wangyu-/UDPspeeder
DEPENDS:= +libstdcpp +librt
endef
define Package/UDPspeeder/description
A Tunnel which Improves your Network Quality on a High-latency Lossy Link by using Forward Error Correction,for All Traffics(TCP/UDP/ICMP)
endef
MAKE_FLAGS += cross
define Build/Prepare
$(PKG_UNPACK)
sed -i 's/cc_cross=.*/cc_cross=$(TARGET_CXX)/g' $(PKG_BUILD_DIR)/makefile
sed -i '/\gitversion/d' $(PKG_BUILD_DIR)/makefile
echo 'const char * const gitversion = "$(PKG_VERSION)";' > $(PKG_BUILD_DIR)/git_version.h
$(Build/Patch)
endef
define Package/UDPspeeder/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/speederv2_cross $(1)/usr/bin/udpspeeder
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/udpspeeder-config $(1)/etc/config/udpspeeder
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/udpspeeder-init $(1)/etc/init.d/udpspeeder
endef
$(eval $(call BuildPackage,UDPspeeder))

+ 30
- 0
net/udpspeeder/files/udpspeeder-config View File

@ -0,0 +1,30 @@
config udpspeeder 'tunnel1'
option enabled '1'
option server '1'
option mode '0'
option local '0.0.0.0:4095'
option remote '127.0.0.1:443'
option disable_obscure '1'
option fec '1:3,2:4,8:6,20:10'
option fix_latency '1'
config udpspeeder 'tunnel2'
option enabled '1'
option server '1'
option mode '0'
option mtu '1250'
option timeout '8'
option local '0.0.0.0:4096'
option remote '127.0.0.1:444'
option report '10'
option disable_obscure '1'
option fec '1:3,2:4,8:6,20:10'
option interval '0'
option disable_fec '0'
option sock_buf '1024'
option log_level '4'
option decode_buf '2000'
option fix_latency '1'
option queue_len '200'

+ 114
- 0
net/udpspeeder/files/udpspeeder-init View File

@ -0,0 +1,114 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2015 OpenWrt.org
# Copyright (C) 2020 Nishant Sharma <nishant@hopbox.in>
START=89
STOP=11
USE_PROCD=1
PROG=/usr/bin/udpspeeder
validate_udpspeeder_section() {
uci_validate_section udpspeeder udpspeeder "${1}" \
'enabled:bool:0' \
'server:bool:0' \
'mode:integer:0' \
'mtu:integer:1250' \
'timeout:integer:8' \
'local:string' \
'remote:string' \
'report:integer:10' \
'disable_obscure:bool:0' \
'interval:integer:0' \
'fec:string:20:10' \
'disable_fec:bool:0' \
'sock_buf:integer:1024' \
'log_level:integer:4' \
'decode_buf:integer:2000' \
'fix_latency:bool:0' \
'queue_len:integer:200'
}
start_instance() {
local section="$1"
local server mode mtu timeout local remote report disable_obscure fifo interval fec disable_fec sock_buf queue_len \
decode_buf sock_buf log_level enabled
fifo="/tmp/udpspeeder-${section}.fifo"
validate_udpspeeder_section $section || {
echo "validation failed"
return 1
}
if [ "${enabled}" -ne 1 ]
then
return 1
fi
procd_open_instance
procd_set_param respawn
procd_set_param stderr 1
procd_set_param stdout 1
procd_set_param command "${PROG}"
if [ "${server}" -eq 1 ]
then
procd_append_param command -s
else
procd_append_param command -c
fi
if [ "${disable_fec}" -eq 1 ]
then
procd_append_param command --disable-fec
else
procd_append_param command --fec "${fec}"
fi
if [ "${fix_latency}" -eq 1 ] && [ "${mode}" -eq 0 ]
then
procd_append_param command --fix-latency
fi
if [ "${disable_obscure}" -eq 1 ]
then
procd_append_param command --disable-obscure
fi
procd_append_param command -l "${local}"
procd_append_param command -r "${remote}"
procd_append_param command --mode "${mode}"
procd_append_param command --report "${report}"
procd_append_param command --interval "${interval}"
procd_append_param command --mtu "${mtu}"
procd_append_param command --sock-buf "${sock_buf}"
procd_append_param command --decode-buf "${decode_buf}"
procd_append_param command --queue-len "${queue_len}"
procd_append_param command --log-level "${log_level}"
procd_append_param command --fifo "${fifo}"
# procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
procd_close_instance
}
start_service() {
config_load 'udpspeeder'
config_foreach start_instance 'udpspeeder'
}
stop_service()
{
service_stop ${PROG}
}
service_triggers()
{
procd_add_reload_trigger "udpspeeder"
procd_add_validation validate_udpspeeder_section
}

Loading…
Cancel
Save