From 9d059fb22204bcbf91436d3b5ea8ec84fb9da13e Mon Sep 17 00:00:00 2001 From: yiguo Date: Fri, 17 Nov 2023 10:58:47 +0800 Subject: [PATCH] update Xray-core to 1.8.5 --- go.mod | 57 ++++++++++++++++++++++++++++++++++++++++++++++++- xray/ping.go | 4 ++-- xray_wrapper.go | 4 ++++ 3 files changed, 62 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 8aabf0f..ba2067a 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,58 @@ module github.com/xtls/libxray -go 1.21.3 +go 1.21.4 + +require ( + github.com/xtls/xray-core v1.8.5 + google.golang.org/grpc v1.59.0 + google.golang.org/protobuf v1.31.0 + gopkg.in/yaml.v3 v3.0.1 +) + +require ( + github.com/andybalholm/brotli v1.0.6 // indirect + github.com/cloudflare/circl v1.3.6 // indirect + github.com/dgryski/go-metro v0.0.0-20211217172704-adc40b04c140 // indirect + github.com/francoispqt/gojay v1.2.13 // indirect + github.com/gaukas/godicttls v0.0.4 // indirect + github.com/ghodss/yaml v1.0.1-0.20220118164431-d8423dcdf344 // indirect + github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/btree v1.1.2 // indirect + github.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a // indirect + github.com/gorilla/websocket v1.5.1 // indirect + github.com/klauspost/compress v1.17.2 // indirect + github.com/klauspost/cpuid/v2 v2.2.6 // indirect + github.com/onsi/ginkgo/v2 v2.13.1 // indirect + github.com/pelletier/go-toml v1.9.5 // indirect + github.com/pires/go-proxyproto v0.7.0 // indirect + github.com/quic-go/qtls-go1-20 v0.4.1 // indirect + github.com/quic-go/quic-go v0.40.0 // indirect + github.com/refraction-networking/utls v1.5.4 // indirect + github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect + github.com/sagernet/sing v0.2.17 // indirect + github.com/sagernet/sing-shadowsocks v0.2.5 // indirect + github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb // indirect + github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e // indirect + github.com/vishvananda/netlink v1.2.1-beta.2.0.20230316163032-ced5aaba43e3 // indirect + github.com/vishvananda/netns v0.0.4 // indirect + github.com/xtls/reality v0.0.0-20231112171332-de1173cf2b19 // indirect + go.uber.org/mock v0.3.0 // indirect + go4.org/netipx v0.0.0-20230824141953-6213f710f925 // indirect + golang.org/x/crypto v0.15.0 // indirect + golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect + golang.org/x/mobile v0.0.0-20231108233038-35478a0c49da // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.18.0 // indirect + golang.org/x/sync v0.5.0 // indirect + golang.org/x/sys v0.14.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/time v0.4.0 // indirect + golang.org/x/tools v0.15.0 // indirect + golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect + golang.zx2c4.com/wireguard v0.0.0-20231022001213-2e0774f246fb // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gvisor.dev/gvisor v0.0.0-20231104011432-48a6d7d5bd0b // indirect + lukechampine.com/blake3 v1.2.1 // indirect +) diff --git a/xray/ping.go b/xray/ping.go index 46d710b..4db9706 100644 --- a/xray/ping.go +++ b/xray/ping.go @@ -36,7 +36,7 @@ func Ping(datDir string, configPath string, timeout int, url string, times int, } country := "" if len(ip) != 0 { - code, err := findCountryCodeOfIp(datDir, ip) + code, err := FindCountryCodeOfIp(datDir, ip) if err == nil { country = code } @@ -53,7 +53,7 @@ func TcpPing(timeout int, server string, times int) string { return nodep.TcpPing(timeout, server, times) } -func findCountryCodeOfIp(datDir string, ipAddress string) (string, error) { +func FindCountryCodeOfIp(datDir string, ipAddress string) (string, error) { datPath := path.Join(datDir, "geoip.dat") geoipBytes, err := os.ReadFile(datPath) if err != nil { diff --git a/xray_wrapper.go b/xray_wrapper.go index 17c4d4c..b532314 100644 --- a/xray_wrapper.go +++ b/xray_wrapper.go @@ -35,6 +35,10 @@ func Ping(datDir string, configPath string, timeout int, url string, times int, return xray.Ping(datDir, configPath, timeout, url, times, proxy) } +func FindCountryCodeOfIp(datDir string, ipAddress string) (string, error) { + return xray.FindCountryCodeOfIp(datDir, ipAddress) +} + // query system stats and outbound stats. // server means The API server address, like "127.0.0.1:8080". // dir means the dir which result json will be wrote to.