jointoken

package
v0.48.3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2025 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package jointoken implements siderolink jointoken parser.

Package jointoken implements siderolink jointoken parser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtraData

type ExtraData map[string]string

ExtraData is the type of the extra token data.

type JoinToken

type JoinToken struct {
	ExtraData ExtraData `json:"extra_data"`

	Signature []byte `json:"signature"`
	// contains filtered or unexported fields
}

JoinToken is the siderolink join token. Custom type adds methods for encoding/decoding extra data from the token.

func NewPlain

func NewPlain(token string) JoinToken

NewPlain token creates the token without extra data.

func NewWithExtraData

func NewWithExtraData(token string, extraData map[string]string) (JoinToken, error)

NewWithExtraData creates the token with extra data.

func Parse

func Parse(value string) (JoinToken, error)

Parse reads string into token.

func (JoinToken) Encode

func (t JoinToken) Encode() (string, error)

Encode the token into string.

func (JoinToken) IsValid

func (t JoinToken) IsValid(token string) bool

IsValid checks the signature or plain token.

type NodeUniqueToken added in v0.48.0

type NodeUniqueToken struct {
	Fingerprint string
	Token       string
}

NodeUniqueToken represents a join token generated for a specific node.

func NewNodeUniqueToken added in v0.48.0

func NewNodeUniqueToken(fingerprint, token string) *NodeUniqueToken

NewNodeUniqueToken creates the node unique token.

func ParseNodeUniqueToken added in v0.48.0

func ParseNodeUniqueToken(data string) (*NodeUniqueToken, error)

ParseNodeUniqueToken from the marshaled version.

func (*NodeUniqueToken) Encode added in v0.48.0

func (t *NodeUniqueToken) Encode() (string, error)

Encode the node unique token to bytes representation.

func (*NodeUniqueToken) Equal added in v0.48.0

func (t *NodeUniqueToken) Equal(other *NodeUniqueToken) bool

Equal is true when the token part is equal.

func (*NodeUniqueToken) HasToken added in v0.48.0

func (t *NodeUniqueToken) HasToken() bool

HasToken is true when the token field isn't empty.

func (*NodeUniqueToken) IsSameFingerprint added in v0.48.0

func (t *NodeUniqueToken) IsSameFingerprint(other *NodeUniqueToken) bool

IsSameFingerprint checks if the tokens have the same fingerprint.

Jump to

Keyboard shortcuts

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