diff --git a/net/udpspeeder-simd/Makefile b/net/udpspeeder-simd/Makefile new file mode 100644 index 00000000000000..d0765a2cd9e6b1 --- /dev/null +++ b/net/udpspeeder-simd/Makefile @@ -0,0 +1,59 @@ +# +# Copyright (c) 2026 David Connolly +# +# This is free software, licensed under MIT +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=udpspeeder-simd +PKG_VERSION:=1.0.0 +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/connollydavid/UDPspeeder-simd.git +PKG_SOURCE_VERSION:=v$(PKG_VERSION) +PKG_MIRROR_HASH:=9ef24879157c493f610ab945c9bbec6c4c95ace929618faf21ccee8a0852e6e4 + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE.md +PKG_MAINTAINER:=David Connolly + +PKG_BUILD_PARALLEL:=1 +PKG_BUILD_FLAGS:=no-mips16 + +include $(INCLUDE_DIR)/package.mk + +define Package/udpspeeder-simd + SECTION:=net + CATEGORY:=Network + TITLE:=SIMD-accelerated UDP FEC tunnel + URL:=https://github.com/connollydavid/UDPspeeder-simd + DEPENDS:=+libstdcpp +librt +libatomic +endef + +define Package/udpspeeder-simd/description + A Forward Error Correction UDP tunnel that improves a high-latency, lossy link + with Reed-Solomon redundancy. A SIMD-accelerated fork of UDPspeeder; on targets + with no SIMD path (for example MIPS) it uses a portable word-width path. Installs + alongside the udpspeeder package with distinct paths, so the two do not conflict. +endef + +MAKE_FLAGS += cross gitversion="$(PKG_VERSION)" + +define Package/udpspeeder-simd/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/speederv2_cross $(1)/usr/bin/udpspeeder-simd + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/udpspeeder-simd.config $(1)/etc/config/udpspeeder-simd + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/udpspeeder-simd.init $(1)/etc/init.d/udpspeeder-simd +endef + +define Package/udpspeeder-simd/conffiles +/etc/config/udpspeeder-simd +endef + +$(eval $(call BuildPackage,udpspeeder-simd)) diff --git a/net/udpspeeder-simd/files/udpspeeder-simd.config b/net/udpspeeder-simd/files/udpspeeder-simd.config new file mode 100644 index 00000000000000..31e7e6b6e26806 --- /dev/null +++ b/net/udpspeeder-simd/files/udpspeeder-simd.config @@ -0,0 +1,19 @@ + +config udpspeeder-simd 'tunnel1' + option enabled '0' + 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:443' + option report '10' + option disable_obscure '1' + option interval '0' + option fec '2:4' + option disable_fec '0' + option sock_buf '1024' + option log_level '4' + option decode_buf '2000' + option fix_latency '1' + option queue_len '200' diff --git a/net/udpspeeder-simd/files/udpspeeder-simd.init b/net/udpspeeder-simd/files/udpspeeder-simd.init new file mode 100644 index 00000000000000..54e251e77a5310 --- /dev/null +++ b/net/udpspeeder-simd/files/udpspeeder-simd.init @@ -0,0 +1,116 @@ +#!/bin/sh /etc/rc.common +# Copyright (c) 2026 David Connolly + +START=89 +STOP=11 + +USE_PROCD=1 +PROG=/usr/bin/udpspeeder-simd + +validate_udpspeeder_simd_section() { + uci_validate_section udpspeeder-simd udpspeeder-simd "${1}" \ + 'enabled:bool:0' \ + 'server:bool:0' \ + 'mode:integer:0' \ + 'mtu:integer:1250' \ + 'timeout:integer:8' \ + 'local:string' \ + 'remote:string' \ + 'key: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 key report disable_obscure fifo interval \ + fec disable_fec sock_buf queue_len decode_buf log_level fix_latency enabled + + fifo="/tmp/udpspeeder-simd-${section}.fifo" + + validate_udpspeeder_simd_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 + + [ -z "${key}" ] || procd_append_param command --key "${key}" + + 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_append_param command --disable-color + + procd_close_instance +} + +start_service() { + + config_load 'udpspeeder-simd' + config_foreach start_instance 'udpspeeder-simd' + +} + +stop_service() +{ + service_stop ${PROG} +} + +service_triggers() +{ + procd_add_reload_trigger "udpspeeder-simd" + procd_add_validation validate_udpspeeder_simd_section +}