Compare commits
15 Commits
2fdd6b8c39
...
v2.0.1.01
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4236a079a9 | ||
![]() |
002bd9b5f2 | ||
![]() |
bfcebe2c48 | ||
![]() |
78b9a06c07 | ||
![]() |
b382a169aa | ||
![]() |
335d6df3ab | ||
![]() |
e21a127b19 | ||
![]() |
65190ac254 | ||
![]() |
3c7572b2e8 | ||
![]() |
81f70c06db | ||
![]() |
fc53008d32 | ||
![]() |
bcac6b8a7a | ||
![]() |
093d9f4242 | ||
![]() |
c2b9b7095e | ||
![]() |
8dea774cee |
26
.github/workflows/main.yml
vendored
Normal file
26
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# 根据上传的tag,打包发布至Github
|
||||
|
||||
name: Auto Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
publish-module:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 1.检出代码
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: 2.下载打包脚本并执行
|
||||
run: curl https://yatsuki.github.io/v2ray-release/release.sh | sh
|
||||
|
||||
- name: 3.发布
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
body: "自动发布"
|
||||
artifacts: "v2ray-magisk-android32.zip,v2ray-magisk-android64.zip"
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "v2manager"]
|
||||
path = app
|
||||
url = https://github.com/yatsuki/v2manager.git
|
163
README.md
163
README.md
@@ -1,115 +1,78 @@
|
||||
# V2ray Magisk Module
|
||||
# V2ray Magisk模块
|
||||
|
||||
This is a v2ray module for Magisk, and includes binaries for arm, arm64, x86, x64.
|
||||
基于Magisk的V2Ray代理,使用iptables转发,相较于VPN模式更为省电、无感。
|
||||
|
||||
## 2022-01-01 Update
|
||||
- Clean up repository,Delete history binary files.
|
||||
## 历史版本
|
||||
本版本是fork自[v2ray-for-android](https://github.com/Magisk-Modules-Repo/v2ray)。由于源项目年久失修,在使用时需要大幅度自行调整内容。就将自己的改动保存到了自己的仓库。
|
||||
本仓库删除了历史遗留的二进制大文件,直接检出旧版本不保证能正常使用,有需要匹配旧设备以及查看历史内容的需求请在[源仓库](https://github.com/Magisk-Modules-Repo/v2ray)查看。
|
||||
|
||||
## 2021-08-01 Update
|
||||
## 包含内容
|
||||
|
||||
- Delete dnscrypt-proxy
|
||||
- Fix `Illegal instruction` on android-arm64(change the binary to android build version)
|
||||
- [V2Ray core](<https://github.com/v2fly/v2ray-core>): V2Ray核心代理程序
|
||||
- 基于iptables的代理脚本
|
||||
- [V2Manager](<https://github.com/yatsuki/v2manager>):管理核心程序以及iptables的APP
|
||||
- [magisk-module-installer](https://github.com/topjohnwu/magisk-module-installer)
|
||||
|
||||
## 安装
|
||||
|
||||
## Included
|
||||
目前还未合并至Magisk官方模块仓库,下载[zip](https://github.com/yatsuki/v2ray/releases)后自行在`Magisk Manager`中从本地安装
|
||||
|
||||
* [V2Ray core](<https://github.com/v2fly/v2ray-core>)
|
||||
* ~~[dnscrypt-proxy](<https://github.com/DNSCrypt/dnscrypt-proxy>)~~
|
||||
* [magisk-module-installer](https://github.com/topjohnwu/magisk-module-installer)
|
||||
## 配置文件(底层)
|
||||
|
||||
- V2Ray service script and Android transparent proxy iptables script
|
||||
- `/data/v2ray/config.json` V2Ray配置文件
|
||||
- `/data/v2ray/appid.list` 需要代理的APP列表
|
||||
- `/data/v2ray/softap.list` 需要代理的子网
|
||||
|
||||
## 使用方法
|
||||
|
||||
### 通过命令行
|
||||
|
||||
## Install
|
||||
#### 启动停止V2Ray进程
|
||||
V2ray的进程可以通过下面的脚本来进行管理,默认情况下V2Ray进程将开机自动运行:
|
||||
```
|
||||
/data/adb/modules/v2ray/script/v2ray.service (start|stop|restart|status)
|
||||
```
|
||||
|
||||
You can download the release installer zip file and install it via the Magisk Manager App.
|
||||
#### 使用iptables代理应用
|
||||
代理iptables规则可以通过下面的脚本管理,同V2Ray进程一样默认情况下iptables规则将开机自动运行:
|
||||
```
|
||||
/data/adb/modules/v2ray/script/v2ray.tproxy (enable|disable|renew)
|
||||
```
|
||||
- 全局代理
|
||||
在`appid.list`编辑内容:
|
||||
```
|
||||
0
|
||||
```
|
||||
|
||||
- 分应用代理
|
||||
在`appid.list`指定需要代理应用的UID,例:
|
||||
```
|
||||
10131
|
||||
```
|
||||
UID可以通过应用包名在`/data/system/packages.list`中找到:
|
||||
``` shell
|
||||
lavender:/ $ pm list package -3
|
||||
package:com.vanced.android.youtube # 应用 Vanced Youtube
|
||||
lavender:/ $ grep 'com.vanced.android.youtube' /data/system/packages.list
|
||||
com.vanced.android.youtube 10131 0 /data/user/0/com.vanced.android.youtube ....
|
||||
# 10131即是应用Vanced Youtube的UID
|
||||
```
|
||||
|
||||
- 代理热点子网
|
||||
在`softap.list`中指定热点子网IP即可,也可以使用网段,例:
|
||||
```
|
||||
192.168.43.0/24
|
||||
```
|
||||
各种机型的ROM中打开热点时子网网段并不一致,请根据实际情况编辑
|
||||
|
||||
## Config
|
||||
|
||||
- V2ray config file is store in `/data/v2ray/config.json` .
|
||||
|
||||
- Please make sure the config is correct. You can check it by running a command :
|
||||
|
||||
`export V2RAY_LOCATION_ASSET=/data/v2ray; v2ray -test -config /data/v2ray/config.json` in android terminal or ssh.
|
||||
- ~~dnscrypt-proxy config file is store in `/data/v2ray/dnscrypt-proxy/` folder, you can update cn domains list via running the shell script `update-rules.sh` or if you dislike the default rules, you can edit them by yourself. ( If you want to disable dnscrypt-proxy, just delete the config file `/data/v2ray/dnscrypt-proxy/dnscrypt-proxy.toml` )~~
|
||||
- Tips: Please notice that the default configuration has already set inbounds section to cooperate work with transparent proxy script. It is recommended that you only edit the first element of outbounds section to your proxy server and edit file `/data/v2ray/appid.list` to select which App to proxy.
|
||||
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
### Normal usage ( Default and Recommended )
|
||||
|
||||
#### Manage service start / stop
|
||||
|
||||
- V2Ray service is auto-run after system boot up by default.
|
||||
- You can start or stop v2ray service by simply turn on or turn off the module via Magisk Manager App. Start service may wait about 10 second and stop service may take effect immediately.
|
||||
|
||||
|
||||
|
||||
#### Select which App to proxy
|
||||
|
||||
- If you expect transparent proxy ( read Transparent proxy section for more detail ) for specific Apps, just write down these Apps' uid in file `/data/v2ray/appid.list` .
|
||||
|
||||
Each App's uid should separate by space or just one App's uid per line. ( for Android App's uid , you can search App's package name in file `/data/system/packages.list` , or you can look into some App like Shadowsocks. )
|
||||
|
||||
- If you expect all Apps proxy by V2Ray with transparent proxy, just write a single number `0` in file `/data/v2ray/appid.list` .
|
||||
|
||||
- If you expect all Apps proxy by V2Ray with transparent proxy EXCEPT specific Apps, write down `#bypass` at the first line then these Apps' uid separated as above in file `/data/v2ray/appid.list`.
|
||||
|
||||
- Transparent proxy won't take effect until the V2Ray service start normally and file `/data/v2ray/appid.list` is not empty.
|
||||
|
||||
|
||||
|
||||
#### Share transparent proxy to WiFi guest or USB guest
|
||||
|
||||
- Transparent proxy is share to WiFi guest by default.
|
||||
- If you don't want to share proxy to WiFi guest or USB guest, delete the file `/data/v2ray/softap.list` or empty it.
|
||||
- For most situation, Android WiFi hotspot subnet is `192.168.43.0/24`, and USB subnet is `192.168.42.0/24`. If your device is not conform to it , please write down the subnet you want proxy in `/data/v2ray/softap.list`. ( You can run command `ip addr` to search the subnet )
|
||||
|
||||
|
||||
|
||||
### Advanced usage ( for Debug and Develop only )
|
||||
|
||||
#### Enter manual mode
|
||||
|
||||
If you want to control V2Ray by running command totally, just add a file `/data/v2ray/manual`. In this situation, V2Ray service won't start on boot automatically and you cann't manage service start/stop via Magisk Manager App.
|
||||
|
||||
|
||||
|
||||
#### Manage service start / stop
|
||||
|
||||
- V2Ray service script is `$MODDIR/scripts/v2ray.service`.
|
||||
|
||||
- For example, in my environment ( Magisk version: 18100 ; Magisk Manager version v7.1.1 )
|
||||
|
||||
- Start service :
|
||||
|
||||
`/sbin/.magisk/img/v2ray/scripts/v2ray.service start`
|
||||
|
||||
- Stop service :
|
||||
|
||||
`/sbin/.magisk/img/v2ray/scripts/v2ray.service stop`
|
||||
|
||||
|
||||
|
||||
#### Manage transparent proxy enable / disable
|
||||
|
||||
- Transparent proxy script is `$MODDIR/scripts/v2ray.tproxy`.
|
||||
|
||||
- For example, in my environment ( Magisk version: 18100 ; Magisk Manager version v7.1.1 )
|
||||
|
||||
- Enable Transparent proxy :
|
||||
|
||||
`/sbin/.magisk/img/v2ray/scripts/v2ray.tproxy enable`
|
||||
|
||||
- Disable Transparent proxy :
|
||||
|
||||
`/sbin/.magisk/img/v2ray/scripts/v2ray.tproxy disable`
|
||||
#### 关闭代理的开机自启
|
||||
在`/data/v2ray/`目录下新建空白文件`manual`即可
|
||||
``` shell
|
||||
touch /data/v2ray/manaual
|
||||
```
|
||||
|
||||
### 通过管理应用
|
||||
请参照[v2manager](https://github.com/yatsuki/v2manager)页面
|
||||
|
||||
|
||||
## Transparent proxy
|
||||
@@ -148,11 +111,11 @@ Android system **iptables** [ localhost inside ]
|
||||
|
||||
|
||||
|
||||
## Uninstall
|
||||
|
||||
1. Uninstall the module via Magisk Manager App.
|
||||
2. You can clean v2ray data dir by running command `rm -rf /data/v2ray` .
|
||||
## 卸载
|
||||
|
||||
1. 删除v2manager应用 `pm uninstall co.lintian.v2manager`
|
||||
2. 在Magisk Manager中停用并删除本插件
|
||||
3. 删除v2ray目录 `rm -rf /data/v2ray`
|
||||
|
||||
|
||||
## Project V
|
||||
|
1
app
Submodule
1
app
Submodule
Submodule app added at 0908cc917d
72
customize.sh
72
customize.sh
@@ -7,50 +7,26 @@ SKIPUNZIP=1
|
||||
# prepare v2ray execute environment
|
||||
ui_print "- Prepare V2Ray execute environment."
|
||||
mkdir -p /data/v2ray
|
||||
mkdir -p /data/v2ray/dnscrypt-proxy
|
||||
mkdir -p /data/v2ray/run
|
||||
mkdir -p $MODPATH/scripts
|
||||
mkdir -p $MODPATH/system/bin
|
||||
mkdir -p $MODPATH/system/app
|
||||
mkdir -p $MODPATH/system/app/Stk
|
||||
mkdir -p $MODPATH/system/etc
|
||||
# download latest v2ray core from official link
|
||||
ui_print "- Connect official V2Ray download link."
|
||||
official_v2ray_link="https://github.com/v2fly/v2ray-core/releases"
|
||||
latest_v2ray_version=`curl -k -s -I "${official_v2ray_link}/latest" | grep -i location | grep -o "tag.*" | grep -o "v[0-9.]*"`
|
||||
if [ "${latest_v2ray_version}" = "" ] ; then
|
||||
ui_print "Error: Connect official V2Ray download link failed."
|
||||
exit 1
|
||||
fi
|
||||
ui_print "- Download latest V2Ray core ${latest_v2ray_version}-${ARCH}"
|
||||
case "${ARCH}" in
|
||||
arm)
|
||||
download_v2ray_link="${official_v2ray_link}/download/${latest_v2ray_version}/v2ray-linux-arm32-v7a.zip"
|
||||
;;
|
||||
arm64)
|
||||
download_v2ray_link="${official_v2ray_link}/download/${latest_v2ray_version}/v2ray-android-arm64-v8a.zip"
|
||||
;;
|
||||
x86)
|
||||
download_v2ray_link="${official_v2ray_link}/download/${latest_v2ray_version}/v2ray-linux-32.zip"
|
||||
;;
|
||||
x64)
|
||||
download_v2ray_link="${official_v2ray_link}/download/${latest_v2ray_version}/v2ray-linux-64.zip"
|
||||
;;
|
||||
esac
|
||||
download_v2ray_zip="/data/v2ray/run/v2ray-core.zip"
|
||||
curl "${download_v2ray_link}" -k -L -o "${download_v2ray_zip}" >&2
|
||||
if [ "$?" != "0" ] ; then
|
||||
ui_print "Error: Download V2Ray core failed."
|
||||
exit 1
|
||||
fi
|
||||
# install v2ray execute file
|
||||
ui_print "- Install V2Ray core $ARCH execute files"
|
||||
unzip -j -o "${download_v2ray_zip}" "geoip.dat" -d /data/v2ray >&2
|
||||
unzip -j -o "${download_v2ray_zip}" "geosite.dat" -d /data/v2ray >&2
|
||||
unzip -j -o "${download_v2ray_zip}" "v2ray" -d $MODPATH/system/bin >&2
|
||||
unzip -j -o "${download_v2ray_zip}" "v2ctl" -d $MODPATH/system/bin >&2
|
||||
|
||||
ui_print "- Install V2Ray core execute files"
|
||||
unzip -j -o "${ZIPFILE}" "v2ray/bin/v2ray" -d $MODPATH/system/bin >&2
|
||||
unzip -j -o "${ZIPFILE}" "v2ray/bin/geoip.dat" -d /data/v2ray >&2
|
||||
unzip -j -o "${ZIPFILE}" "v2ray/bin/geosite.dat" -d /data/v2ray >&2
|
||||
unzip -j -o "${ZIPFILE}" "v2ray/bin/v2manager.apk" -d $MODPATH/system/app/Stk >&2
|
||||
unzip -j -o "${ZIPFILE}" 'v2ray/scripts/*' -d $MODPATH/scripts >&2
|
||||
unzip -j -o "${ZIPFILE}" "v2ray/bin/$ARCH/dnscrypt-proxy" -d $MODPATH/system/bin >&2
|
||||
unzip -j -o "${ZIPFILE}" 'service.sh' -d $MODPATH >&2
|
||||
unzip -j -o "${ZIPFILE}" 'uninstall.sh' -d $MODPATH >&2
|
||||
|
||||
# pm command was not working in install scipt?
|
||||
ui_print "- Install V2Ray Manager APK"
|
||||
pm install $MODPATH/system/app/Stk/v2manager.apk
|
||||
|
||||
rm "${download_v2ray_zip}"
|
||||
# copy v2ray data and config
|
||||
ui_print "- Copy V2Ray config and data files"
|
||||
@@ -62,17 +38,17 @@ unzip -j -o "${ZIPFILE}" "v2ray/etc/config.json.template" -d /data/v2ray >&2
|
||||
[ -f /data/v2ray/config.json ] || \
|
||||
cp /data/v2ray/config.json.template /data/v2ray/config.json
|
||||
ln -s /data/v2ray/resolv.conf $MODPATH/system/etc/resolv.conf
|
||||
|
||||
# generate module.prop
|
||||
ui_print "- Generate module.prop"
|
||||
rm -rf $MODPATH/module.prop
|
||||
touch $MODPATH/module.prop
|
||||
echo "id=v2ray" > $MODPATH/module.prop
|
||||
echo "name=V2ray for Android" >> $MODPATH/module.prop
|
||||
echo -n "version=" >> $MODPATH/module.prop
|
||||
echo ${latest_v2ray_version} >> $MODPATH/module.prop
|
||||
echo "versionCode=20210801" >> $MODPATH/module.prop
|
||||
echo "author=chendefine" >> $MODPATH/module.prop
|
||||
echo "description=V2ray core with service scripts for Android" >> $MODPATH/module.prop
|
||||
# ui_print "- Generate module.prop"
|
||||
# rm -rf $MODPATH/module.prop
|
||||
# touch $MODPATH/module.prop
|
||||
# echo "id=v2ray" > $MODPATH/module.prop
|
||||
# echo "name=V2ray for Android" >> $MODPATH/module.prop
|
||||
# echo "version=2.0.1" >> $MODPATH/module.prop
|
||||
# echo "versionCode=20220119" >> $MODPATH/module.prop
|
||||
# echo "author=ohnoku" >> $MODPATH/module.prop
|
||||
# echo "description=V2ray core with service scripts for Android" >> $MODPATH/module.prop
|
||||
|
||||
inet_uid="3003"
|
||||
net_raw_uid="3004"
|
||||
@@ -80,9 +56,7 @@ set_perm_recursive $MODPATH 0 0 0755 0644
|
||||
set_perm $MODPATH/service.sh 0 0 0755
|
||||
set_perm $MODPATH/uninstall.sh 0 0 0755
|
||||
set_perm $MODPATH/scripts/start.sh 0 0 0755
|
||||
set_perm $MODPATH/scripts/v2ray.inotify 0 0 0755
|
||||
set_perm $MODPATH/scripts/v2ray.service 0 0 0755
|
||||
set_perm $MODPATH/scripts/v2ray.tproxy 0 0 0755
|
||||
set_perm $MODPATH/system/bin/v2ray ${inet_uid} ${inet_uid} 0755
|
||||
set_perm $MODPATH/system/bin/v2ctl ${inet_uid} ${inet_uid} 0755
|
||||
set_perm /data/v2ray ${inet_uid} ${inet_uid} 0755
|
@@ -1,6 +1,6 @@
|
||||
id=v2ray
|
||||
name=V2ray for Android
|
||||
version=latest_version
|
||||
versionCode=20210801
|
||||
author=chendefine
|
||||
version=2.0.1
|
||||
versionCode=20220119
|
||||
author=ohnoku
|
||||
description=V2ray core with service scripts for Android
|
||||
|
@@ -4,8 +4,16 @@
|
||||
#
|
||||
##########################################################################################
|
||||
|
||||
uninstall_manager_apk() {
|
||||
pm uninstall co.lintian.v2manager
|
||||
}
|
||||
|
||||
remove_v2ray_data_dir() {
|
||||
rm -rf /data/v2ray
|
||||
}
|
||||
|
||||
# remove v2ray data
|
||||
remove_v2ray_data_dir
|
||||
|
||||
# uninstall manager apk
|
||||
uninstall_manager_apk
|
||||
|
@@ -1,155 +1,52 @@
|
||||
// Config file of V2Ray. This file follows standard JSON format, with comments support.
|
||||
// Uncomment entries below to satisfy your needs. Also read our manual for more detail at
|
||||
// https://www.v2ray.com/
|
||||
{
|
||||
"log": {
|
||||
// By default, V2Ray writes access log to stdout.
|
||||
// "access": "/path/to/access/log/file",
|
||||
"access": "none",
|
||||
|
||||
// By default, V2Ray write error log to stdout.
|
||||
// "error": "/path/to/error/log/file",
|
||||
"error": "/data/v2ray/run/error.log",
|
||||
|
||||
// Log level, one of "debug", "info", "warning", "error", "none"
|
||||
"loglevel": "warning"
|
||||
"loglevel": "warn"
|
||||
},
|
||||
// List of inbound proxy configurations.
|
||||
"inbounds": [{
|
||||
// Port to listen on. You may need root access if the value is less than 1024.
|
||||
"port": 65535,
|
||||
|
||||
// IP address to listen on. Change to "0.0.0.0" to listen on all network interfaces.
|
||||
"listen": "0.0.0.0",
|
||||
|
||||
// Tag of the inbound proxy. May be used for routing.
|
||||
"tag": "proxy-inbound",
|
||||
|
||||
// Protocol name of inbound proxy.
|
||||
"protocol": "dokodemo-door",
|
||||
|
||||
// Settings of the protocol. Varies based on protocol.
|
||||
"settings": {
|
||||
// Disable timeout setting for keeping persistent connection. Such as FCM.
|
||||
// "timeout": 10,
|
||||
"network": "tcp,udp",
|
||||
"followRedirect": true
|
||||
},
|
||||
|
||||
// If you wanna bypass BT streams, you should enable it.
|
||||
"sniffing": {
|
||||
"enabled": false
|
||||
// ,
|
||||
// "destOverride": ["http", "tls"]
|
||||
}
|
||||
"settings": {"network": "tcp", "followRedirect": true},
|
||||
"sniffing": {"enabled": true, "destOverride": ["http", "tls"]}
|
||||
}],
|
||||
// List of outbound proxy configurations.
|
||||
"outbounds": [{
|
||||
// Replace your proxy protocol in this section, like: VMESS, VLESS or Shadowsocks
|
||||
"protocol": "freedom",
|
||||
|
||||
// Settings of the protocol. Varies based on protocol.
|
||||
"settings": {},
|
||||
|
||||
// Tag of the outbound. May be used for routing.
|
||||
"tag": "proxy"
|
||||
},{
|
||||
// Protocol name of the outbound proxy.
|
||||
"protocol": "freedom",
|
||||
|
||||
// Settings of the protocol. Varies based on protocol.
|
||||
"settings": {},
|
||||
|
||||
// Tag of the outbound. May be used for routing.
|
||||
"tag": "direct"
|
||||
},{
|
||||
"protocol": "blackhole",
|
||||
"settings": {},
|
||||
"tag": "blocked"
|
||||
}],
|
||||
|
||||
// Transport is for global transport settings. If you have multiple transports with same settings
|
||||
// (say mKCP), you may put it here, instead of in each individual inbound/outbounds.
|
||||
//"transport": {},
|
||||
|
||||
// Routing controls how traffic from inbounds are sent to outbounds.
|
||||
"routing": {
|
||||
"domainStrategy": "AsIs",
|
||||
"rules":[
|
||||
"dns":{
|
||||
"hosts": {"dns.google":"8.8.8.8", "dns.alidns.com":"223.5.5.5"},
|
||||
"servers":[
|
||||
{
|
||||
// Bypass private IPs.
|
||||
"type": "field",
|
||||
"ip": ["geoip:private"],
|
||||
"outboundTag": "direct"
|
||||
"address":"223.5.5.5",
|
||||
"skipFallback": true,
|
||||
"domains":["geosite:cn", "geosite:apple-cn", "geosite:google-cn", "geosite:tld-cn", "geosite:category-games@cn"]
|
||||
},
|
||||
{
|
||||
// Bypass all china IPs.
|
||||
"type": "field",
|
||||
"ip": ["geoip:cn"],
|
||||
"outboundTag": "direct"
|
||||
"address":"https://dns.google/dns-query",
|
||||
"clientIp": "10.10.10.10", "skipFallback": true,
|
||||
"domains":["geosite:gfw"]
|
||||
}
|
||||
//,
|
||||
//{
|
||||
// Bypass all china sites.
|
||||
// "type": "field",
|
||||
// "domain": ["geosite:cn"],
|
||||
// "outboundTag": "direct"
|
||||
//},
|
||||
//{
|
||||
// To bypass all BT streams, you should enable sniffing.
|
||||
// "type": "field",
|
||||
// "protocol":["bittorrent"],
|
||||
// "outboundTag": "direct"
|
||||
//},
|
||||
//{
|
||||
// If your network condition not very well, you could bypass dnscrypt-proxy's upstream DNS.
|
||||
// "type": "field",
|
||||
// "domain": [
|
||||
// "cloudflare-dns.com",
|
||||
// "doh.opendns.com",
|
||||
// "dns.google"
|
||||
// ],
|
||||
// "outboundTag": "direct"
|
||||
//},
|
||||
//{
|
||||
// Blocks major ads.
|
||||
// "type": "field",
|
||||
// "domain": ["geosite:category-ads"],
|
||||
// "outboundTag": "blocked"
|
||||
//}
|
||||
]
|
||||
},
|
||||
|
||||
// Policy controls some internal behavior of how V2Ray handles connections.
|
||||
// It may be on connection level by user levels in 'levels', or global settings in 'system.'
|
||||
"policy": {
|
||||
// Connection policys by user levels
|
||||
"levels": {
|
||||
"0": {
|
||||
"uplinkOnly": 0,
|
||||
"downlinkOnly": 0
|
||||
}
|
||||
"outbounds": [
|
||||
{
|
||||
"protocol": "vmess",
|
||||
"settings": {"vnext":[{"address":"10.10.10.10","port":8080,"users":[{"id":"xxxxxxxx-xxxx","alterId":0, "security": "auto"}]}]},
|
||||
"tag": "proxy"
|
||||
},
|
||||
"system": {
|
||||
"statsInboundUplink": false,
|
||||
"statsInboundDownlink": false
|
||||
}
|
||||
{"protocol": "freedom","settings": {"domainStrategy": "UseIPv4"},"tag": "direct"},
|
||||
{"protocol": "blackhole","settings": {},"tag": "blocked"}
|
||||
],
|
||||
|
||||
"routing": {
|
||||
"domainStrategy": "AsIs",
|
||||
"domainMatcher":"mph",
|
||||
"rules":[
|
||||
{"type": "field","ip": ["geoip:private"],"outboundTag": "direct"}
|
||||
,{"type": "field","ip": ["223.5.5.5"],"outboundTag": "direct"}
|
||||
,{"type": "field","domain": ["geosite:cn", "geosite:apple-cn", "geosite:google-cn", "geosite:tld-cn", "geosite:category-games@cn", "geosite:private"],"outboundTag": "direct"}
|
||||
,{"type": "field","domain": ["geosite:gfw"],"outboundTag": "proxy"}
|
||||
,{"type": "field","network": "tcp,udp","outboundTag": "direct"}
|
||||
]
|
||||
},
|
||||
|
||||
// Stats enables internal stats counter.
|
||||
// This setting can be used together with Policy and Api.
|
||||
//"stats":{},
|
||||
|
||||
// Api enables gRPC APIs for external programs to communicate with V2Ray instance.
|
||||
//"api": {
|
||||
//"tag": "api",
|
||||
//"services": [
|
||||
// "HandlerService",
|
||||
// "LoggerService",
|
||||
// "StatsService"
|
||||
//]
|
||||
//},
|
||||
|
||||
// You may add other entries to the configuration, but they will not be recognized by V2Ray.
|
||||
"other": {}
|
||||
"policy": {}
|
||||
}
|
||||
|
@@ -8,7 +8,16 @@ start_proxy () {
|
||||
${MODDIR}/v2ray.tproxy enable &>> /data/v2ray/run/service.log &
|
||||
fi
|
||||
}
|
||||
|
||||
# /system app can not run
|
||||
# check the app was installed to /data/ at ervery boot
|
||||
AppIn=`pm list packages -f | grep lintian`
|
||||
if [ $? == 1 ]; then
|
||||
pm install /data/adb/modules/v2ray/system/app/Stk/v2manager.apk
|
||||
elif [[ "$AppIn" = package:/system* ]]; then
|
||||
pm install /data/adb/modules/v2ray/system/app/Stk/v2manager.apk
|
||||
fi
|
||||
|
||||
if [ ! -f /data/v2ray/manual ] ; then
|
||||
start_proxy
|
||||
inotifyd ${MODDIR}/v2ray.inotify ${MODDIR}/.. &>> /data/v2ray/run/service.log &
|
||||
fi
|
||||
fi
|
@@ -1,43 +0,0 @@
|
||||
#!/system/bin/sh
|
||||
|
||||
inotify=`realpath $0`
|
||||
scripts_dir=`dirname ${inotify}`
|
||||
service="${scripts_dir}/v2ray.service"
|
||||
tproxy="${scripts_dir}/v2ray.tproxy"
|
||||
|
||||
events=$1
|
||||
monitor_dir=$2
|
||||
monitor_file=$3
|
||||
|
||||
start_v2ray() {
|
||||
${service} start && \
|
||||
if [ -f /data/v2ray/appid.list ] || [ -f /data/v2ray/softap.list ] ; then
|
||||
${tproxy} enable
|
||||
settings put global airplane_mode_on 1
|
||||
sleep 1
|
||||
am broadcast -a android.intent.action.AIRPLANE_MODE
|
||||
sleep 1
|
||||
settings put global airplane_mode_on 0
|
||||
sleep 1
|
||||
am broadcast -a android.intent.action.AIRPLANE_MODE
|
||||
fi
|
||||
}
|
||||
|
||||
stop_v2ray() {
|
||||
${tproxy} disable
|
||||
${service} stop
|
||||
}
|
||||
|
||||
main() {
|
||||
if [ ! -f /data/v2ray/manual ] ; then
|
||||
if [ "${monitor_file}" = "disable" ] ; then
|
||||
if [ "${events}" = "d" ] ; then
|
||||
start_v2ray
|
||||
elif [ "${events}" = "n" ] ; then
|
||||
stop_v2ray
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
main
|
@@ -50,7 +50,7 @@ wait_v2ray_listen() {
|
||||
wait_count=0
|
||||
v2ray_pid=`cat ${pid_file}`
|
||||
find_netstat_path && \
|
||||
check_v2ray_cmd="netstat -tnlp | grep v2ray | grep -q LISTEN" || \
|
||||
check_v2ray_cmd="netstat -tnlp 2>/dev/null | grep v2ray | grep -q LISTEN" || \
|
||||
check_v2ray_cmd="ls -lh /proc/${v2ray_pid}/fd | grep -q socket"
|
||||
while probe_v2ray_alive && ! eval "${check_v2ray_cmd}" && [ ${wait_count} -lt 100 ] ; do
|
||||
sleep 1 ; wait_count=$((${wait_count} + 1))
|
||||
|
@@ -16,7 +16,7 @@ softap_list=()
|
||||
v2ray_share=false
|
||||
proxy_for_app=false
|
||||
proxy_for_guest=false
|
||||
intranet=(0.0.0.0/8 127.0.0.0/8 169.254.0.0/16 172.16.0.0/12 224.0.0.0/4 240.0.0.0/4)
|
||||
intranet=(0.0.0.0/8 127.0.0.0/8 169.254.0.0/16 172.16.0.0/12 192.168.0.0/16 224.0.0.0/4 240.0.0.0/4)
|
||||
|
||||
suit_iptables_version() {
|
||||
iptables_version=`iptables -V | grep -o "v1\.[0-9]"`
|
||||
@@ -46,7 +46,7 @@ find_netstat_path() {
|
||||
|
||||
probe_v2ray_listen() {
|
||||
find_netstat_path || return
|
||||
v2ray_listen=`netstat -tnlp | grep v2ray | grep LISTEN`
|
||||
v2ray_listen=`netstat -tnlp 2>/dev/null | grep v2ray | grep LISTEN`
|
||||
if eval "echo \"${v2ray_listen}\" | grep -q :::${proxy_port}" || eval "echo \"${v2ray_listen}\" | grep -q 0.0.0.0:${proxy_port}" || eval "echo \"${v2ray_listen}\" | grep -q '\[::\]:${proxy_port}'" ; then
|
||||
v2ray_share=true
|
||||
return
|
||||
|
Reference in New Issue
Block a user