replace xnet.Transport by xnet.Pipe

This commit is contained in:
ginuerzh
2025-07-28 20:52:15 +08:00
parent 35a049fb03
commit 208d18125c
52 changed files with 468 additions and 104 deletions
+19
View File
@@ -9,6 +9,7 @@ import (
"strings"
"syscall"
xio "github.com/go-gost/x/internal/io"
"github.com/vishvananda/netns"
)
@@ -25,6 +26,10 @@ type RemoteAddr interface {
RemoteAddr() net.Addr
}
type ClientAddr interface {
ClientAddr() net.Addr
}
// tcpraw.TCPConn
type SetDSCP interface {
SetDSCP(int) error
@@ -119,3 +124,17 @@ func (c *readWriteConn) Read(p []byte) (int, error) {
func (c *readWriteConn) Write(p []byte) (int, error) {
return c.w.Write(p)
}
func (c *readWriteConn) CloseRead() error {
if sc, ok := c.Conn.(xio.CloseRead); ok {
return sc.CloseRead()
}
return nil
}
func (c *readWriteConn) CloseWrite() error {
if sc, ok := c.Conn.(xio.CloseWrite); ok {
return sc.CloseWrite()
}
return nil
}