protocol.go 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. package sessdata
  2. type LType int8
  3. const (
  4. LTypeEthernet LType = 1
  5. LTypeIPData LType = 2
  6. )
  7. type Payload struct {
  8. LType LType // LinkType
  9. PType byte // payload types
  10. Data []byte
  11. }
  12. /*
  13. var header = []byte{'S', 'T', 'F', 0x01, 0, 0, 0x07, 0}
  14. https://tools.ietf.org/html/draft-mavrogiannopoulos-openconnect-02#section-2.2
  15. +---------------------+---------------------------------------------+
  16. | byte | value |
  17. +---------------------+---------------------------------------------+
  18. | 0 | fixed to 0x53 (S) |
  19. | | |
  20. | 1 | fixed to 0x54 (T) |
  21. | | |
  22. | 2 | fixed to 0x46 (F) |
  23. | | |
  24. | 3 | fixed to 0x01 |
  25. | | |
  26. | 4-5 | The length of the packet that follows this |
  27. | | header in big endian order |
  28. | | |
  29. | 6 | The type of the payload that follows (see |
  30. | | Table 3 for available types) |
  31. | | |
  32. | 7 | fixed to 0x00 |
  33. +---------------------+---------------------------------------------+
  34. The available payload types are listed in Table 3.
  35. +---------------------+---------------------------------------------+
  36. | Value | Description |
  37. +---------------------+---------------------------------------------+
  38. | 0x00 | DATA: the TLS record packet contains an |
  39. | | IPv4 or IPv6 packet |
  40. | | |
  41. | 0x03 | DPD-REQ: used for dead peer detection. Once |
  42. | | sent the peer should reply with a DPD-RESP |
  43. | | packet, that has the same contents as the |
  44. | | original request. |
  45. | | |
  46. | 0x04 | DPD-RESP: used as a response to a |
  47. | | previously received DPD-REQ. |
  48. | | |
  49. | 0x05 | DISCONNECT: sent by the client (or server) |
  50. | | to terminate the session. No data is |
  51. | | associated with this request. The session |
  52. | | will be invalidated after such request. |
  53. | | |
  54. | 0x07 | KEEPALIVE: sent by any peer. No data is |
  55. | | associated with this request. |
  56. | | |
  57. | 0x08 | COMPRESSED DATA: a Data packet which is |
  58. | | compressed prior to encryption. |
  59. | | |
  60. | 0x09 | TERMINATE: sent by the server to indicate |
  61. | | that the server is shutting down. No data |
  62. | | is associated with this request. |
  63. +---------------------+---------------------------------------------+
  64. */