1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-30 22:15:27 -05:00

UDP support

This commit is contained in:
V2Ray
2015-10-03 11:34:01 +02:00
parent cd42e5551c
commit 5c4b149d48
9 changed files with 125 additions and 31 deletions

View File

@@ -25,7 +25,9 @@ func (handler *OutboundConnectionHandler) Start(ray core.OutboundRay) error {
}
handler.Data2Send.Write(data)
}
output <- handler.Data2Return
dataCopy := make([]byte, len(handler.Data2Return))
copy(dataCopy, handler.Data2Return)
output <- dataCopy
close(output)
}()
@@ -38,5 +40,9 @@ func (handler *OutboundConnectionHandler) Initialize(config []byte) error {
func (handler *OutboundConnectionHandler) Create(point *core.Point, packet v2net.Packet) (core.OutboundConnectionHandler, error) {
handler.Destination = packet.Destination()
if packet.Chunk() != nil {
handler.Data2Send.Write(packet.Chunk())
}
return handler, nil
}