mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Add glorytun packages and LuCI app
This commit is contained in:
parent
fc579c849e
commit
1b9ebf5ac2
15 changed files with 727 additions and 0 deletions
45
luci-app-glorytun/root/etc/config/glorytun_recipes
Normal file
45
luci-app-glorytun/root/etc/config/glorytun_recipes
Normal file
|
@ -0,0 +1,45 @@
|
|||
config glorytun_recipe servertcp
|
||||
option _description "Simple TCP server configuration"
|
||||
option _role "server"
|
||||
option port "65001"
|
||||
option dev "tun0"
|
||||
option key "secretkey"
|
||||
option listener "1"
|
||||
option localip "192.168.99.1"
|
||||
option remoteip "192.168.99.2"
|
||||
option proto "tcp"
|
||||
|
||||
config glorytun_recipe clienttcp
|
||||
option _description "Simple TCP client configuration"
|
||||
option _role "client"
|
||||
option port "65001"
|
||||
option dev "tun0"
|
||||
option host "vpnserver.example.org"
|
||||
option key "secretkey"
|
||||
option localip "192.168.99.2"
|
||||
option remoteip "192.168.99.1"
|
||||
option proto "tcp"
|
||||
|
||||
config glorytun_recipe serverudp
|
||||
option _description "Simple UDP server configuration"
|
||||
option _role "server"
|
||||
option dev "tun0"
|
||||
option bindport "65003"
|
||||
option bindt "192.168.99.1"
|
||||
option key "secretkey"
|
||||
option localip "192.168.99.1"
|
||||
option remoteip "192.168.99.2"
|
||||
option proto "udp"
|
||||
option mtuauto "1"
|
||||
|
||||
config glorytun_recipe clientudp
|
||||
option _description "Simple UDP client configuration"
|
||||
option _role "client"
|
||||
option port "65003"
|
||||
option dev "tun0"
|
||||
option host "vpnserver.example.org"
|
||||
option key "secretkey"
|
||||
option localip "192.168.99.2"
|
||||
option remoteip "192.168.99.1"
|
||||
option proto "udp"
|
||||
option mtuauto "1"
|
27
luci-app-glorytun/root/etc/hotplug.d/iface/30-glorytun
Normal file
27
luci-app-glorytun/root/etc/hotplug.d/iface/30-glorytun
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Load the glorytun config
|
||||
#
|
||||
# Author: Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
|
||||
# Released under GPL 3 or later
|
||||
|
||||
[ "$ACTION" = ifup -o "$ACTION" = ifupdate ] || exit 0
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/network.sh
|
||||
|
||||
set_default() {
|
||||
local localip
|
||||
local remoteip
|
||||
local config="$1"
|
||||
local iface
|
||||
config_get iface "$config" dev
|
||||
[ "$iface" = "$DEVICE" ] && {
|
||||
config_get localip "$config" localip
|
||||
config_get remoteip "$config" remoteip
|
||||
[ "$remoteip" != "" ] && [ "$localip" != "" ] && ip addr add $localip peer $remoteip dev $DEVICE
|
||||
}
|
||||
}
|
||||
|
||||
config_load glorytun
|
||||
config_foreach set_default glorytun
|
31
luci-app-glorytun/root/etc/uci-defaults/40_luci-glorytun
Normal file
31
luci-app-glorytun/root/etc/uci-defaults/40_luci-glorytun
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@glorytun[-1]
|
||||
add ucitrack glorytun
|
||||
set ucitrack.@glorytun[-1].init=glorytun
|
||||
delete ucitrack.@glorytun-udp[-1]
|
||||
add ucitrack glorytun-udp
|
||||
set ucitrack.@glorytun-udp[-1].init=glorytun-udp
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete network.glorytun=interface
|
||||
set network.glorytun=interface
|
||||
set network.glorytun.ifname=tun0
|
||||
set network.glorytun.proto=none
|
||||
set network.glorytun.ip4table=vpn
|
||||
set network.glorytun.multipath=off
|
||||
set network.glorytun.defaultroute=0
|
||||
commit network
|
||||
EOF
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
add firewall zone
|
||||
set firewall.@zone[-1].name=vpn
|
||||
set firewall.@zone[-1].network='vpn'
|
||||
commit firewall
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue