mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 15:36:41 -05:00
Update VMessReader
This commit is contained in:
parent
f7400df7cb
commit
cac97be224
@ -4,7 +4,9 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
)
|
)
|
||||||
|
|
||||||
// VMessInput implements the input message of VMess protocol.
|
// VMessInput implements the input message of VMess protocol. It only contains
|
||||||
|
// the header of a input message. The data part will be handled by conection
|
||||||
|
// handler directly, in favor of data streaming.
|
||||||
type VMessInput struct {
|
type VMessInput struct {
|
||||||
version byte
|
version byte
|
||||||
userHash [16]byte
|
userHash [16]byte
|
||||||
@ -14,19 +16,20 @@ type VMessInput struct {
|
|||||||
command byte
|
command byte
|
||||||
port uint16
|
port uint16
|
||||||
target [256]byte
|
target [256]byte
|
||||||
data []byte
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type VMessReader struct {
|
type VMessReader struct {
|
||||||
conn *net.Conn
|
conn *net.Conn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewVMessReader creates a new VMessReader
|
||||||
func NewVMessReader(conn *net.Conn) (VMessReader, error) {
|
func NewVMessReader(conn *net.Conn) (VMessReader, error) {
|
||||||
var reader VMessReader
|
var reader VMessReader
|
||||||
reader.conn = conn
|
reader.conn = conn
|
||||||
return reader, nil
|
return reader, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Read reads data from current connection and form a VMessInput if possible.
|
||||||
func (*VMessReader) Read() (VMessInput, error) {
|
func (*VMessReader) Read() (VMessInput, error) {
|
||||||
var input VMessInput
|
var input VMessInput
|
||||||
return input, nil
|
return input, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user