mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-06-12 19:39:35 +03:00
Move common/net/connection.go into cnc folder
This commit is contained in:
@ -10,6 +10,7 @@ import (
|
||||
"github.com/xtls/xray-core/common"
|
||||
"github.com/xtls/xray-core/common/buf"
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/common/net/cnc"
|
||||
"github.com/xtls/xray-core/transport/internet"
|
||||
"github.com/xtls/xray-core/transport/internet/tls"
|
||||
"github.com/xtls/xray-core/transport/pipe"
|
||||
@ -124,10 +125,10 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
|
||||
|
||||
bwriter := buf.NewBufferedWriter(pwriter)
|
||||
common.Must(bwriter.SetBuffered(false))
|
||||
return net.NewConnection(
|
||||
net.ConnectionOutput(response.Body),
|
||||
net.ConnectionInput(bwriter),
|
||||
net.ConnectionOnClose(common.ChainedClosable{breader, bwriter, response.Body}),
|
||||
return cnc.NewConnection(
|
||||
cnc.ConnectionOutput(response.Body),
|
||||
cnc.ConnectionInput(bwriter),
|
||||
cnc.ConnectionOnClose(common.ChainedClosable{breader, bwriter, response.Body}),
|
||||
), nil
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
|
||||
"github.com/xtls/xray-core/common"
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/common/net/cnc"
|
||||
http_proto "github.com/xtls/xray-core/common/protocol/http"
|
||||
"github.com/xtls/xray-core/common/serial"
|
||||
"github.com/xtls/xray-core/common/session"
|
||||
@ -97,12 +98,12 @@ func (l *Listener) ServeHTTP(writer http.ResponseWriter, request *http.Request)
|
||||
}
|
||||
|
||||
done := done.New()
|
||||
conn := net.NewConnection(
|
||||
net.ConnectionOutput(request.Body),
|
||||
net.ConnectionInput(flushWriter{w: writer, d: done}),
|
||||
net.ConnectionOnClose(common.ChainedClosable{done, request.Body}),
|
||||
net.ConnectionLocalAddr(l.Addr()),
|
||||
net.ConnectionRemoteAddr(remoteAddr),
|
||||
conn := cnc.NewConnection(
|
||||
cnc.ConnectionOutput(request.Body),
|
||||
cnc.ConnectionInput(flushWriter{w: writer, d: done}),
|
||||
cnc.ConnectionOnClose(common.ChainedClosable{done, request.Body}),
|
||||
cnc.ConnectionLocalAddr(l.Addr()),
|
||||
cnc.ConnectionRemoteAddr(remoteAddr),
|
||||
)
|
||||
l.handler(conn)
|
||||
<-done.Wait()
|
||||
|
Reference in New Issue
Block a user