From b253472008d834e5b60cfa5ec597600a3d2367c9 Mon Sep 17 00:00:00 2001 From: mzz2017 Date: Mon, 3 Feb 2020 13:03:59 +0800 Subject: [PATCH] chore: replace v2ray/official with v2fly/v2fly-core --- README.md | 8 ++++---- docker-compose.dev.yml | 2 +- docker-compose.yml | 2 +- gui/src/components/node.vue | 2 +- service/main.go | 6 +++--- service/model/iptables/iptables.go | 4 +--- service/service/update.go | 29 +++-------------------------- service/tools/tools.go | 6 ++++++ 8 files changed, 20 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 4c37dcd7..1dc12d60 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ V2RayA 致力于提供最简单的操作,满足绝大部分需求。 # pull stable version of v2raya docker pull mzz2017/v2raya:stable # pull latest version of v2ray - docker pull v2ray/official + docker pull v2fly/v2fly-core # create volume to share data docker volume create v2raya_shared-data @@ -161,7 +161,7 @@ V2RayA 致力于提供最简单的操作,满足绝大部分需求。 -v v2raya_shared-data:/etc/v2ray \ --env V2RAY_LOCATION_ASSET=/etc/v2ray \ --name v2raya_v2ray \ - v2ray/official \ + v2fly/v2fly-core \ sh -c "cp -rfu /usr/bin/v2ray/* /etc/v2ray/ && v2ray -config=/etc/v2ray/config.json" ``` @@ -171,7 +171,7 @@ V2RayA 致力于提供最简单的操作,满足绝大部分需求。 # pull stable version of v2raya docker pull mzz2017/v2raya:stable # pull latest version of v2ray - docker pull v2ray/official + docker pull v2fly/v2fly-core # create volume to share data docker volume create v2raya_shared-data @@ -196,7 +196,7 @@ V2RayA 致力于提供最简单的操作,满足绝大部分需求。 -v v2raya_shared-data:/etc/v2ray \ --env V2RAY_LOCATION_ASSET=/etc/v2ray \ --name v2raya_v2ray \ - v2ray/official \ + v2fly/v2fly-core \ /bin/sh -c "cp -rfu /usr/bin/v2ray/* /etc/v2ray/ && v2ray -config=/etc/v2ray/config.json" ``` 部署完毕后,在[GUI demo](https://v2raya.mzz.pub)使用(或[部署GUI](https://github.com/mzz2017/V2RayA#%E5%A6%82%E4%BD%95%E9%83%A8%E7%BD%B2GUI))。 diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 6b32987b..c25a4759 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -17,7 +17,7 @@ services: network_mode: host # --network host pid: service:backend restart: always - image: "v2ray/official" + image: "v2fly/v2fly-core" environment: - V2RAY_LOCATION_ASSET=/etc/v2ray volumes: diff --git a/docker-compose.yml b/docker-compose.yml index 666f1a47..0a90746e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,7 +17,7 @@ services: network_mode: host # --network host pid: service:backend restart: always - image: "v2ray/official" + image: "v2fly/v2fly-core" environment: - V2RAY_LOCATION_ASSET=/etc/v2ray volumes: diff --git a/gui/src/components/node.vue b/gui/src/components/node.vue index 3850bc7f..cc50cf9d 100644 --- a/gui/src/components/node.vue +++ b/gui/src/components/node.vue @@ -515,7 +515,7 @@ export default { handleClickImport() { const that = this; this.$buefy.dialog.prompt({ - message: `填入ss/vmess/订阅地址`, + message: `填入ss/ssr/vmess/订阅地址`, inputAttrs: { type: "text", value: "" diff --git a/service/main.go b/service/main.go index efa08c1a..0398e9b7 100644 --- a/service/main.go +++ b/service/main.go @@ -40,7 +40,7 @@ func checkEnvironment() { if err != nil { log.Fatal(err) } - if occupied, which := ports.IsPortOccupied(port, "tcp", true); occupied && len(which) > 0 { + if occupied, which := ports.IsPortOccupied(port, "tcp", true); occupied { log.Fatalf("V2RayA启动失败,%v端口已被%v占用", port, which) } } @@ -123,11 +123,11 @@ func hello() { color.Red.Println("Version:", global.Version) } else { fmt.Println("V2RayA is running in Docker. Compatible mode starts up.") - fmt.Printf("%v\n", "Waiting for official/v2ray's running. Refer: https://github.com/mzz2017/V2RayA#docker%E6%96%B9%E5%BC%8F") + fmt.Printf("%v\n", "Waiting for container v2raya_v2ray's running. Refer: https://github.com/mzz2017/V2RayA#docker%E6%96%B9%E5%BC%8F") for !v2ray.IsV2RayProcessExists() { time.Sleep(1 * time.Second) } - fmt.Println("Container official/v2ray is ready.") + fmt.Println("Container v2raya_v2ray is ready.") } color.Red.Println("V2RayA is running at", global.GetEnvironmentConfig().Address) } diff --git a/service/model/iptables/iptables.go b/service/model/iptables/iptables.go index 32aee728..427fb0db 100644 --- a/service/model/iptables/iptables.go +++ b/service/model/iptables/iptables.go @@ -147,7 +147,7 @@ iptables -t mangle -A SETMARK -p udp --dport 53 -j RETURN iptables -t mangle -A SETMARK -p tcp --dport 53 -j RETURN ` } - commands += `iptables -t mangle -A SETMARK -d 0.0.0.0/32 -j RETURN + commands += ` iptables -t mangle -A SETMARK -d 10.0.0.0/8 -j RETURN iptables -t mangle -A SETMARK -d 100.64.0.0/10 -j RETURN iptables -t mangle -A SETMARK -d 127.0.0.0/8 -j RETURN @@ -171,8 +171,6 @@ iptables -t mangle -A SSTP_OUT -m mark --mark 0xff -j RETURN # 本机出方向规则,白名单端口 iptables -t mangle -A SSTP_OUT -p tcp -m multiport --sports {{TCP_PORTS}} -j RETURN iptables -t mangle -A SSTP_OUT -p udp -m multiport --sports {{UDP_PORTS}} -j RETURN -# 本机出方向白名单 -iptables -t mangle -A SSTP_OUT -d 1.0.0.1/32 -j RETURN # 本机发出去的 TCP 和 UDP 走一下 SETMARK 链 iptables -t mangle -A SSTP_OUT -p tcp -m mark ! --mark 1 -j SETMARK iptables -t mangle -A SSTP_OUT -p udp -m mark ! --mark 1 -j SETMARK diff --git a/service/service/update.go b/service/service/update.go index 5c14979c..50797659 100644 --- a/service/service/update.go +++ b/service/service/update.go @@ -2,10 +2,10 @@ package service import ( "V2RayA/global" + "V2RayA/tools" "bytes" "errors" "net/http" - "strconv" "strings" ) @@ -38,29 +38,6 @@ func CheckUpdate() (foundNew bool, remoteVersion string, err error) { } s = s[:r] // 远端版本获取完毕 - if strings.ToLower(global.Version) == "debug" { - return false, s, nil //debug模式无需检查更新 - } - local := strings.Split(global.Version, ".") - remote := strings.Split(s, ".") - mlen := len(local) - if len(remote) < mlen { - mlen = len(remote) - } - for i := 0; i < mlen; i++ { - lc, err := strconv.Atoi(local[i]) - if err != nil { - return false, "", err - } - rm, err := strconv.Atoi(remote[i]) - if err != nil { - return false, "", err - } - if lc < rm { //按节比较,某一节如果本地小于远端,则需要更新 - return true, s, nil - } else if lc > rm { //奇怪的事情,本地版本高于远端 - return false, "", errors.New("奇怪的事情发生了,本地版本高于远端") - } - } - return len(remote) > len(local), s, nil //如果前面都一样,远端版本号长度更长则需要更新 + ge, err := tools.VersionGreaterEqual(global.Version, s) + return !ge, s, err } diff --git a/service/tools/tools.go b/service/tools/tools.go index bf8c525c..e8543d89 100644 --- a/service/tools/tools.go +++ b/service/tools/tools.go @@ -21,6 +21,12 @@ func Min(a, b int) int { /* return if v1 is after v2 */ func VersionGreaterEqual(v1, v2 string) (is bool, err error) { + if v1 == "debug" { + return true, nil + } + if v2 == "debug" { + return false, nil + } a1 := strings.Split(v1, ".") a2 := strings.Split(v2, ".") l := Min(len(a1), len(a2))