vmessreader.go 793 B

123456789101112131415161718192021222324252627282930313233343536
  1. package io
  2. import (
  3. "net"
  4. )
  5. // VMessInput implements the input message of VMess protocol. It only contains
  6. // the header of a input message. The data part will be handled by conection
  7. // handler directly, in favor of data streaming.
  8. type VMessInput struct {
  9. version byte
  10. userHash [16]byte
  11. randHash [256]byte
  12. respKey [32]byte
  13. iv [16]byte
  14. command byte
  15. port uint16
  16. target [256]byte
  17. }
  18. type VMessReader struct {
  19. conn *net.Conn
  20. }
  21. // NewVMessReader creates a new VMessReader
  22. func NewVMessReader(conn *net.Conn) (VMessReader, error) {
  23. var reader VMessReader
  24. reader.conn = conn
  25. return reader, nil
  26. }
  27. // Read reads data from current connection and form a VMessInput if possible.
  28. func (*VMessReader) Read() (VMessInput, error) {
  29. var input VMessInput
  30. return input, nil
  31. }