github.com/sagernet/quic-go@v0.43.1-beta.1/logging/interface.go (about)

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