Documentation
¶
Overview ¶
Package jointoken implements siderolink jointoken parser.
Index ¶
Constants ¶
const ( // VersionPlain is the random token string. VersionPlain = "plain" // Version1 is the signed token that contains extra data. Version1 = "1" // Version2 is the same as version 1, but the provider uses individual tokens. Version2 = "2" )
const JoinTokenLen = 32
JoinTokenLen number of random bytes to be encoded in the join token. The real length of the token will depend on the base62 encoding, whose lengths happpens to be non-deterministic.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type JoinToken ¶
type JoinToken struct {
ExtraData ExtraData `json:"extra_data"`
Version string `json:"-"`
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 NewWithExtraData ¶
NewWithExtraData creates the token with extra data.
type NodeUniqueToken ¶ added in v0.48.0
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.