chore: decrease direct depend on the sing package
This commit is contained in:
@@ -1,16 +1,14 @@
|
||||
package tunnel
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net"
|
||||
"net/netip"
|
||||
"time"
|
||||
|
||||
N "github.com/Dreamacro/clash/common/net"
|
||||
"github.com/Dreamacro/clash/common/pool"
|
||||
C "github.com/Dreamacro/clash/constant"
|
||||
|
||||
"github.com/sagernet/sing/common/bufio"
|
||||
)
|
||||
|
||||
func handleUDPToRemote(packet C.UDPPacket, pc C.PacketConn, metadata *C.Metadata) error {
|
||||
@@ -62,5 +60,5 @@ func handleUDPToLocal(packet C.UDPPacket, pc net.PacketConn, key string, oAddr,
|
||||
}
|
||||
|
||||
func handleSocket(ctx C.ConnContext, outbound net.Conn) {
|
||||
bufio.CopyConn(context.TODO(), ctx.Conn(), outbound)
|
||||
N.Relay(ctx.Conn(), outbound)
|
||||
}
|
||||
|
||||
@@ -4,12 +4,11 @@ import (
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/Dreamacro/clash/common/buf"
|
||||
N "github.com/Dreamacro/clash/common/net"
|
||||
C "github.com/Dreamacro/clash/constant"
|
||||
|
||||
"github.com/gofrs/uuid"
|
||||
"github.com/sagernet/sing/common/buf"
|
||||
"github.com/sagernet/sing/common/bufio"
|
||||
"github.com/sagernet/sing/common/network"
|
||||
"go.uber.org/atomic"
|
||||
)
|
||||
|
||||
@@ -33,8 +32,8 @@ type tcpTracker struct {
|
||||
C.Conn `json:"-"`
|
||||
*trackerInfo
|
||||
manager *Manager
|
||||
extendedReader network.ExtendedReader
|
||||
extendedWriter network.ExtendedWriter
|
||||
extendedReader N.ExtendedReader
|
||||
extendedWriter N.ExtendedWriter
|
||||
}
|
||||
|
||||
func (tt *tcpTracker) ID() string {
|
||||
@@ -107,8 +106,8 @@ func NewTCPTracker(conn C.Conn, manager *Manager, metadata *C.Metadata, rule C.R
|
||||
UploadTotal: atomic.NewInt64(0),
|
||||
DownloadTotal: atomic.NewInt64(0),
|
||||
},
|
||||
extendedReader: bufio.NewExtendedReader(conn),
|
||||
extendedWriter: bufio.NewExtendedWriter(conn),
|
||||
extendedReader: N.NewExtendedReader(conn),
|
||||
extendedWriter: N.NewExtendedWriter(conn),
|
||||
}
|
||||
|
||||
if rule != nil {
|
||||
|
||||
Reference in New Issue
Block a user