Documentation ¶
Index ¶
- Constants
- func CompressionTypeToTagLength(t CompressionType) int
- type ClaimsHeader
- func (c *ClaimsHeader) CompressionType() CompressionType
- func (c *ClaimsHeader) DatapathVersion() DatapathVersion
- func (c *ClaimsHeader) Encrypt() bool
- func (c *ClaimsHeader) PingType() PingType
- func (c *ClaimsHeader) SetCompressionType(ct CompressionType)
- func (c *ClaimsHeader) SetDatapathVersion(dv DatapathVersion)
- func (c *ClaimsHeader) SetEncrypt(e bool)
- func (c *ClaimsHeader) SetPingType(pingType PingType)
- func (c *ClaimsHeader) ToBytes() HeaderBytes
- type CompressionType
- type DatapathVersion
- type HeaderBytes
- type Option
- type PingType
Constants ¶
const ( // CompressedTagLengthV1 is version 1 length of tags CompressedTagLengthV1 int = 12 // CompressedTagLengthV2 is version 2 length of tags CompressedTagLengthV2 int = 8 )
Variables ¶
This section is empty.
Functions ¶
func CompressionTypeToTagLength ¶
func CompressionTypeToTagLength(t CompressionType) int
CompressionTypeToTagLength converts CompressionType to length.
Types ¶
type ClaimsHeader ¶
type ClaimsHeader struct {
// contains filtered or unexported fields
}
ClaimsHeader holds header sub attributes
func NewClaimsHeader ¶
func NewClaimsHeader(opts ...Option) *ClaimsHeader
NewClaimsHeader returns claims header handler
func (*ClaimsHeader) CompressionType ¶
func (c *ClaimsHeader) CompressionType() CompressionType
CompressionType is the compression type
func (*ClaimsHeader) DatapathVersion ¶
func (c *ClaimsHeader) DatapathVersion() DatapathVersion
DatapathVersion is the datapath version
func (*ClaimsHeader) PingType ¶
func (c *ClaimsHeader) PingType() PingType
PingType returns ping type
func (*ClaimsHeader) SetCompressionType ¶
func (c *ClaimsHeader) SetCompressionType(ct CompressionType)
SetCompressionType sets the compression type
func (*ClaimsHeader) SetDatapathVersion ¶
func (c *ClaimsHeader) SetDatapathVersion(dv DatapathVersion)
SetDatapathVersion sets the datapath version
func (*ClaimsHeader) SetEncrypt ¶
func (c *ClaimsHeader) SetEncrypt(e bool)
SetEncrypt sets the encrypt
func (*ClaimsHeader) SetPingType ¶
func (c *ClaimsHeader) SetPingType(pingType PingType)
SetPingType sets the ping type
func (*ClaimsHeader) ToBytes ¶
func (c *ClaimsHeader) ToBytes() HeaderBytes
ToBytes generates the 32-bit header in bytes
0 1 2 3 4 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | D |CT |E| P | R (reserved) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ D [0:5] - Datapath version CT [6,7] - Compressed tag type E [8] - Encryption enabled P [9:12] - Ping type R [13:31] - Reserved
type CompressionType ¶
type CompressionType int
CompressionType defines the compression used.
const ( // CompressionTypeNone implies no compression CompressionTypeNone CompressionType = iota // CompressionTypeV1 is version 1 of compression CompressionTypeV1 // CompressionTypeV2 is version 2 of compression CompressionTypeV2 )
func String2CompressionType ¶
func String2CompressionType(s string) CompressionType
String2CompressionType is a helper to convert string to compression type
type DatapathVersion ¶
type DatapathVersion int
DatapathVersion defines the datapath version
const ( DatapathVersion1 DatapathVersion = iota DatapathVersion2 )
DatapathVersion constants
type HeaderBytes ¶
type HeaderBytes []byte
HeaderBytes is the claimsheader in bytes
func (HeaderBytes) ToClaimsHeader ¶
func (h HeaderBytes) ToClaimsHeader() *ClaimsHeader
ToClaimsHeader parses the bytes and returns the ClaimsHeader
type Option ¶
type Option func(*ClaimsHeader)
Option is used to set claimsheader fields
func OptionCompressionType ¶
func OptionCompressionType(compressionType CompressionType) Option
OptionCompressionType sets compression Type
func OptionDatapathVersion ¶
func OptionDatapathVersion(datapathVersion DatapathVersion) Option
OptionDatapathVersion sets handshake version