diff --git a/transport/hysteria/core/client.go b/transport/hysteria/core/client.go index 3e72db64d..5973e46db 100644 --- a/transport/hysteria/core/client.go +++ b/transport/hysteria/core/client.go @@ -230,7 +230,7 @@ func (c *Client) DialUDP(dialer utils.PacketDialer) (UDPConn, error) { } // Send request err = WriteClientRequest(stream, ClientRequest{ - UDP: false, + UDP: true, }) if err != nil { _ = stream.Close() diff --git a/transport/hysteria/core/protocol.go b/transport/hysteria/core/protocol.go index 77dfc2e58..0edec1d5d 100644 --- a/transport/hysteria/core/protocol.go +++ b/transport/hysteria/core/protocol.go @@ -248,7 +248,7 @@ func (m udpMessage) Size() int { } func (m udpMessage) Pack() []byte { - data := make([]byte, m.Size()) + data := make([]byte, 0, m.Size()) buffer := bytes.NewBuffer(data) _ = binary.Write(buffer, binary.BigEndian, m.SessionID) _ = binary.Write(buffer, binary.BigEndian, uint16(len(m.Host)))