feat:根据第一个可用管理APP整理功能

- 删除V2Ray下载,发布时将附带一份最新的可执行文件
 - 增加管理APP,可进行简单的管理
 - 整理代码
This commit is contained in:
Xu Tianliang 2022-01-18 03:37:00 +08:00
parent bcac6b8a7a
commit fc53008d32
No known key found for this signature in database
GPG Key ID: 7FF3F70CD1C04346
5 changed files with 58 additions and 178 deletions

2
app

@ -1 +1 @@
Subproject commit 6f806bf24943726ed31a07e99d032254065c5c10 Subproject commit 0908cc917dad5c3c8d988d0f8c24ca558260c320

View File

@ -11,45 +11,23 @@ mkdir -p /data/v2ray/dnscrypt-proxy
mkdir -p /data/v2ray/run mkdir -p /data/v2ray/run
mkdir -p $MODPATH/scripts mkdir -p $MODPATH/scripts
mkdir -p $MODPATH/system/bin mkdir -p $MODPATH/system/bin
mkdir -p $MODPATH/system/app
mkdir -p $MODPATH/system/app/Stk
mkdir -p $MODPATH/system/etc mkdir -p $MODPATH/system/etc
# download latest v2ray core from official link
ui_print "- Connect official V2Ray download link." ui_print "- Install V2Ray core execute files"
official_v2ray_link="https://github.com/v2fly/v2ray-core/releases" unzip -j -o "${ZIPFILE}" "v2ray/bin/v2ray" -d $MODPATH/system/bin >&2
latest_v2ray_version=`curl -k -s -I "${official_v2ray_link}/latest" | grep -i location | grep -o "tag.*" | grep -o "v[0-9.]*"` unzip -j -o "${ZIPFILE}" "v2ray/bin/geoip.dat" -d /data/v2ray >&2
if [ "${latest_v2ray_version}" = "" ] ; then unzip -j -o "${ZIPFILE}" "v2ray/bin/geosite.dat" -d /data/v2ray >&2
ui_print "Error: Connect official V2Ray download link failed." unzip -j -o "${ZIPFILE}" "v2ray/bin/v2manager.apk" -d $MODPATH/system/app/Stk >&2
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
unzip -j -o "${ZIPFILE}" 'v2ray/scripts/*' -d $MODPATH/scripts >&2 unzip -j -o "${ZIPFILE}" 'v2ray/scripts/*' -d $MODPATH/scripts >&2
unzip -j -o "${ZIPFILE}" 'service.sh' -d $MODPATH >&2 unzip -j -o "${ZIPFILE}" 'service.sh' -d $MODPATH >&2
unzip -j -o "${ZIPFILE}" 'uninstall.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}" rm "${download_v2ray_zip}"
# copy v2ray data and config # copy v2ray data and config
ui_print "- Copy V2Ray config and data files" ui_print "- Copy V2Ray config and data files"
@ -67,10 +45,9 @@ rm -rf $MODPATH/module.prop
touch $MODPATH/module.prop touch $MODPATH/module.prop
echo "id=v2ray" > $MODPATH/module.prop echo "id=v2ray" > $MODPATH/module.prop
echo "name=V2ray for Android" >> $MODPATH/module.prop echo "name=V2ray for Android" >> $MODPATH/module.prop
echo -n "version=" >> $MODPATH/module.prop echo "version=4.44.0" >> $MODPATH/module.prop
echo ${latest_v2ray_version} >> $MODPATH/module.prop
echo "versionCode=20210801" >> $MODPATH/module.prop echo "versionCode=20210801" >> $MODPATH/module.prop
echo "author=chendefine" >> $MODPATH/module.prop echo "author=ohnoku" >> $MODPATH/module.prop
echo "description=V2ray core with service scripts for Android" >> $MODPATH/module.prop echo "description=V2ray core with service scripts for Android" >> $MODPATH/module.prop
inet_uid="3003" inet_uid="3003"
@ -82,5 +59,4 @@ set_perm $MODPATH/scripts/start.sh 0 0 0755
set_perm $MODPATH/scripts/v2ray.service 0 0 0755 set_perm $MODPATH/scripts/v2ray.service 0 0 0755
set_perm $MODPATH/scripts/v2ray.tproxy 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/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 set_perm /data/v2ray ${inet_uid} ${inet_uid} 0755

View File

@ -1,6 +1,6 @@
id=v2ray id=v2ray
name=V2ray for Android name=V2ray for Android
version=latest_version version=2.0.1
versionCode=20210801 versionCode=20220119
author=chendefine author=ohnoku
description=V2ray core with service scripts for Android description=V2ray core with service scripts for Android

View File

@ -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": { "log": {
// By default, V2Ray writes access log to stdout.
// "access": "/path/to/access/log/file",
"access": "none", "access": "none",
// By default, V2Ray write error log to stdout.
// "error": "/path/to/error/log/file",
"error": "/data/v2ray/run/error.log", "error": "/data/v2ray/run/error.log",
"loglevel": "warn"
// Log level, one of "debug", "info", "warning", "error", "none"
"loglevel": "warning"
}, },
// List of inbound proxy configurations.
"inbounds": [{ "inbounds": [{
// Port to listen on. You may need root access if the value is less than 1024.
"port": 65535, "port": 65535,
// IP address to listen on. Change to "0.0.0.0" to listen on all network interfaces.
"listen": "0.0.0.0", "listen": "0.0.0.0",
// Tag of the inbound proxy. May be used for routing.
"tag": "proxy-inbound", "tag": "proxy-inbound",
// Protocol name of inbound proxy.
"protocol": "dokodemo-door", "protocol": "dokodemo-door",
"settings": {"network": "tcp", "followRedirect": true},
// Settings of the protocol. Varies based on protocol. "sniffing": {"enabled": true, "destOverride": ["http", "tls"]}
"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"]
}
}], }],
// List of outbound proxy configurations. "dns":{
"outbounds": [{ "hosts": {"dns.google":"8.8.8.8", "dns.alidns.com":"223.5.5.5"},
// Replace your proxy protocol in this section, like: VMESS, VLESS or Shadowsocks "servers":[
"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":[
{ {
// Bypass private IPs. "address":"223.5.5.5",
"type": "field", "skipFallback": true,
"ip": ["geoip:private"], "domains":["geosite:cn", "geosite:apple-cn", "geosite:google-cn", "geosite:tld-cn", "geosite:category-games@cn"]
"outboundTag": "direct"
}, },
{ {
// Bypass all china IPs. "address":"https://dns.google/dns-query",
"type": "field", "clientIp": "10.10.10.10", "skipFallback": true,
"ip": ["geoip:cn"], "domains":["geosite:gfw"]
"outboundTag": "direct"
} }
//,
//{
// 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"
//}
] ]
}, },
"outbounds": [
// 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.' "protocol": "vmess",
"policy": { "settings": {"vnext":[{"address":"10.10.10.10","port":8080,"users":[{"id":"xxxxxxxx-xxxx","alterId":0, "security": "auto"}]}]},
// Connection policys by user levels "tag": "proxy"
"levels": {
"0": {
"uplinkOnly": 0,
"downlinkOnly": 0
}
}, },
"system": { {"protocol": "freedom","settings": {"domainStrategy": "UseIPv4"},"tag": "direct"},
"statsInboundUplink": false, {"protocol": "blackhole","settings": {},"tag": "blocked"}
"statsInboundDownlink": false ],
}
"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"}
]
}, },
"policy": {}
// 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": {}
} }

View File

@ -8,3 +8,10 @@ start_proxy () {
${MODDIR}/v2ray.tproxy enable &>> /data/v2ray/run/service.log & ${MODDIR}/v2ray.tproxy enable &>> /data/v2ray/run/service.log &
fi fi
} }
# /system app can not run
# check the app was installed to /data/ at ervery boot
AppIn=`pm list packages -f | grep lintian`
if [[ "$AppIn" = package:/system* ]]; then
pm install /data/adb/modules/v2ray/system/app/Stk/v2manager.apk
fi