From ad718c81f697cb7aff082b96113dca312d3655aa Mon Sep 17 00:00:00 2001 From: mzz2017 Date: Wed, 26 Feb 2020 13:38:21 +0800 Subject: [PATCH] fix: panic when import some incorrect ssr subscriptions --- README.md | 4 +--- README_zh.md | 4 +--- service/service/resolve.go | 2 ++ service/service/subscription.go | 5 +---- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d1b388b5..c6f318b1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -[![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/mzz2017/v2raya)](https://hub.docker.com/r/mzz2017/v2raya) [![Travis (.org)](https://img.shields.io/travis/mzz2017/V2RayA?label=travis-ci%20build)](https://travis-ci.org/mzz2017/V2RayA) [![Netlify](https://img.shields.io/netlify/f93dbfa7-d14b-4968-a7a4-5e503d8bf5e5?label=netlify%20build)](https://app.netlify.com/sites/xenodochial-jepsen-122e9b/deploys) - -# V2RayA +# V2RayA [![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/mzz2017/v2raya)](https://hub.docker.com/r/mzz2017/v2raya) [![Travis (.org)](https://img.shields.io/travis/mzz2017/V2RayA?label=travis-ci%20build)](https://travis-ci.org/mzz2017/V2RayA) [![Netlify](https://img.shields.io/netlify/f93dbfa7-d14b-4968-a7a4-5e503d8bf5e5?label=netlify%20build)](https://app.netlify.com/sites/xenodochial-jepsen-122e9b/deploys) [**English**](https://github.com/mzz2017/V2RayA/blob/master/README.md)   [**简体中文**](https://github.com/mzz2017/V2RayA/blob/master/README_zh.md) diff --git a/README_zh.md b/README_zh.md index 503bd2e8..8bb6e6f1 100644 --- a/README_zh.md +++ b/README_zh.md @@ -1,6 +1,4 @@ -[![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/mzz2017/v2raya)](https://hub.docker.com/r/mzz2017/v2raya) [![Travis (.org)](https://img.shields.io/travis/mzz2017/V2RayA?label=travis-ci%20build)](https://travis-ci.org/mzz2017/V2RayA) [![Netlify](https://img.shields.io/netlify/f93dbfa7-d14b-4968-a7a4-5e503d8bf5e5?label=netlify%20build)](https://app.netlify.com/sites/xenodochial-jepsen-122e9b/deploys) - -# V2RayA +# V2RayA [![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/mzz2017/v2raya)](https://hub.docker.com/r/mzz2017/v2raya) [![Travis (.org)](https://img.shields.io/travis/mzz2017/V2RayA?label=travis-ci%20build)](https://travis-ci.org/mzz2017/V2RayA) [![Netlify](https://img.shields.io/netlify/f93dbfa7-d14b-4968-a7a4-5e503d8bf5e5?label=netlify%20build)](https://app.netlify.com/sites/xenodochial-jepsen-122e9b/deploys) [**English**](https://github.com/mzz2017/V2RayA/blob/master/README.md)   [**简体中文**](https://github.com/mzz2017/V2RayA/blob/master/README_zh.md) diff --git a/service/service/resolve.go b/service/service/resolve.go index 14eb39c9..31cfeeac 100644 --- a/service/service/resolve.go +++ b/service/service/resolve.go @@ -190,6 +190,8 @@ func ResolveSSRURL(u string) (data *nodeData.NodeData, err error) { //如果长度多于6,说明host中包含字符:,重新合并前几个分组到host去 pre[len(pre)-6] = strings.Join(pre[:len(pre)-5], ":") pre = pre[len(pre)-6:] + } else if len(pre) < 6 { + return v, false } q, err := url.ParseQuery(arr[1]) if err != nil { diff --git a/service/service/subscription.go b/service/service/subscription.go index fe2d3fc7..1355e93a 100644 --- a/service/service/subscription.go +++ b/service/service/subscription.go @@ -27,10 +27,7 @@ func ResolveSubscriptionWithClient(source string, client *http.Client) (infos [] _, _ = buf.ReadFrom(res.Body) defer res.Body.Close() // base64解码, raw是多行vmess - raw, err := tools.Base64StdDecode(buf.String()) - if err != nil { - return - } + raw, _ := tools.Base64StdDecode(buf.String()) // 切分raw rows := strings.Split(strings.TrimSpace(raw), "\n") // 解析