aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorRichard Yu <yurichard3839@gmail.com>2022-12-21 17:50:18 +0800
committerRichard Yu <yurichard3839@gmail.com>2022-12-21 17:50:18 +0800
commitcd51b58efdfa689f282e808c14a6f8b054eedb57 (patch)
treee7351332885991622cf49419c9ffcae103d35df8 /net
parent735cba83ce3851e0a6fdf279a51683ed9bd00481 (diff)
natmap: add forward_port option
The bind port (-b) can be used with forward port (-p), so expose this option in config file. Signed-off-by: Richard Yu <yurichard3839@gmail.com>
Diffstat (limited to 'net')
-rw-r--r--net/natmap/Makefile2
-rw-r--r--net/natmap/files/natmap.config1
-rw-r--r--net/natmap/files/natmap.init14
3 files changed, 8 insertions, 9 deletions
diff --git a/net/natmap/Makefile b/net/natmap/Makefile
index 7c09f1716..3c2991df8 100644
--- a/net/natmap/Makefile
+++ b/net/natmap/Makefile
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=natmap
PKG_VERSION:=20221203
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/heiher/natmap/releases/download/$(PKG_VERSION)
diff --git a/net/natmap/files/natmap.config b/net/natmap/files/natmap.config
index 71931f6c5..01328c1bb 100644
--- a/net/natmap/files/natmap.config
+++ b/net/natmap/files/natmap.config
@@ -8,5 +8,6 @@ config natmap
option http_server 'example.com'
option port '8080'
option forward_target ''
+ option forward_port ''
option notify_script ''
diff --git a/net/natmap/files/natmap.init b/net/natmap/files/natmap.init
index a9ff90539..3688880b3 100644
--- a/net/natmap/files/natmap.init
+++ b/net/natmap/files/natmap.init
@@ -26,6 +26,7 @@ validate_section_natmap() {
'http_server:host' \
'port:port' \
'forward_target:host' \
+ 'forward_port:port' \
'notify_script:file'
}
@@ -39,15 +40,16 @@ natmap_instance() {
procd_open_instance "$1"
procd_set_param command "$PROG" \
- ${interval:+-k $interval} \
+ ${interval:+-k "$interval"} \
${stun_server:+-s "$stun_server"} \
- ${http_server:+-h "$http_server"}
+ ${http_server:+-h "$http_server"} \
+ ${port:+-b "$port"} \
[ "${family}" = ipv4 ] && procd_append_param command -4
[ "${family}" = ipv6 ] && procd_append_param command -6
[ "${udp_mode}" = 1 ] && procd_append_param command -u
- [ -n "$interface" ] && {
+ [ -n "${interface}" ] && {
local ifname
network_get_device ifname "$interface" || ifname="$interface"
@@ -55,11 +57,7 @@ natmap_instance() {
procd_append_param netdev "$ifname"
}
- if [ -n "$forward_target" ]; then
- procd_append_param command -t "$forward_target" -p $port
- else
- procd_append_param command -b $port
- fi
+ [ -n "${forward_target}" ] && procd_append_param command -t "$forward_target" -p "$forward_port"
[ -n "${notify_script}" ] && procd_set_param env "NOTIFY_SCRIPT=${notify_script}"
procd_append_param command -e /usr/lib/natmap/update.sh