fix: cycle import

This commit is contained in:
mzz2017 committed 2020-01-13 17:06:09 +08:00
1 parent 2bea52d352
commit c8d572039f
7 files changed
+14 -10

No files matched your search

+2 -1
View File
@@ -5,6 +5,7 @@ import (
"V2RayA/model/v2ray"
"V2RayA/service"
"V2RayA/tools"
"V2RayA/tools/httpClient"
"github.com/gin-gonic/gin"
)
@@ -27,7 +28,7 @@ func GetVersion(ctx *gin.Context) {
}
func GetRemoteGFWListVersion(ctx *gin.Context) {
c, err := tools.GetHttpClientAutomatically()
c, err := httpClient.GetHttpClientAutomatically()
if err != nil {
tools.ResponseError(ctx, err)
return
+3 -2
View File
@@ -6,6 +6,7 @@ import (
"V2RayA/model/v2ray"
"V2RayA/persistence/configure"
"V2RayA/tools"
"V2RayA/tools/httpClient"
"github.com/PuerkitoBio/goquery"
gonanoid "github.com/matoous/go-nanoid"
"github.com/pkg/errors"
@@ -16,7 +17,7 @@ import (
)
func GetRemoteGFWListUpdateTime(c *http.Client) (t time.Time, err error) {
resp, err := tools.HttpGetUsingSpecificClient(c, "https://github.com/ToutyRater/V2Ray-SiteDAT/contributors/master/geofiles/h2y.dat")
resp, err := httpClient.HttpGetUsingSpecificClient(c, "https://github.com/ToutyRater/V2Ray-SiteDAT/contributors/master/geofiles/h2y.dat")
if err != nil {
return
}
@@ -33,7 +34,7 @@ func GetRemoteGFWListUpdateTime(c *http.Client) (t time.Time, err error) {
return time.Parse(time.RFC3339, timeRaw)
}
func IsUpdate() (update bool, remoteTime time.Time, err error) {
c, err := tools.GetHttpClientAutomatically()
c, err := httpClient.GetHttpClientAutomatically()
if err != nil {
return
}
+2 -2
View File
@@ -5,7 +5,7 @@ import (
"V2RayA/model/touch"
"V2RayA/model/v2ray"
"V2RayA/persistence/configure"
"V2RayA/tools"
"V2RayA/tools/httpClient"
"errors"
"fmt"
"strings"
@@ -46,7 +46,7 @@ func Import(url string, which *configure.Which) (err error) {
if !strings.HasPrefix(url, "http://") && !strings.HasPrefix(url, "https://") {
url = "http://" + url
}
c, err := tools.GetHttpClientAutomatically()
c, err := httpClient.GetHttpClientAutomatically()
if err != nil {
return errors.New("尝试使用代理失败,建议修改设置为直连模式再试" + err.Error())
}
+2 -1
View File
@@ -7,6 +7,7 @@ import (
"V2RayA/model/vmessInfo"
"V2RayA/persistence/configure"
"V2RayA/tools"
"V2RayA/tools/httpClient"
"errors"
"fmt"
"net"
@@ -189,7 +190,7 @@ func TestHttpLatency(which []configure.Which, timeout time.Duration, maxParallel
return which, nil
}
func httpLatency(which *configure.Which, port string, timeout time.Duration) {
c, err := tools.GetHttpClientWithProxy("socks5://127.0.0.1:" + port)
c, err := httpClient.GetHttpClientWithProxy("socks5://127.0.0.1:" + port)
if err != nil {
which.Latency = err.Error()
return
+3 -2
View File
@@ -5,6 +5,7 @@ import (
"V2RayA/model/touch"
"V2RayA/persistence/configure"
"V2RayA/tools"
"V2RayA/tools/httpClient"
"bytes"
"errors"
"log"
@@ -18,7 +19,7 @@ func ResolveSubscription(source string) (infos []*nodeData.NodeData, err error)
func ResolveSubscriptionWithClient(source string, client *http.Client) (infos []*nodeData.NodeData, err error) {
// get请求source
res, err := tools.HttpGetUsingSpecificClient(client, source)
res, err := httpClient.HttpGetUsingSpecificClient(client, source)
if err != nil {
return
}
@@ -50,7 +51,7 @@ func ResolveSubscriptionWithClient(source string, client *http.Client) (infos []
func UpdateSubscription(index int, disconnectIfNecessary bool) (err error) {
subscriptions := configure.GetSubscriptions()
addr := subscriptions[index].Address
c, err := tools.GetHttpClientAutomatically()
c, err := httpClient.GetHttpClientAutomatically()
if err != nil {
reason := "尝试使用代理失败,建议修改设置为直连模式再试"
return errors.New(reason)
@@ -1,4 +1,4 @@
package tools
package httpClient
import (
"V2RayA/extra/proxyWithHttp"
@@ -1,4 +1,4 @@
package tools
package httpClient
import "net/http"