1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-21 16:56:27 -05:00

handle response command in vmess outbound.

This commit is contained in:
Darien Raymond 2015-12-04 11:42:56 +00:00
parent 11220a4952
commit 6bb53251e9
3 changed files with 21 additions and 2 deletions

View File

@ -1,4 +1,4 @@
package vmess
package inbound
import (
"crypto/md5"

View File

@ -0,0 +1,5 @@
package outbound
func handleCommand(command byte, data []byte) error {
return nil
}

View File

@ -178,7 +178,21 @@ func handleResponse(conn net.Conn, request *protocol.VMessRequest, output chan<-
}
log.Info("VMessOut received %d bytes from %s", buffer.Len()-4, conn.RemoteAddr().String())
buffer.SliceFrom(4)
responseBegin := 4
if buffer.Value[2] != 0 {
dataLen := int(buffer.Value[3])
if buffer.Len() < dataLen+4 { // Rare case
diffBuffer := make([]byte, dataLen+4-buffer.Len())
v2net.ReadAllBytes(decryptResponseReader, diffBuffer)
buffer.Append(diffBuffer)
}
command := buffer.Value[2]
data := buffer.Value[4 : 4+dataLen]
go handleCommand(command, data)
responseBegin = 4 + dataLen
}
buffer.SliceFrom(responseBegin)
output <- buffer
if !isUDP {