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

24
common/net/sing.go Normal file
View File

@ -0,0 +1,24 @@
package net
import (
"context"
"net"
"github.com/sagernet/sing/common/bufio"
"github.com/sagernet/sing/common/network"
)
type ExtendedConnWrapper = bufio.ExtendedConnWrapper
var NewExtendedConn = bufio.NewExtendedConn
var NewExtendedWriter = bufio.NewExtendedWriter
var NewExtendedReader = bufio.NewExtendedReader
type ExtendedConn = network.ExtendedConn
type ExtendedWriter = network.ExtendedWriter
type ExtendedReader = network.ExtendedReader
// Relay copies between left and right bidirectionally.
func Relay(leftConn, rightConn net.Conn) {
_ = bufio.CopyConn(context.TODO(), leftConn, rightConn)
}