Add v2ray QUIC transport

This commit is contained in:
世界 2022-08-22 21:20:05 +08:00
parent 77c98fd042
commit d4b7e221f0
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
22 changed files with 336 additions and 25 deletions

View file

@ -83,16 +83,30 @@ func (h *VMess) Start() error {
if h.transport == nil {
return h.myInboundAdapter.Start()
}
tcpListener, err := h.myInboundAdapter.ListenTCP()
if err != nil {
return err
}
go func() {
sErr := h.transport.Serve(tcpListener)
if sErr != nil && !E.IsClosed(sErr) {
h.logger.Error("transport serve error: ", sErr)
if common.Contains(h.transport.Network(), N.NetworkTCP) {
tcpListener, err := h.myInboundAdapter.ListenTCP()
if err != nil {
return err
}
}()
go func() {
sErr := h.transport.Serve(tcpListener)
if sErr != nil && !E.IsClosed(sErr) {
h.logger.Error("transport serve error: ", sErr)
}
}()
}
if common.Contains(h.transport.Network(), N.NetworkUDP) {
udpConn, err := h.myInboundAdapter.ListenUDP()
if err != nil {
return err
}
go func() {
sErr := h.transport.ServePacket(udpConn)
if sErr != nil && !E.IsClosed(sErr) {
h.logger.Error("transport serve error: ", sErr)
}
}()
}
return nil
}