Feature: support vmess udp

This commit is contained in:
Dreamacro
2019-04-25 16:32:15 +08:00
parent 936ea3aa55
commit 762f227512
4 changed files with 20 additions and 2 deletions

View File

@ -77,7 +77,11 @@ func (vc *Conn) sendRequest() error {
// P Sec Reserve Cmd
buf.WriteByte(byte(p<<4) | byte(vc.security))
buf.WriteByte(0)
buf.WriteByte(CommandTCP)
if vc.dst.UDP {
buf.WriteByte(CommandUDP)
} else {
buf.WriteByte(CommandTCP)
}
// Port AddrType Addr
binary.Write(buf, binary.BigEndian, uint16(vc.dst.Port))

View File

@ -57,6 +57,7 @@ const (
// DstAddr store destination address
type DstAddr struct {
UDP bool
AddrType byte
Addr []byte
Port uint