From 776140237bda9939e681557b80f100977d7ad9d4 Mon Sep 17 00:00:00 2001 From: Ghost in the Cyber <52607595+cyberblood@users.noreply.github.com> Date: Sat, 13 Jul 2019 10:55:50 +0800 Subject: [PATCH] [v1.0.9] Update v2ray core via latest download link. --- install.sh | 59 +++++++--- module.prop | 4 +- v2ray/etc/config.json.template | 194 +++++++++++++++++++++++++++++++++ 3 files changed, 242 insertions(+), 15 deletions(-) create mode 100644 v2ray/etc/config.json.template diff --git a/install.sh b/install.sh index f922ca2..c707c06 100644 --- a/install.sh +++ b/install.sh @@ -134,28 +134,61 @@ on_install() { # Extend/change the logic to whatever you want ## ui_print "- Extracting module files" ## unzip -o "$ZIPFILE" 'system/*' -d $MODPATH >&2 - - # install v2ray execute file - ui_print "- Install V2Ray core $ARCH execute files" + # prepare v2ray execute environment + ui_print "- Prepare V2Ray execute environment." + mkdir -p /data/v2ray + mkdir -p /data/v2ray/run mkdir -p $MODPATH/scripts mkdir -p $MODPATH/system/bin mkdir -p $MODPATH/system/etc - unzip -j -o "$ZIPFILE" 'v2ray/scripts/*' -d $MODPATH/scripts >&2 - unzip -j -o "$ZIPFILE" "v2ray/bin/$ARCH/*" -d $MODPATH/system/bin >&2 - [ -f $MODPATH/system/bin/v2ray-dns.keeper ] && mv $MODPATH/system/bin/v2ray-dns.keeper $MODPATH/scripts >&2 + + # download latest v2ray core from official link + ui_print "- Connect official V2Ray download link." + official_v2ray_link="https://github.com/v2ray/v2ray-core/releases" + latest_v2ray_version=`curl -s -I "${official_v2ray_link}/latest" | grep 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-arm.zip" + ;; + arm64) + download_v2ray_link="${official_v2ray_link}/download/${latest_v2ray_version}/v2ray-linux-arm64.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}" -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/bin/$ARCH/v2ray-dns.keeper" -d $MODPATH/scripts >&2 + rm "${download_v2ray_zip}" # copy v2ray data and config ui_print "- Copy V2Ray config and data files" - mkdir -p /data/v2ray - mkdir -p /data/v2ray/run [ -f /data/v2ray/softap.list ] || \ echo "softap0" > /data/v2ray/softap.list [ -f /data/v2ray/resolv.conf ] || \ - unzip -j -o "$ZIPFILE" "v2ray/etc/resolv.conf" -d /data/v2ray >&2 - unzip -j -o "$ZIPFILE" "v2ray/etc/geosite.dat" -d /data/v2ray >&2 - unzip -j -o "$ZIPFILE" "v2ray/etc/geoip.dat" -d /data/v2ray >&2 - unzip -j -o "$ZIPFILE" "v2ray/etc/config.json" -d /data/v2ray/run >&2 - mv /data/v2ray/run/config.json /data/v2ray/config.json.template + unzip -j -o "${ZIPFILE}" "v2ray/etc/resolv.conf" -d /data/v2ray >&2 + 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 diff --git a/module.prop b/module.prop index ac908e9..cba5a1c 100644 --- a/module.prop +++ b/module.prop @@ -1,6 +1,6 @@ id=v2ray name=V2ray for Android -version=v4.19.1 -versionCode=20190707 +version=v4.20.0 +versionCode=20190713 author=chendefine description=V2ray core with service scripts for Android diff --git a/v2ray/etc/config.json.template b/v2ray/etc/config.json.template new file mode 100644 index 0000000..0bf8721 --- /dev/null +++ b/v2ray/etc/config.json.template @@ -0,0 +1,194 @@ +// 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", + + // 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" + }, + // List of inbound proxy configurations. + "inbounds": [{ + // Just listen for DNS proxy. + "port": 65534, + + // Tag of the inbound for DNS proxy routing. + "tag": "dns-in", + + // DNS proxy protocol must be dokodemo-door. + "protocol": "dokodemo-door", + + // Setting of DNS proxy. + "settings": { + "port": 53, + "address": "1.1.1.1", + "network": "tcp,udp" + } + },{ + // 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 + }, + + // Enable sniffing on TCP connection. + "sniffing": { + "enabled": true, + // Target domain will be overriden to the one carried by the connection, if the connection is HTTP or HTTPS. + "destOverride": ["http", "tls"] + } + }], + // List of outbound proxy configurations. + "outbounds": [{ + // Replace your proxy protocol in this section, like: vmess 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" + },{ + // DNS Proxy Outbond + "protocol": "dns", + + // Tag of the outbound for DNS proxy routing. + "tag": "dns-out" + },{ + "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": "IPOnDemand", + "rules":[ + { + // Proxy DNS request + "type": "field", + "inboundTag": ["dns-in"], + "outboundTag": "dns-out" + }, + { + // Bypass private IPs. + "type": "field", + "ip": ["geoip:private"], + "outboundTag": "direct" + }, + { + // Bypass all china IPs. + "type": "field", + "ip": ["geoip:cn"], + "outboundTag": "direct" + }, + { + // Bypass all china sites. + "type": "field", + "domain": ["geosite:cn"], + "outboundTag": "direct" + }, + { + // Blocks major ads. + "type": "field", + "domain": ["geosite:category-ads"], + "outboundTag": "blocked" + } + ] + }, + + // Dns settings for domain resolution. + "dns": { + // Static hosts, similar to hosts file. + "hosts": { + // Match v2ray.com to another domain on CloudFlare. This domain will be used when querying IPs for v2ray.com. + "domain:v2ray.com": "www.vicemc.net", + + // The following settings help to eliminate DNS poisoning in mainland China. + // It is safe to comment these out if this is not the case for you. + "domain:github.io": "pages.github.com", + "domain:wikipedia.org": "www.wikimedia.org", + "domain:shadowsocks.org": "electronicsrealm.com" + }, + "servers": [ + "1.1.1.1", + "8.8.8.8", + "9.9.9.9", + { + "address": "114.114.114.114", + "port": 53, + // List of domains that use this DNS first. + "domains": [ + "geosite:cn" + ] + }, + "localhost" + ] + }, + + // 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 + } + }, + "system": { + "statsInboundUplink": false, + "statsInboundDownlink": false + } + }, + + // 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": {} +}