mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-06-12 11:29:36 +03:00
Fix: CounterConnection with ReadV/WriteV (#720)
Co-authored-by: JimhHan <50871214+JimhHan@users.noreply.github.com>
This commit is contained in:
@ -6,6 +6,8 @@ package domainsocket
|
||||
import (
|
||||
"context"
|
||||
|
||||
"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/transport/internet"
|
||||
@ -13,7 +15,7 @@ import (
|
||||
"github.com/xtls/xray-core/transport/internet/xtls"
|
||||
)
|
||||
|
||||
func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.MemoryStreamConfig) (internet.Connection, error) {
|
||||
func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.MemoryStreamConfig) (stat.Connection, error) {
|
||||
settings := streamSettings.ProtocolSettings.(*Config)
|
||||
addr, err := settings.GetUnixAddr()
|
||||
if err != nil {
|
||||
|
@ -9,6 +9,8 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/xtls/xray-core/transport/internet/stat"
|
||||
|
||||
goxtls "github.com/xtls/go"
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
@ -98,7 +100,7 @@ func (ln *Listener) run() {
|
||||
conn = xtls.Server(conn, ln.xtlsConfig)
|
||||
}
|
||||
|
||||
ln.addConn(internet.Connection(conn))
|
||||
ln.addConn(stat.Connection(conn))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,8 @@ import (
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/xtls/xray-core/transport/internet/stat"
|
||||
|
||||
"github.com/xtls/xray-core/common"
|
||||
"github.com/xtls/xray-core/common/buf"
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
@ -23,7 +25,7 @@ func TestListen(t *testing.T) {
|
||||
Path: "/tmp/ts3",
|
||||
},
|
||||
}
|
||||
listener, err := Listen(ctx, nil, net.Port(0), streamSettings, func(conn internet.Connection) {
|
||||
listener, err := Listen(ctx, nil, net.Port(0), streamSettings, func(conn stat.Connection) {
|
||||
defer conn.Close()
|
||||
|
||||
b := buf.New()
|
||||
@ -64,7 +66,7 @@ func TestListenAbstract(t *testing.T) {
|
||||
Abstract: true,
|
||||
},
|
||||
}
|
||||
listener, err := Listen(ctx, nil, net.Port(0), streamSettings, func(conn internet.Connection) {
|
||||
listener, err := Listen(ctx, nil, net.Port(0), streamSettings, func(conn stat.Connection) {
|
||||
defer conn.Close()
|
||||
|
||||
b := buf.New()
|
||||
|
Reference in New Issue
Block a user