mirror of
https://github.com/kenzok8/small-package.git
synced 2026-01-19 21:58:28 +08:00
27 lines
558 B
Bash
Executable File
27 lines
558 B
Bash
Executable File
#!/bin/sh
|
|
|
|
. /usr/share/libubox/jshn.sh
|
|
|
|
(
|
|
json_init
|
|
json_add_string ip "$1"
|
|
json_add_int port "$2"
|
|
json_add_int inner_port "$4"
|
|
json_add_string protocol "$5"
|
|
json_add_string name "$NAT_NAME"
|
|
json_dump > /var/run/natmap/$PPID.json
|
|
)
|
|
|
|
[ -n "${NOTIFY_SCRIPT}" ] && {
|
|
export -n NOTIFY_SCRIPT
|
|
source "${NOTIFY_SCRIPT}" "$@"
|
|
}
|
|
|
|
if [ ! -z $INTERNAL_DEFINE_SCRIPT ]; then
|
|
echo "$NAT_NAME Excute internal define script: $INTERNAL_DEFINE_SCRIPT"
|
|
$INTERNAL_DEFINE_SCRIPT "$@"
|
|
fi
|
|
|
|
source /usr/lib/natmap/forward.sh "$@"
|
|
|
|
source /usr/lib/natmap/notify.sh "$@" |