interface.go 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. // Package logging defines a logging interface for quic-go.
  2. // This package should not be considered stable
  3. package logging
  4. import (
  5. "github.com/Psiphon-Labs/quic-go/internal/protocol"
  6. "github.com/Psiphon-Labs/quic-go/internal/qerr"
  7. "github.com/Psiphon-Labs/quic-go/internal/utils"
  8. "github.com/Psiphon-Labs/quic-go/internal/wire"
  9. )
  10. type (
  11. // A ByteCount is used to count bytes.
  12. ByteCount = protocol.ByteCount
  13. // ECN is the ECN value
  14. ECN = protocol.ECN
  15. // A ConnectionID is a QUIC Connection ID.
  16. ConnectionID = protocol.ConnectionID
  17. // An ArbitraryLenConnectionID is a QUIC Connection ID that can be up to 255 bytes long.
  18. ArbitraryLenConnectionID = protocol.ArbitraryLenConnectionID
  19. // The EncryptionLevel is the encryption level of a packet.
  20. EncryptionLevel = protocol.EncryptionLevel
  21. // The KeyPhase is the key phase of the 1-RTT keys.
  22. KeyPhase = protocol.KeyPhase
  23. // The KeyPhaseBit is the value of the key phase bit of the 1-RTT packets.
  24. KeyPhaseBit = protocol.KeyPhaseBit
  25. // The PacketNumber is the packet number of a packet.
  26. PacketNumber = protocol.PacketNumber
  27. // The Perspective is the role of a QUIC endpoint (client or server).
  28. Perspective = protocol.Perspective
  29. // A StatelessResetToken is a stateless reset token.
  30. StatelessResetToken = protocol.StatelessResetToken
  31. // The StreamID is the stream ID.
  32. StreamID = protocol.StreamID
  33. // The StreamNum is the number of the stream.
  34. StreamNum = protocol.StreamNum
  35. // The StreamType is the type of the stream (unidirectional or bidirectional).
  36. StreamType = protocol.StreamType
  37. // The VersionNumber is the QUIC version.
  38. VersionNumber = protocol.VersionNumber
  39. // The Header is the QUIC packet header, before removing header protection.
  40. Header = wire.Header
  41. // The ExtendedHeader is the QUIC Long Header packet header, after removing header protection.
  42. ExtendedHeader = wire.ExtendedHeader
  43. // The TransportParameters are QUIC transport parameters.
  44. TransportParameters = wire.TransportParameters
  45. // The PreferredAddress is the preferred address sent in the transport parameters.
  46. PreferredAddress = wire.PreferredAddress
  47. // A TransportError is a transport-level error code.
  48. TransportError = qerr.TransportErrorCode
  49. // An ApplicationError is an application-defined error code.
  50. ApplicationError = qerr.TransportErrorCode
  51. // The RTTStats contain statistics used by the congestion controller.
  52. RTTStats = utils.RTTStats
  53. )
  54. const (
  55. // ECNUnsupported means that no ECN value was set / received
  56. ECNUnsupported = protocol.ECNUnsupported
  57. // ECTNot is Not-ECT
  58. ECTNot = protocol.ECNNon
  59. // ECT0 is ECT(0)
  60. ECT0 = protocol.ECT0
  61. // ECT1 is ECT(1)
  62. ECT1 = protocol.ECT1
  63. // ECNCE is CE
  64. ECNCE = protocol.ECNCE
  65. )
  66. const (
  67. // KeyPhaseZero is key phase bit 0
  68. KeyPhaseZero KeyPhaseBit = protocol.KeyPhaseZero
  69. // KeyPhaseOne is key phase bit 1
  70. KeyPhaseOne KeyPhaseBit = protocol.KeyPhaseOne
  71. )
  72. const (
  73. // PerspectiveServer is used for a QUIC server
  74. PerspectiveServer Perspective = protocol.PerspectiveServer
  75. // PerspectiveClient is used for a QUIC client
  76. PerspectiveClient Perspective = protocol.PerspectiveClient
  77. )
  78. const (
  79. // EncryptionInitial is the Initial encryption level
  80. EncryptionInitial EncryptionLevel = protocol.EncryptionInitial
  81. // EncryptionHandshake is the Handshake encryption level
  82. EncryptionHandshake EncryptionLevel = protocol.EncryptionHandshake
  83. // Encryption1RTT is the 1-RTT encryption level
  84. Encryption1RTT EncryptionLevel = protocol.Encryption1RTT
  85. // Encryption0RTT is the 0-RTT encryption level
  86. Encryption0RTT EncryptionLevel = protocol.Encryption0RTT
  87. )
  88. const (
  89. // StreamTypeUni is a unidirectional stream
  90. StreamTypeUni = protocol.StreamTypeUni
  91. // StreamTypeBidi is a bidirectional stream
  92. StreamTypeBidi = protocol.StreamTypeBidi
  93. )
  94. // The ShortHeader is the QUIC Short Header packet header, after removing header protection.
  95. type ShortHeader struct {
  96. DestConnectionID ConnectionID
  97. PacketNumber PacketNumber
  98. PacketNumberLen protocol.PacketNumberLen
  99. KeyPhase KeyPhaseBit
  100. }