From ec3af8aaeab1201d7da517b1d2b49ff55b78b466 Mon Sep 17 00:00:00 2001 From: bense Date: Sun, 13 Oct 2024 17:14:07 +0800 Subject: [PATCH] =?UTF-8?q?ip=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- docs/TdxProtocol.md => TdxProtocol.md | 0 client_test.go | 4 ++-- docs/ip.show | 19 ------------------- examples/main.go | 3 ++- options.go | 11 +++++++++-- 6 files changed, 15 insertions(+), 25 deletions(-) rename docs/TdxProtocol.md => TdxProtocol.md (100%) delete mode 100644 docs/ip.show diff --git a/README.md b/README.md index 0d4f970..44ad7e9 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,8 @@ import ( ) func main() { - tdx := gotdx.New(gotdx.WithTCPAddress("119.147.212.81:7709")) + // ip地址如果失效,请自行替换 + tdx := gotdx.New(gotdx.WithTCPAddress("124.71.187.122:7709")) _, err := tdx.Connect() if err != nil { log.Fatalln(err) diff --git a/docs/TdxProtocol.md b/TdxProtocol.md similarity index 100% rename from docs/TdxProtocol.md rename to TdxProtocol.md diff --git a/client_test.go b/client_test.go index e75c57e..289f6ca 100644 --- a/client_test.go +++ b/client_test.go @@ -7,7 +7,7 @@ import ( ) func newClient() *Client { - tdx := New(WithTCPAddress("119.147.212.81:7709")) + tdx := New(WithTCPAddress("124.71.187.122:7709")) reply, err := tdx.Connect() if err != nil { fmt.Println(err) @@ -18,7 +18,7 @@ func newClient() *Client { func Test_tdx_Connect(t *testing.T) { fmt.Println("================ Connect ================") - tdx := New(WithTCPAddress("119.147.212.81:7709")) + tdx := New(WithTCPAddress("124.71.187.122:7709")) defer tdx.Disconnect() reply, err := tdx.Connect() if err != nil { diff --git a/docs/ip.show b/docs/ip.show deleted file mode 100644 index cc846f4..0000000 --- a/docs/ip.show +++ /dev/null @@ -1,19 +0,0 @@ -˫վ1 120.79.60.82 7709 -˫վ2 8.129.13.54 7709 -˫վ3 120.24.149.49 7709 -˫վ4 47.113.94.204 7709 -˫վ5 8.129.174.169 7709 -˫վ6 47.113.123.248 7709 -Ϻ˫վ1 47.103.48.45 7709 -Ϻ˫վ2 47.100.236.28 7709 -Ϻ˫վ3 101.133.214.242 7709 -Ϻ˫վ4 47.116.21.80 7709 -Ϻ˫վ5 47.116.105.28 7709 -Ϻ˫վ6 47.116.10.29 7709 -˫վ1 39.98.234.173 7709 -˫վ2 39.98.198.249 7709 -˫վ3 39.100.68.59 7709 -ݸվ 113.105.142.162 7721 -˫վ1 106.53.96.220 7709 -˫վ2 106.53.99.72 7709 -˫վ3 106.55.12.89 7709 \ No newline at end of file diff --git a/examples/main.go b/examples/main.go index ff93bc9..030bbb2 100644 --- a/examples/main.go +++ b/examples/main.go @@ -6,7 +6,8 @@ import ( ) func main() { - tdx := gotdx.New(gotdx.WithTCPAddress("119.147.212.81:7709")) + // ip地址如果失效,请自行替换 + tdx := gotdx.New(gotdx.WithTCPAddress("124.71.187.122:7709")) _, err := tdx.Connect() if err != nil { log.Fatalln(err) diff --git a/options.go b/options.go index b3b8454..c5ca001 100644 --- a/options.go +++ b/options.go @@ -6,8 +6,9 @@ const ( ) type Options struct { - TCPAddress string // 服务器地址 - MaxRetryTimes int // 重试次数 + TCPAddress string // 服务器地址 + TCPAddressPool []string // 服务器地址池 + MaxRetryTimes int // 重试次数 } func defaultOptions() *Options { @@ -32,3 +33,9 @@ func WithTCPAddress(tcpAddress string) Option { o.TCPAddress = tcpAddress } } + +func WithTCPAddressPool(ips ...string) Option { + return func(o *Options) { + o.TCPAddressPool = ips + } +}