mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-08-23 01:56:48 +08:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b277bacdf6 | ||
![]() |
9288a7c0dc | ||
![]() |
c40fc44a34 | ||
![]() |
02cd3b8c74 | ||
![]() |
a7e198e1e2 | ||
![]() |
9e6d7a3cb0 | ||
![]() |
a4bc422ed1 | ||
![]() |
59819e2a1b | ||
![]() |
573fb4f643 |
18
.github/workflows/release.yml
vendored
18
.github/workflows/release.yml
vendored
@@ -78,6 +78,9 @@ jobs:
|
||||
# Include amd64 on all platforms.
|
||||
goos: [windows, freebsd, openbsd, linux, darwin]
|
||||
goarch: [amd64, 386]
|
||||
gotoolchain: [""]
|
||||
patch-assetname: [""]
|
||||
|
||||
exclude:
|
||||
# Exclude i386 on darwin
|
||||
- goarch: 386
|
||||
@@ -152,6 +155,16 @@ jobs:
|
||||
goarch: arm
|
||||
goarm: 7
|
||||
# END OPENBSD ARM
|
||||
# BEGIN Windows 7
|
||||
- goos: windows
|
||||
goarch: amd64
|
||||
gotoolchain: 1.21.4
|
||||
patch-assetname: win7-64
|
||||
- goos: windows
|
||||
goarch: 386
|
||||
gotoolchain: 1.21.4
|
||||
patch-assetname: win7-32
|
||||
# END Windows 7
|
||||
fail-fast: false
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
@@ -166,14 +179,15 @@ jobs:
|
||||
|
||||
- name: Show workflow information
|
||||
run: |
|
||||
export _NAME=$(jq ".[\"$GOOS-$GOARCH$GOARM$GOMIPS\"].friendlyName" -r < .github/build/friendly-filenames.json)
|
||||
_NAME=${{ matrix.patch-assetname }}
|
||||
[ -n "$_NAME" ] || _NAME=$(jq ".[\"$GOOS-$GOARCH$GOARM$GOMIPS\"].friendlyName" -r < .github/build/friendly-filenames.json)
|
||||
echo "GOOS: $GOOS, GOARCH: $GOARCH, GOARM: $GOARM, GOMIPS: $GOMIPS, RELEASE_NAME: $_NAME"
|
||||
echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
go-version: ${{ matrix.gotoolchain || '1.22' }}
|
||||
check-latest: true
|
||||
|
||||
- name: Get project dependencies
|
||||
|
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -32,7 +32,7 @@ jobs:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
go-version: '1.22'
|
||||
check-latest: true
|
||||
- name: Restore Cache
|
||||
uses: actions/cache/restore@v4
|
||||
|
13
README.md
13
README.md
@@ -27,8 +27,7 @@
|
||||
- [ghcr.io/xtls/xray-core](https://ghcr.io/xtls/xray-core) (**Official**)
|
||||
- [teddysun/xray](https://hub.docker.com/r/teddysun/xray)
|
||||
- Web Panel
|
||||
- [X-UI-English](https://github.com/NidukaAkalanka/x-ui-english), [3X-UI](https://github.com/MHSanaei/3x-ui), [X-UI](https://github.com/alireza0/x-ui), [X-UI](https://github.com/diditra/x-ui)
|
||||
- [Xray-UI](https://github.com/qist/xray-ui), [X-UI](https://github.com/sing-web/x-ui)
|
||||
- [3X-UI](https://github.com/MHSanaei/3x-ui), [X-UI](https://github.com/alireza0/x-ui), [Xray-UI](https://github.com/qist/xray-ui)
|
||||
- [Hiddify](https://github.com/hiddify/hiddify-config)
|
||||
- [Marzban](https://github.com/Gozargah/Marzban)
|
||||
- [Libertea](https://github.com/VZiChoushaDui/Libertea)
|
||||
@@ -67,13 +66,10 @@
|
||||
- [luci-app-xray](https://github.com/yichya/luci-app-xray) ([openwrt-xray](https://github.com/yichya/openwrt-xray))
|
||||
- Windows
|
||||
- [v2rayN](https://github.com/2dust/v2rayN)
|
||||
- [NekoRay](https://github.com/Matsuridayo/nekoray)
|
||||
- [Furious](https://github.com/LorenEteval/Furious)
|
||||
- [HiddifyN](https://github.com/hiddify/HiddifyN)
|
||||
- [Invisible Man - Xray](https://github.com/InvisibleManVPN/InvisibleMan-XRayClient)
|
||||
- Android
|
||||
- [v2rayNG](https://github.com/2dust/v2rayNG)
|
||||
- [HiddifyNG](https://github.com/hiddify/HiddifyNG)
|
||||
- [X-flutter](https://github.com/XTLS/X-flutter)
|
||||
- iOS & macOS arm64
|
||||
- [FoXray](https://apps.apple.com/app/foxray/id6448898396)
|
||||
@@ -85,7 +81,6 @@
|
||||
- [FoXray](https://apps.apple.com/app/foxray/id6448898396)
|
||||
- Linux
|
||||
- [v2rayA](https://github.com/v2rayA/v2rayA)
|
||||
- [NekoRay](https://github.com/Matsuridayo/nekoray)
|
||||
- [Furious](https://github.com/LorenEteval/Furious)
|
||||
|
||||
## Others that support VLESS, XTLS, REALITY, XUDP, PLUX...
|
||||
@@ -98,21 +93,15 @@
|
||||
- [XTLS/libXray](https://github.com/XTLS/libXray)
|
||||
- [xtlsapi](https://github.com/hiddify/xtlsapi)
|
||||
- [AndroidLibXrayLite](https://github.com/2dust/AndroidLibXrayLite)
|
||||
- [XrayKit](https://github.com/arror/XrayKit)
|
||||
- [Xray-core-python](https://github.com/LorenEteval/Xray-core-python)
|
||||
- [xray-api](https://github.com/XVGuardian/xray-api)
|
||||
- [XrayR](https://github.com/XrayR-project/XrayR)
|
||||
- [XrayR-release](https://github.com/XrayR-project/XrayR-release)
|
||||
- [XrayR-V2Board](https://github.com/missuo/XrayR-V2Board)
|
||||
- [Clash.Meta](https://github.com/MetaCubeX/Clash.Meta)
|
||||
- [Clash Verge](https://github.com/zzzgydi/clash-verge)
|
||||
- [clashN](https://github.com/2dust/clashN)
|
||||
- [Clash Meta for Android](https://github.com/MetaCubeX/ClashMetaForAndroid)
|
||||
- [meta_for_ios](https://t.me/meta_for_ios)
|
||||
- [sing-box](https://github.com/SagerNet/sing-box)
|
||||
- [installReality](https://github.com/BoxXt/installReality)
|
||||
- [sbox-reality](https://github.com/Misaka-blog/sbox-reality)
|
||||
- [sing-box-for-ios](https://github.com/SagerNet/sing-box-for-ios)
|
||||
|
||||
## Contributing
|
||||
|
||||
|
@@ -151,7 +151,7 @@ func LogInfo(ctx context.Context, msg ...interface{}) {
|
||||
}
|
||||
|
||||
func LogInfoInner(ctx context.Context, inner error, msg ...interface{}) {
|
||||
doLog(ctx, inner, log.Severity_Debug, msg...)
|
||||
doLog(ctx, inner, log.Severity_Info, msg...)
|
||||
}
|
||||
|
||||
func LogWarning(ctx context.Context, msg ...interface{}) {
|
||||
@@ -159,7 +159,7 @@ func LogWarning(ctx context.Context, msg ...interface{}) {
|
||||
}
|
||||
|
||||
func LogWarningInner(ctx context.Context, inner error, msg ...interface{}) {
|
||||
doLog(ctx, inner, log.Severity_Debug, msg...)
|
||||
doLog(ctx, inner, log.Severity_Warning, msg...)
|
||||
}
|
||||
|
||||
func LogError(ctx context.Context, msg ...interface{}) {
|
||||
@@ -167,7 +167,7 @@ func LogError(ctx context.Context, msg ...interface{}) {
|
||||
}
|
||||
|
||||
func LogErrorInner(ctx context.Context, inner error, msg ...interface{}) {
|
||||
doLog(ctx, inner, log.Severity_Debug, msg...)
|
||||
doLog(ctx, inner, log.Severity_Error, msg...)
|
||||
}
|
||||
|
||||
func doLog(ctx context.Context, inner error, severity log.Severity, msg ...interface{}) {
|
||||
|
@@ -21,7 +21,7 @@ import (
|
||||
var (
|
||||
Version_x byte = 1
|
||||
Version_y byte = 8
|
||||
Version_z byte = 17
|
||||
Version_z byte = 19
|
||||
)
|
||||
|
||||
var (
|
||||
|
5
go.mod
5
go.mod
@@ -1,6 +1,6 @@
|
||||
module github.com/xtls/xray-core
|
||||
|
||||
go 1.22
|
||||
go 1.21.4
|
||||
|
||||
require (
|
||||
github.com/OmarTariq612/goech v0.0.0-20240405204721-8e2e1dafd3a0
|
||||
@@ -16,7 +16,7 @@ require (
|
||||
github.com/refraction-networking/utls v1.6.7
|
||||
github.com/sagernet/sing v0.4.1
|
||||
github.com/sagernet/sing-shadowsocks v0.2.7
|
||||
github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb
|
||||
github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e
|
||||
github.com/vishvananda/netlink v1.2.1-beta.2.0.20230316163032-ced5aaba43e3
|
||||
@@ -46,6 +46,7 @@ require (
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
||||
github.com/onsi/ginkgo/v2 v2.19.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/quic-go/qpack v0.4.0 // indirect
|
||||
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect
|
||||
github.com/vishvananda/netns v0.0.4 // indirect
|
||||
go.uber.org/mock v0.4.0 // indirect
|
||||
|
6
go.sum
6
go.sum
@@ -110,6 +110,8 @@ github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP
|
||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
||||
github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
|
||||
github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A=
|
||||
github.com/quic-go/quic-go v0.45.1 h1:tPfeYCk+uZHjmDRwHHQmvHRYL2t44ROTujLeFVBmjCA=
|
||||
github.com/quic-go/quic-go v0.45.1/go.mod h1:1dLehS7TIR64+vxGR70GDcatWTOtMX2PUtnKsjbTurI=
|
||||
github.com/refraction-networking/utls v1.6.7 h1:zVJ7sP1dJx/WtVuITug3qYUq034cDq9B2MR1K67ULZM=
|
||||
@@ -121,8 +123,8 @@ github.com/sagernet/sing v0.4.1 h1:zVlpE+7k7AFoC2pv6ReqLf0PIHjihL/jsBl5k05PQFk=
|
||||
github.com/sagernet/sing v0.4.1/go.mod h1:ieZHA/+Y9YZfXs2I3WtuwgyCZ6GPsIR7HdKb1SdEnls=
|
||||
github.com/sagernet/sing-shadowsocks v0.2.7 h1:zaopR1tbHEw5Nk6FAkM05wCslV6ahVegEZaKMv9ipx8=
|
||||
github.com/sagernet/sing-shadowsocks v0.2.7/go.mod h1:0rIKJZBR65Qi0zwdKezt4s57y/Tl1ofkaq6NlkzVuyE=
|
||||
github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb h1:XfLJSPIOUX+osiMraVgIrMR27uMXnRJWGm1+GL8/63U=
|
||||
github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb/go.mod h1:bR6DqgcAl1zTcOX8/pE2Qkj9XO00eCNqmKb7lXP8EAg=
|
||||
github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771 h1:emzAzMZ1L9iaKCTxdy3Em8Wv4ChIAGnfiz18Cda70g4=
|
||||
github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771/go.mod h1:bR6DqgcAl1zTcOX8/pE2Qkj9XO00eCNqmKb7lXP8EAg=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY=
|
||||
github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM=
|
||||
|
@@ -151,7 +151,7 @@ func TestDialWithRemoteAddr(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = c.Write([]byte("Response"))
|
||||
_, err = c.Write([]byte(c.RemoteAddr().String()))
|
||||
common.Must(err)
|
||||
}(conn)
|
||||
})
|
||||
@@ -169,7 +169,7 @@ func TestDialWithRemoteAddr(t *testing.T) {
|
||||
var b [1024]byte
|
||||
n, err := conn.Read(b[:])
|
||||
common.Must(err)
|
||||
if string(b[:n]) != "Response" {
|
||||
if string(b[:n]) != "1.1.1.1:0" {
|
||||
t.Error("response: ", string(b[:n]))
|
||||
}
|
||||
|
||||
|
@@ -32,6 +32,7 @@ type DefaultDialerClient struct {
|
||||
download *http.Client
|
||||
upload *http.Client
|
||||
isH2 bool
|
||||
isH3 bool
|
||||
// pool of net.Conn, created using dialUploadConn
|
||||
uploadRawPool *sync.Pool
|
||||
dialUploadConn func(ctxInner context.Context) (net.Conn, error)
|
||||
@@ -118,7 +119,7 @@ func (c *DefaultDialerClient) SendUploadRequest(ctx context.Context, url string,
|
||||
}
|
||||
req.Header = c.transportConfig.GetRequestHeader()
|
||||
|
||||
if c.isH2 {
|
||||
if c.isH2 || c.isH3 {
|
||||
resp, err := c.upload.Do(req)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@@ -10,6 +10,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/quic-go/quic-go"
|
||||
"github.com/quic-go/quic-go/http3"
|
||||
"github.com/xtls/xray-core/common"
|
||||
"github.com/xtls/xray-core/common/buf"
|
||||
"github.com/xtls/xray-core/common/errors"
|
||||
@@ -50,12 +52,9 @@ func getHTTPClient(ctx context.Context, dest net.Destination, streamSettings *in
|
||||
return client
|
||||
}
|
||||
|
||||
if browser_dialer.HasBrowserDialer() {
|
||||
return &BrowserDialerClient{}
|
||||
}
|
||||
|
||||
tlsConfig := tls.ConfigFromStreamSettings(streamSettings)
|
||||
isH2 := tlsConfig != nil && !(len(tlsConfig.NextProtocol) == 1 && tlsConfig.NextProtocol[0] == "http/1.1")
|
||||
isH3 := tlsConfig != nil && (len(tlsConfig.NextProtocol) == 1 && tlsConfig.NextProtocol[0] == "h3")
|
||||
|
||||
var gotlsConfig *gotls.Config
|
||||
|
||||
@@ -83,10 +82,35 @@ func getHTTPClient(ctx context.Context, dest net.Destination, streamSettings *in
|
||||
return conn, nil
|
||||
}
|
||||
|
||||
var uploadTransport http.RoundTripper
|
||||
var downloadTransport http.RoundTripper
|
||||
var uploadTransport http.RoundTripper
|
||||
|
||||
if isH2 {
|
||||
if isH3 {
|
||||
dest.Network = net.Network_UDP
|
||||
quicConfig := &quic.Config{
|
||||
HandshakeIdleTimeout: 10 * time.Second,
|
||||
MaxIdleTimeout: 90 * time.Second,
|
||||
KeepAlivePeriod: 3 * time.Second,
|
||||
Allow0RTT: true,
|
||||
}
|
||||
roundTripper := &http3.RoundTripper{
|
||||
TLSClientConfig: gotlsConfig,
|
||||
QUICConfig: quicConfig,
|
||||
Dial: func(ctx context.Context, addr string, tlsCfg *gotls.Config, cfg *quic.Config) (quic.EarlyConnection, error) {
|
||||
conn, err := internet.DialSystem(ctx, dest, streamSettings.SocketSettings)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
udpAddr, err := net.ResolveUDPAddr("udp", conn.RemoteAddr().String())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return quic.DialEarly(ctx, conn.(*internet.PacketConnWrapper).Conn.(*net.UDPConn), udpAddr, tlsCfg, cfg)
|
||||
},
|
||||
}
|
||||
downloadTransport = roundTripper
|
||||
uploadTransport = roundTripper
|
||||
} else if isH2 {
|
||||
downloadTransport = &http2.Transport{
|
||||
DialTLSContext: func(ctxInner context.Context, network string, addr string, cfg *gotls.Config) (net.Conn, error) {
|
||||
return dialContext(ctxInner)
|
||||
@@ -107,7 +131,6 @@ func getHTTPClient(ctx context.Context, dest net.Destination, streamSettings *in
|
||||
// http.Client and our custom dial context.
|
||||
DisableKeepAlives: true,
|
||||
}
|
||||
|
||||
// we use uploadRawPool for that
|
||||
uploadTransport = nil
|
||||
}
|
||||
@@ -121,6 +144,7 @@ func getHTTPClient(ctx context.Context, dest net.Destination, streamSettings *in
|
||||
Transport: uploadTransport,
|
||||
},
|
||||
isH2: isH2,
|
||||
isH3: isH3,
|
||||
uploadRawPool: &sync.Pool{},
|
||||
dialUploadConn: dialContext,
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@ type requestHandler struct {
|
||||
host string
|
||||
path string
|
||||
ln *Listener
|
||||
sessionMu *sync.Mutex
|
||||
sessions sync.Map
|
||||
localAddr gonet.TCPAddr
|
||||
}
|
||||
@@ -56,11 +57,21 @@ func (h *requestHandler) maybeReapSession(isFullyConnected *done.Instance, sessi
|
||||
}
|
||||
|
||||
func (h *requestHandler) upsertSession(sessionId string) *httpSession {
|
||||
// fast path
|
||||
currentSessionAny, ok := h.sessions.Load(sessionId)
|
||||
if ok {
|
||||
return currentSessionAny.(*httpSession)
|
||||
}
|
||||
|
||||
// slow path
|
||||
h.sessionMu.Lock()
|
||||
defer h.sessionMu.Unlock()
|
||||
|
||||
currentSessionAny, ok = h.sessions.Load(sessionId)
|
||||
if ok {
|
||||
return currentSessionAny.(*httpSession)
|
||||
}
|
||||
|
||||
s := &httpSession{
|
||||
uploadQueue: NewUploadQueue(int(2 * h.ln.config.GetNormalizedMaxConcurrentUploads())),
|
||||
isFullyConnected: done.New(),
|
||||
@@ -277,6 +288,7 @@ func ListenSH(ctx context.Context, address net.Address, port net.Port, streamSet
|
||||
host: shSettings.Host,
|
||||
path: shSettings.GetNormalizedPath(),
|
||||
ln: l,
|
||||
sessionMu: &sync.Mutex{},
|
||||
sessions: sync.Map{},
|
||||
localAddr: localAddr,
|
||||
}
|
||||
|
@@ -63,8 +63,8 @@ func Test_listenSHAndDial(t *testing.T) {
|
||||
}
|
||||
|
||||
common.Must(conn.Close())
|
||||
<-time.After(time.Second * 5)
|
||||
conn, err = Dial(ctx, net.TCPDestination(net.DomainAddress("localhost"), listenPort), streamSettings)
|
||||
|
||||
common.Must(err)
|
||||
_, err = conn.Write([]byte("Test connection 2"))
|
||||
common.Must(err)
|
||||
@@ -96,7 +96,7 @@ func TestDialWithRemoteAddr(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = c.Write([]byte("Response"))
|
||||
_, err = c.Write([]byte(c.RemoteAddr().String()))
|
||||
common.Must(err)
|
||||
}(conn)
|
||||
})
|
||||
@@ -113,7 +113,7 @@ func TestDialWithRemoteAddr(t *testing.T) {
|
||||
|
||||
var b [1024]byte
|
||||
n, _ := conn.Read(b[:])
|
||||
if string(b[:n]) != "Response" {
|
||||
if string(b[:n]) != "1.1.1.1:0" {
|
||||
t.Error("response: ", string(b[:n]))
|
||||
}
|
||||
|
||||
|
@@ -14,15 +14,19 @@ import (
|
||||
var _ buf.Writer = (*connection)(nil)
|
||||
|
||||
// connection is a wrapper for net.Conn over WebSocket connection.
|
||||
// remoteAddr is used to pass "virtual" remote IP addresses in X-Forwarded-For.
|
||||
// so we shouldn't directly read it form conn.
|
||||
type connection struct {
|
||||
conn *websocket.Conn
|
||||
reader io.Reader
|
||||
conn *websocket.Conn
|
||||
reader io.Reader
|
||||
remoteAddr net.Addr
|
||||
}
|
||||
|
||||
func NewConnection(conn *websocket.Conn, remoteAddr net.Addr, extraReader io.Reader) *connection {
|
||||
return &connection{
|
||||
conn: conn,
|
||||
reader: extraReader,
|
||||
conn: conn,
|
||||
remoteAddr: remoteAddr,
|
||||
reader: extraReader,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +94,7 @@ func (c *connection) LocalAddr() net.Addr {
|
||||
}
|
||||
|
||||
func (c *connection) RemoteAddr() net.Addr {
|
||||
return c.conn.RemoteAddr()
|
||||
return c.remoteAddr
|
||||
}
|
||||
|
||||
func (c *connection) SetDeadline(t time.Time) error {
|
||||
|
@@ -91,7 +91,7 @@ func TestDialWithRemoteAddr(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = c.Write([]byte("Response"))
|
||||
_, err = c.Write([]byte(c.RemoteAddr().String()))
|
||||
common.Must(err)
|
||||
}(conn)
|
||||
})
|
||||
@@ -109,7 +109,7 @@ func TestDialWithRemoteAddr(t *testing.T) {
|
||||
var b [1024]byte
|
||||
n, err := conn.Read(b[:])
|
||||
common.Must(err)
|
||||
if string(b[:n]) != "Response" {
|
||||
if string(b[:n]) != "1.1.1.1:0" {
|
||||
t.Error("response: ", string(b[:n]))
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user