diff --git a/app b/app index 6f806bf..0908cc9 160000 --- a/app +++ b/app @@ -1 +1 @@ -Subproject commit 6f806bf24943726ed31a07e99d032254065c5c10 +Subproject commit 0908cc917dad5c3c8d988d0f8c24ca558260c320 diff --git a/customize.sh b/customize.sh index f5c17fb..3f9451f 100644 --- a/customize.sh +++ b/customize.sh @@ -11,45 +11,23 @@ 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}" '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" @@ -67,10 +45,9 @@ 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 "version=4.44.0" >> $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 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.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 \ No newline at end of file diff --git a/module.prop b/module.prop index 92aec6c..39c69f6 100644 --- a/module.prop +++ b/module.prop @@ -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 diff --git a/v2ray/etc/config.json.template b/v2ray/etc/config.json.template index a9a513c..7428ef0 100644 --- a/v2ray/etc/config.json.template +++ b/v2ray/etc/config.json.template @@ -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": {} } diff --git a/v2ray/scripts/start.sh b/v2ray/scripts/start.sh index 719cad8..6f5958c 100644 --- a/v2ray/scripts/start.sh +++ b/v2ray/scripts/start.sh @@ -8,3 +8,10 @@ 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 [[ "$AppIn" = package:/system* ]]; then + pm install /data/adb/modules/v2ray/system/app/Stk/v2manager.apk +fi \ No newline at end of file