claimsheader

package
v10.312.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: Apache-2.0 Imports: 1 Imported by: 12

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

func (c *ClaimsHeader) Encrypt() bool

Encrypt is the encrypt in bool

func (*ClaimsHeader) Ping

func (c *ClaimsHeader) Ping() bool

Ping returns the ping 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) SetPing

func (c *ClaimsHeader) SetPing(ping bool)

SetPing sets the ping

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]     - Ping enabled
R  [10:31] - Reserved

type CompressionType

type CompressionType int

CompressionType defines the compression used.

const (

	// CompressionTypeV1 is version 1 of compression
	CompressionTypeV1 CompressionType = iota
)

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

func OptionEncrypt

func OptionEncrypt(encrypt bool) Option

OptionEncrypt sets encryption

func OptionPing

func OptionPing(ping bool) Option

OptionPing sets ping

type PingType

type PingType int

PingType defines the ping type.

const (
	PingTypeNone PingType = iota
	PingTypeDefaultIdentity
	PingTypeCustomIdentity
	PingTypeDefaultIdentityPassthrough
)

PingType options.

func (PingType) String

func (pt PingType) String() string

toMask returns the mask based on the type

Jump to

Keyboard shortcuts

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