mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-03 23:03:56 +08:00
This commit is contained in:
1 parent
c7bafc635d
commit
c71da84035
264 files changed
+8169
-3944
No files matched your search
+1
-1
@@ -14,7 +14,7 @@ PKG_SOURCE_URL:=https://github.com/Ysurac/dsvpn.git
|
||||
PKG_SOURCE_VERSION:=aae011339bba733d3fa4ffe8b5dd95dab2efb4ab
|
||||
PKG_NAME:=dsvpn
|
||||
PKG_VERSION:=0.1.5
|
||||
PKG_RELEASE:=4
|
||||
PKG_RELEASE:=5
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
|
||||
+13
-7
@@ -50,7 +50,8 @@ version_over_5_4() {
|
||||
}
|
||||
|
||||
start_instance() {
|
||||
local enable key host port dev
|
||||
local enable key host port dev mode localip remoteip externalip gateway
|
||||
local prog="$PROG"
|
||||
local key_dir="/var/run/${PROG_NAME}"
|
||||
local key_file="${key_dir}/${1}.key"
|
||||
|
||||
@@ -93,20 +94,25 @@ start_instance() {
|
||||
# socket at all ("Couldn't create connection: Protocol not available")
|
||||
# and procd just respawns it forever. Run it unwrapped instead.
|
||||
if version_over_5_4 && ! _omr_mptcp_globally_disabled; then
|
||||
PROG="mptcpize run ${PROG}"
|
||||
prog="mptcpize run ${PROG}"
|
||||
fi
|
||||
|
||||
# The arguments are positional: an empty one would shift the next ones
|
||||
# into its place, dsvpn takes "auto" for each instead. The gateway is the
|
||||
# route's "via": an on-link route has none, and a name can't be routed
|
||||
gateway="$(ip route get "$host" 2>/dev/null | awk '{ for (i = 1; i < NF; i++) if ($i == "via") { print $(i + 1); exit } }')"
|
||||
|
||||
procd_open_instance
|
||||
|
||||
procd_set_param command ${PROG} ${mode} \
|
||||
procd_set_param command ${prog} ${mode} \
|
||||
"$key_file" \
|
||||
$host \
|
||||
$port \
|
||||
$dev \
|
||||
${localip:+$localip} \
|
||||
${remoteip:+$remoteip}
|
||||
[ "$mode" = "client" ] && procd_append_param command $(ip r get $host | awk '{print $3}' | tr -d "\n")
|
||||
[ "$mode" = "server" ] && procd_append_param command externalip
|
||||
${localip:-auto} \
|
||||
${remoteip:-auto}
|
||||
[ "$mode" = "client" ] && procd_append_param command ${gateway:-auto}
|
||||
[ "$mode" = "server" ] && procd_append_param command ${externalip:-auto}
|
||||
|
||||
|
||||
procd_set_param respawn 0 30 5
|
||||
|
||||
Reference in new issue
Block a user