Fix: CounterConnection with ReadV/WriteV (#720)

Co-authored-by: JimhHan <50871214+JimhHan@users.noreply.github.com>
This commit is contained in:
Arthur Morgan
2021-09-20 20:11:21 +08:00
committed by GitHub
parent f2cb13a8ec
commit 24b637cd5e
53 changed files with 247 additions and 128 deletions

View File

@@ -6,6 +6,8 @@ import (
"testing"
"time"
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/protocol/tls/cert"
@@ -20,8 +22,8 @@ func Test_listenWSAndDial(t *testing.T) {
ProtocolSettings: &Config{
Path: "ws",
},
}, func(conn internet.Connection) {
go func(c internet.Connection) {
}, func(conn stat.Connection) {
go func(c stat.Connection) {
defer c.Close()
var b [1024]byte
@@ -75,8 +77,8 @@ func TestDialWithRemoteAddr(t *testing.T) {
ProtocolSettings: &Config{
Path: "ws",
},
}, func(conn internet.Connection) {
go func(c internet.Connection) {
}, func(conn stat.Connection) {
go func(c stat.Connection) {
defer c.Close()
var b [1024]byte
@@ -129,7 +131,7 @@ func Test_listenWSAndDial_TLS(t *testing.T) {
Certificate: []*tls.Certificate{tls.ParseCertificate(cert.MustGenerate(nil, cert.CommonName("localhost")))},
},
}
listen, err := ListenWS(context.Background(), net.LocalHostIP, 13143, streamSettings, func(conn internet.Connection) {
listen, err := ListenWS(context.Background(), net.LocalHostIP, 13143, streamSettings, func(conn stat.Connection) {
go func() {
_ = conn.Close()
}()