1
0
mirror of https://github.com/QSCTech/zjunet.git synced 2026-01-22 11:44:48 +08:00
zjunet/lib/zjunet.sh

75 lines
2.0 KiB
Bash
Raw Normal View History

2014-09-18 22:45:38 +08:00
#!/bin/sh
2014-09-20 15:39:28 +08:00
# zjunet.sh -- router for zjunet
2014-09-18 22:45:38 +08:00
#
2014-09-20 15:39:28 +08:00
# Copyright (C) 2014 Zeno Zeng <zenoofzeng@gmail.com>
2014-09-18 22:45:38 +08:00
#
2014-09-20 15:39:28 +08:00
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
2014-09-18 22:45:38 +08:00
BASEDIR=$(dirname $0)
case "$1" in
2014-09-28 21:39:15 +08:00
route)
"${BASEDIR}/sudo.sh" "${BASEDIR}/route.sh"
;;
2014-09-19 23:06:14 +08:00
user)
2014-09-20 17:19:56 +08:00
"${BASEDIR}/user.sh" $2
2014-09-18 22:45:38 +08:00
;;
2014-09-28 21:39:15 +08:00
all)
"${BASEDIR}/wlan.sh" $2
2014-10-13 21:18:58 +08:00
"${BASEDIR}/vpn.sh" $2
2014-09-28 21:39:15 +08:00
;;
2014-09-18 22:45:38 +08:00
wlan)
2014-09-20 18:13:40 +08:00
"${BASEDIR}/wlan.sh" $2
2014-09-18 22:45:38 +08:00
;;
vpn)
2014-10-13 21:18:58 +08:00
"${BASEDIR}/vpn.sh" $2
2014-09-18 22:45:38 +08:00
;;
dns)
2014-09-20 17:19:56 +08:00
"${BASEDIR}/dns.sh"
2014-09-18 22:45:38 +08:00
;;
2014-09-30 21:26:38 +08:00
--version)
2014-10-14 17:27:22 +08:00
echo "zjunet version: zjunet-0.1.3"
2014-09-30 21:26:38 +08:00
;;
2014-09-20 20:20:11 +08:00
*)
cat <<EOF
zjunet: CLI Tool (VPN/WLAN/DNS) for Zjuer
Usage: zjunet [ACTION]
Actions:
2014-09-26 14:14:53 +08:00
user
2014-09-26 15:16:05 +08:00
add Add a user
edit Edit a (enabled) user
delete Delete a (enabled) user
2014-09-26 14:14:53 +08:00
list List all enabled users
enable Enable a user
disable Disable a user
2014-09-28 21:39:15 +08:00
all
connect(-c) Connect VPN & ZJUWLAN, and combine them using nexthop
disconnect(-d) Disconnect VPN & ZJUWLAN
2014-09-26 14:14:53 +08:00
vpn
connect(-c) Connect VPN and set up ip route
disconnect(-d) Disconnect VPN and reset ip route
wlan
2014-09-28 21:39:15 +08:00
connect(-c) Login ZJUWLAN via curl
disconnect(-d) Logout ZJUWLAN via curl
route Set up ip route
2014-09-26 14:14:53 +08:00
dns Test and set up DNS Server
2014-10-14 17:27:22 +08:00
--version Show Version
2014-09-20 20:20:11 +08:00
EOF
;;
2014-09-18 22:45:38 +08:00
esac