mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 09:36:34 -05:00
fix reading udp packets
This commit is contained in:
parent
6e65007d16
commit
4f08b7c795
@ -117,7 +117,12 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn in
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
reader := buf.NewReader(conn)
|
var reader buf.Reader
|
||||||
|
if dest.Network == net.Network_UDP {
|
||||||
|
reader = &buf.PacketReader{Reader: conn}
|
||||||
|
} else {
|
||||||
|
reader = buf.NewReader(conn)
|
||||||
|
}
|
||||||
if err := buf.Copy(reader, link.Writer, buf.UpdateActivity(timer)); err != nil {
|
if err := buf.Copy(reader, link.Writer, buf.UpdateActivity(timer)); err != nil {
|
||||||
return newError("failed to transport request").Base(err)
|
return newError("failed to transport request").Base(err)
|
||||||
}
|
}
|
||||||
@ -151,7 +156,7 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn in
|
|||||||
defer tConn.Close()
|
defer tConn.Close()
|
||||||
|
|
||||||
writer = &buf.SequentialWriter{Writer: tConn}
|
writer = &buf.SequentialWriter{Writer: tConn}
|
||||||
tReader := buf.NewReader(tConn)
|
tReader := &buf.PacketReader{Reader: tConn}
|
||||||
requestCount++
|
requestCount++
|
||||||
tproxyRequest = func() error {
|
tproxyRequest = func() error {
|
||||||
defer func() {
|
defer func() {
|
||||||
|
@ -97,7 +97,7 @@ func (s *Server) handlerUDPPayload(ctx context.Context, conn internet.Connection
|
|||||||
}
|
}
|
||||||
inbound.User = s.user
|
inbound.User = s.user
|
||||||
|
|
||||||
reader := buf.NewReader(conn)
|
reader := &buf.PacketReader{Reader: conn}
|
||||||
for {
|
for {
|
||||||
mpayload, err := reader.ReadMultiBuffer()
|
mpayload, err := reader.ReadMultiBuffer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -200,7 +200,7 @@ func (s *Server) handleUDPPayload(ctx context.Context, conn internet.Connection,
|
|||||||
newError("client UDP connection from ", inbound.Source).WriteToLog(session.ExportIDToError(ctx))
|
newError("client UDP connection from ", inbound.Source).WriteToLog(session.ExportIDToError(ctx))
|
||||||
}
|
}
|
||||||
|
|
||||||
reader := buf.NewReader(conn)
|
reader := &buf.PacketReader{Reader: conn}
|
||||||
for {
|
for {
|
||||||
mpayload, err := reader.ReadMultiBuffer()
|
mpayload, err := reader.ReadMultiBuffer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user