claimsheader

package
v10.159.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CompressedTagLengthV1 is version 1 length of tags
	CompressedTagLengthV1 int = 12

	// CompressedTagLengthV2 is version 2 length of tags
	CompressedTagLengthV2 int = 4
)

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) Encrypt

func (c *ClaimsHeader) Encrypt() bool

Encrypt is the encrypt in bool

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) 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|               R (reserved)                   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
D  [0:5]  - Datapath version
CT [6,7]  - Compressed tag type
E  [8]    - Encryption enabled
R  [9: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
)

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 WARNING: Caller has to make sure that headerbytes is NOT nil

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

func OptionEncrypt

func OptionEncrypt(encrypt bool) Option

OptionEncrypt sets encryption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL