Move common/net/connection.go into cnc folder

This commit is contained in:
RPRX 2020-12-28 03:20:39 +08:00
parent 0203190a98
commit 6bcac6cb10
7 changed files with 29 additions and 23 deletions

View file

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