1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-18 01:46:06 -04:00
v2fly/io/vmessreader.go

37 lines
793 B
Go
Raw Normal View History

2015-09-05 11:48:38 -04:00
package io
import (
2015-09-06 16:10:42 -04:00
"net"
2015-09-05 11:48:38 -04:00
)
2015-09-07 09:10:37 -04:00
// 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.
2015-09-05 11:48:38 -04:00
type VMessInput struct {
2015-09-06 16:10:42 -04:00
version byte
userHash [16]byte
randHash [256]byte
respKey [32]byte
iv [16]byte
command byte
port uint16
target [256]byte
2015-09-05 11:48:38 -04:00
}
type VMessReader struct {
2015-09-06 16:10:42 -04:00
conn *net.Conn
2015-09-05 11:48:38 -04:00
}
2015-09-07 09:10:37 -04:00
// NewVMessReader creates a new VMessReader
2015-09-05 11:48:38 -04:00
func NewVMessReader(conn *net.Conn) (VMessReader, error) {
2015-09-06 16:10:42 -04:00
var reader VMessReader
reader.conn = conn
return reader, nil
2015-09-05 11:48:38 -04:00
}
2015-09-07 09:10:37 -04:00
// Read reads data from current connection and form a VMessInput if possible.
2015-09-05 11:48:38 -04:00
func (*VMessReader) Read() (VMessInput, error) {
2015-09-06 16:10:42 -04:00
var input VMessInput
return input, nil
}