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:
parent
11220a4952
commit
6bb53251e9
@ -1,4 +1,4 @@
|
||||
package vmess
|
||||
package inbound
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
|
5
proxy/vmess/outbound/command.go
Normal file
5
proxy/vmess/outbound/command.go
Normal file
@ -0,0 +1,5 @@
|
||||
package outbound
|
||||
|
||||
func handleCommand(command byte, data []byte) error {
|
||||
return nil
|
||||
}
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user