-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from yiguous/main
Update Xray-core to 1.8.5
- Loading branch information
Showing
11 changed files
with
166 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,58 @@ | ||
module github.com/xtls/libxray | ||
|
||
go 1.21.1 | ||
go 1.21.4 | ||
|
||
require ( | ||
github.com/xtls/xray-core v1.8.4 | ||
google.golang.org/grpc v1.57.0 | ||
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.5 // indirect | ||
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/mock v1.6.0 // indirect | ||
github.com/golang/protobuf v1.5.3 // indirect | ||
github.com/google/btree v1.1.2 // indirect | ||
github.com/google/pprof v0.0.0-20230821062121-407c9e7a662f // indirect | ||
github.com/gorilla/websocket v1.5.0 // indirect | ||
github.com/klauspost/compress v1.16.7 // indirect | ||
github.com/klauspost/cpuid/v2 v2.2.5 // indirect | ||
github.com/onsi/ginkgo/v2 v2.12.0 // 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.3.3 // indirect | ||
github.com/quic-go/quic-go v0.38.1 // indirect | ||
github.com/refraction-networking/utls v1.4.3 // 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.9 // indirect | ||
github.com/sagernet/sing-shadowsocks v0.2.4 // indirect | ||
github.com/sagernet/wireguard-go v0.0.0-20221116151939-c99467f53f2c // 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/xtls/reality v0.0.0-20230828171259-e426190d57f6 // indirect | ||
go.uber.org/atomic v1.11.0 // 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.14.0 // indirect | ||
golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 // indirect | ||
golang.org/x/mobile v0.0.0-20231006135142-2b44d11868fe // indirect | ||
golang.org/x/mod v0.13.0 // indirect | ||
golang.org/x/net v0.16.0 // indirect | ||
golang.org/x/sync v0.4.0 // indirect | ||
golang.org/x/sys v0.13.0 // indirect | ||
golang.org/x/text v0.13.0 // indirect | ||
golang.org/x/time v0.3.0 // indirect | ||
golang.org/x/tools v0.14.0 // indirect | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // 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-20230822212503-5bf4e5f98744 // indirect | ||
gvisor.dev/gvisor v0.0.0-20231104011432-48a6d7d5bd0b // indirect | ||
lukechampine.com/blake3 v1.2.1 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package libXray | ||
package xray | ||
|
||
import ( | ||
"encoding/json" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package libXray | ||
package xray | ||
|
||
import ( | ||
"encoding/json" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package libXray | ||
package xray | ||
|
||
import ( | ||
"context" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package libXray | ||
package xray | ||
|
||
import ( | ||
"github.com/xtls/xray-core/common/uuid" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// libXray is an Xray wrapper focusing on improving the experience of Xray-core mobile development. | ||
package libXray | ||
|
||
import ( | ||
"github.com/xtls/libxray/xray" | ||
) | ||
|
||
// Read geo data and cut the codes we need. | ||
// datDir means the dir which geo dat are in. | ||
// dstDir means the dir which new geo dat are in. | ||
// cutCodePath means geoCutCode json file path | ||
// | ||
// This function is used to reduce memory when init instance. | ||
// You can cut the country codes which rules and nameservers contain. | ||
func CutGeoData(datDir string, dstDir string, cutCodePath string) string { | ||
return xray.CutGeoData(datDir, dstDir, cutCodePath) | ||
} | ||
|
||
// Read geo data and write all codes to text file. | ||
// datDir means the dir which geo dat are in. | ||
// name means the geo dat file name, like "geosite", "geoip" | ||
// geoType must be the value of geoType | ||
func LoadGeoData(datDir string, name string, geoType string) string { | ||
return xray.LoadGeoData(datDir, name, geoType) | ||
} | ||
|
||
// Ping Xray config and find the delay and country code of its outbound. | ||
// datDir means the dir which geosite.dat and geoip.dat are in. | ||
// configPath means the config.json file path. | ||
// timeout means how long the http request will be cancelled if no response, in units of seconds. | ||
// url means the website we use to test speed. "https://www.google.com" is a good choice for most cases. | ||
// times means how many times we should test the url. | ||
// proxy means the local http/socks5 proxy, like "socks5://[::1]:1080". | ||
func Ping(datDir string, configPath string, timeout int, url string, times int, proxy string) string { | ||
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. | ||
func QueryStats(server string, dir string) string { | ||
return xray.QueryStats(server, dir) | ||
} | ||
|
||
// convert text to uuid | ||
func CustomUUID(text string) string { | ||
return xray.CustomUUID(text) | ||
} | ||
|
||
// Test Xray Config. | ||
// datDir means the dir which geosite.dat and geoip.dat are in. | ||
// configPath means the config.json file path. | ||
func TestXray(datDir string, configPath string) string { | ||
return xray.TestXray(datDir, configPath) | ||
} | ||
|
||
// Run Xray instance. | ||
// datDir means the dir which geosite.dat and geoip.dat are in. | ||
// configPath means the config.json file path. | ||
// maxMemory means the soft memory limit of golang, see SetMemoryLimit to find more information. | ||
func RunXray(datDir string, configPath string, maxMemory int64) string { | ||
return xray.RunXray(datDir, configPath, maxMemory) | ||
} | ||
|
||
// Stop Xray instance. | ||
func StopXray() string { | ||
return xray.StopXray() | ||
} | ||
|
||
// Xray's version | ||
func XrayVersion() string { | ||
return xray.XrayVersion() | ||
} |