Trim repo

This commit is contained in:
世界 2022-05-25 12:08:02 +08:00
parent 8697b84d59
commit d4b1e219c0
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
89 changed files with 121 additions and 10987 deletions

View file

@ -11,14 +11,17 @@ import (
"time"
_ "unsafe"
"github.com/sagernet/sing/common"
"github.com/sagernet/sing/common/auth"
E "github.com/sagernet/sing/common/exceptions"
M "github.com/sagernet/sing/common/metadata"
"github.com/sagernet/sing/transport/tcp"
N "github.com/sagernet/sing/common/network"
)
type Handler interface {
tcp.Handler
N.TCPConnectionHandler
N.UDPConnectionHandler
E.Handler
}
func HandleRequest(ctx context.Context, request *http.Request, conn net.Conn, authenticator auth.Authenticator, handler Handler, metadata M.Metadata) error {
@ -88,7 +91,8 @@ func HandleRequest(ctx context.Context, request *http.Request, conn net.Conn, au
go func() {
err := handler.NewConnection(ctx, right, metadata)
if err != nil {
handler.HandleError(&tcp.Error{Conn: right, Cause: err})
common.Close(left, right)
handler.HandleError(err)
}
}()
return left, nil