headers.go 903 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package protocol
  2. import (
  3. v2net "github.com/v2ray/v2ray-core/common/net"
  4. "github.com/v2ray/v2ray-core/common/serial"
  5. "github.com/v2ray/v2ray-core/common/uuid"
  6. )
  7. type RequestCommand byte
  8. const (
  9. RequestCommandTCP = RequestCommand(0x01)
  10. RequestCommandUDP = RequestCommand(0x02)
  11. )
  12. const (
  13. RequestOptionChunkStream = RequestOption(0x01)
  14. )
  15. type RequestOption byte
  16. func (this RequestOption) IsChunkStream() bool {
  17. return (this & RequestOptionChunkStream) == RequestOptionChunkStream
  18. }
  19. type RequestHeader struct {
  20. Version byte
  21. User *User
  22. Command RequestCommand
  23. Option RequestOption
  24. Address v2net.Address
  25. Port v2net.Port
  26. }
  27. type ResponseCommand interface{}
  28. type ResponseHeader struct {
  29. Command ResponseCommand
  30. }
  31. type CommandSwitchAccount struct {
  32. Host v2net.Address
  33. Port v2net.Port
  34. ID *uuid.UUID
  35. AlterIds serial.Uint16Literal
  36. Level UserLevel
  37. ValidMin byte
  38. }