Browse Source

vpnbypass: README update, code cleanup

Signed-off-by: Stan Grishin <stangri@melmac.net>

update

Signed-off-by: Stan Grishin <stangri@melmac.net>
lilik-openwrt-22.03
Stan Grishin 4 years ago
committed by Paul Spooren
parent
commit
0daa9fb1dd
4 changed files with 31 additions and 14 deletions
  1. +1
    -2
      net/vpnbypass/Makefile
  2. +7
    -2
      net/vpnbypass/files/README.md
  3. +20
    -10
      net/vpnbypass/files/vpnbypass.init
  4. +3
    -0
      net/vpnbypass/test.sh

+ 1
- 2
net/vpnbypass/Makefile View File

@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=vpnbypass
PKG_VERSION:=1.3.1
PKG_RELEASE:=7
PKG_RELEASE:=9
PKG_LICENSE:=GPL-3.0-or-later
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.net>
@ -52,7 +52,6 @@ define Package/vpnbypass/install
$(INSTALL_DATA) ./files/vpnbypass.hotplug $(1)/etc/hotplug.d/firewall/94-vpnbypass
endef
define Package/vpnbypass/postinst
#!/bin/sh
# check if we are on real system


+ 7
- 2
net/vpnbypass/files/README.md View File

@ -1,5 +1,8 @@
<!-- markdownlint-disable MD013 -->
# VPN Bypass
[![HitCount](http://hits.dwyl.com/stangri/openwrt/vpnbypass.svg)](http://hits.dwyl.com/stangri/openwrt/vpnbypass)
A simple [procd](https://openwrt.org/docs/techref/procd)-based ```vpnbypass``` service for OpenWrt/LEDE Project. This is useful if your router accesses Internet through a VPN client/tunnel, but you want specific traffic (ports, IP ranges, domains or local IP ranges) to be routed outside of this tunnel.
## Features
@ -14,7 +17,7 @@ A simple [procd](https://openwrt.org/docs/techref/procd)-based ```vpnbypass``` s
## Screenshot (luci-app-vpnbypass)
![screenshot](https://raw.githubusercontent.com/stangri/openwrt_packages/master/screenshots/vpnbypass/screenshot02.png "screenshot")
![screenshot](https://cdn.jsdelivr.net/gh/stangri/openwrt_packages/screenshots/vpnbypass/screenshot02.png "screenshot")
## Requirements
@ -57,7 +60,9 @@ opkg update
opkg install vpnbypass luci-app-vpnbypass
```
If these packages are not found in the official feed/repo for your version of OpenWrt/LEDE Project, you will need to [add a custom repo to your router](https://github.com/stangri/openwrt_packages/blob/master/README.md#on-your-router) first.
If these packages are not found in the official feed/repo for your version of OpenWrt/LEDE Project, you will need to add a custom repo to your router following instructions on [GitHub](https://github.com/stangri/openwrt_packages/blob/master/README.md#on-your-router)/[jsDelivr](https://cdn.jsdelivr.net/gh/stangri/openwrt_packages/README.md#on-your-router) first.
These packages have been designed to be backwards compatible with OpenWrt 19.07, OpenWrt 18.06, LEDE Project 17.01 and OpenWrt 15.05. However, on systems older than OpenWrt 18.06.6 and/or a system which has deviated too far (or haven't been updated to keep in-sync) with official OpenWrt release you may get a message about missing ```luci-compat``` dependency, which (and only which) you can safely ignore and force-install the luci app using ```opkg install --force-depends``` command instead of ```opkg install```.
## Default Settings


+ 20
- 10
net/vpnbypass/files/vpnbypass.init View File

@ -3,17 +3,27 @@
# shellcheck disable=SC2039,SC1091,SC2086
PKG_VERSION='dev-test'
export START=94
export USE_PROCD=1
# shellcheck disable=SC2034
START=94
# shellcheck disable=SC2034
USE_PROCD=1
readonly _OK_='\033[0;32m\xe2\x9c\x93\033[0m'
readonly _FAIL_='\033[0;31m\xe2\x9c\x97\033[0m'
readonly __OK__='\033[0;32m[\xe2\x9c\x93]\033[0m'
readonly __FAIL__='\033[0;31m[\xe2\x9c\x97]\033[0m'
readonly __PASS__='\033[0;33m[-]\033[0m'
readonly _ERROR_='\033[0;31mERROR\033[0m'
# shellcheck disable=SC2034
EXTRA_COMMANDS='version'
version() { echo "$PKG_VERSION"; }
readonly __ERROR__='\033[0;31mERROR\033[0m'
# shellcheck disable=SC2034
serviceEnabled=0
verbosity=2
TID='200'
IPSET='vpnbypass'
FW_MARK='0x010000'
FW_MASK='0xff0000'
wan_if4=''
wan_gw=''
export serviceEnabled verbosity=2 TID='200' IPSET='vpnbypass' FW_MARK='0x010000' FW_MASK='0xff0000' wan_if4 wan_gw
readonly packageName='vpnbypass'
readonly serviceName="$packageName $PKG_VERSION"
readonly sharedMemoryOutput="/dev/shm/$packageName-output"
@ -122,6 +132,6 @@ service_triggers() {
procd_add_reload_trigger 'firewall' 'openvpn' 'vpnbypass'
procd_open_trigger
for n in $ifaces; do procd_add_reload_interface_trigger "$n"; procd_add_interface_trigger "interface.*" "$n" /etc/init.d/vpnbypass reload; done;
output "$serviceName monitoring interfaces: $ifaces $_OK_\\n"
output "$serviceName monitoring interfaces: $ifaces\\n"
procd_close_trigger
}

+ 3
- 0
net/vpnbypass/test.sh View File

@ -0,0 +1,3 @@
#!/bin/sh
/etc/init.d/"$1" version 2>&1 | grep "$2"

Loading…
Cancel
Save