Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifyed some code to match the v2ray5.1 standard #462

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,14 @@ opkg upgrade luci-i18n-v2ray-zh-cn
### Manual install

1. Download ipk files from [release](https://github.com/kuoruan/luci-app-v2ray/releases) page
```
wget https://github.com/kuoruan/luci-app-v2ray/releases/download/v2.0.0-1/luci-app-v2ray_2.0.0-1_all.ipk
```

2. Upload files to your router
```
scp luci-app-v2ray_2.0.0-1_all.ipk root@192.168.1.1:/root
```

3. Install package with opkg:

Expand All @@ -68,20 +74,27 @@ Dependencies:

For translations, please install ```luci-i18n-v2ray-*```.

> You may need to remove ```dnsmasq``` before installing this package.
> You may need to remove ```dnsmasq``` before installing this package. (`opkg remove dnsmasq && opkg install dnsmasq-full`)

## Configure

1. Download V2Ray file from V2Ray release [link](https://github.com/v2ray/v2ray-core/releases) or V2Ray ipk release [link](https://github.com/kuoruan/openwrt-v2ray/releases).
1. Download V2Ray5.0 file from V2Ray release [link](https://github.com/v2fly/v2ray-core/releases/tag/v5.1.0) or .ipk file form [here](http://openwrt.kuoruan.net/packages/releases/).

2. Upload V2Ray file to your router, or install the ipk file.
2. Upload those files to your router, and install them.

3. Config V2Ray file path in LuCI page.
3. Config V2Ray file path in LuCI page (http://192.168.1.1/cgi-bin/luci/admin/services/v2ray).

4. Add your inbound and outbound rules.
4. Add your inbound and outbound rules (refer the v2ray docs for more information: https://www.v2ray.com/en/configuration/routing.html#routing).

5. Enable the service via LuCI.

> More info about how to manually install opkg file: https://yingshaoxo.blogspot.com/2022/11/how-to-install-opkg-package-manually.html

> More info about how to do those operations in the shell (or terminal): https://yingshaoxo.blogspot.com/2022/11/master-linux-learn-more-commands-1.html

> More info about how to set transparent proxy with v2ray to open a VPN Wifi:
https://yingshaoxo.blogspot.com/2022/11/how-to-use-openwrtrouter-to-make-vpn.html

## Build

Package files is in branch [luci2](https://github.com/kuoruan/luci-app-v2ray/tree/luci2)
Expand Down
3 changes: 2 additions & 1 deletion public/root/etc/init.d/v2ray
Original file line number Diff line number Diff line change
Expand Up @@ -2094,7 +2094,7 @@ start_instance() {
return 1
fi

if ! ( eval "$v2ray_file --test --config=\"$config_file\" >/dev/null 2>&1" ) ; then
if ! ( eval "$v2ray_file test --config=\"$config_file\" >/dev/null 2>&1" ) ; then
_err "Validate config file failed: $config_file"
return 1
fi
Expand Down Expand Up @@ -2181,6 +2181,7 @@ start_instance() {

procd_open_instance "$NAME.$section"
procd_set_param command "$v2ray_file"
procd_append_param command "run"
procd_append_param command "--config=$temp_config"
procd_set_param respawn

Expand Down
4 changes: 3 additions & 1 deletion public/root/usr/libexec/rpcd/luci.v2ray
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
. /usr/share/libubox/jshn.sh

check_running_status() {
# here the stupid guy defines that 0 == running, 1 == not in running

local pid="$(cat /var/run/v2ray.main.pid 2>/dev/null)"

if [ -z "$pid" ] ; then
Expand Down Expand Up @@ -40,7 +42,7 @@ get_v2ray_version() {

test -x "$file" || chmod +x "$file"

local version="$(sh -c "$file --version 2>/dev/null | head -n1")"
local version="$(sh -c "$file version 2>/dev/null | head -n1")"

if [ -n "$version" ] ; then
printf '{ "code": 0, "version": "%s" }\n' "$version"
Expand Down