chore: decrease direct depend on the sing package

This commit is contained in:
wwqgtxx
2023-01-16 10:50:31 +08:00
parent 643fdd0bce
commit 50832aab47
10 changed files with 108 additions and 73 deletions

View File

@ -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)
}