types

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 19 Imported by: 3

Documentation

Index

Constants

View Source
const (
	FilterTypeID       = "id"       // Filter by the name or identifier.
	FilterTypeSourceID = "sourceid" // Filter an edge by source node ID.
	FilterTypeTargetID = "targetid" // Filter an edge by target node ID.
	FilterTypePubKey   = "pubkey"   // Filter a node by their public key.
	FilterTypeNodeID   = "nodeid"   // Filter an object by related node ID.
	FilterTypeCIDR     = "cidr"     // Filter a route by CIDR.
)
View Source
const (
	// GroupReference is the prefix of a node name that indicates it is a group reference.
	GroupReference = "group:"
)
View Source
const MaxIDLength = 63

MaxIDLength is the maximum length of a key ID.

Variables

View Source
var InvalidIDChars = []rune{'/', '\\', ':', '*', '?', '"', '\'', '<', '>', '|', ',', ' '}

InvalidIDChars are the characters that are not allowed in node IDs.

View Source
var ReservedNodeIDs = []string{"self", "local", "localhost", "leader", "voters", "observers"}

ReservedNodeIDs are reserved node IDs.

ReservedPrefixes is a list of all reserved prefixes.

Functions

func ConnectProtoFromEdgeAttrs added in v0.12.0

func ConnectProtoFromEdgeAttrs(attrs map[string]string) v1.ConnectProtocol

ConnectProtoFromEdgeAttrs returns the protocol for the given edge attributes.

func DrawPeerGraph

func DrawPeerGraph(ctx context.Context, g PeerGraph, w io.Writer) error

DrawPeerGraph draws a PeerGraph to the given writer in DOT format.

func EdgeAttrsForConnectProto added in v0.12.0

func EdgeAttrsForConnectProto(proto v1.ConnectProtocol) map[string]string

EdgeAttrsForConnectProto returns the edge attributes for the given protocol.

func EvalRole

func EvalRole(role Role, action *v1.RBACAction) bool

EvalRole evaluates an action against a single role.

func EvalRule

func EvalRule(rule *v1.Rule, action *v1.RBACAction) bool

EvalRule evaluates an action against a single rule.

func FeaturePortEqual

func FeaturePortEqual(a, b *v1.FeaturePort) bool

FeaturePortEqual compares two feature ports for equality.

func FeaturePortsEqual

func FeaturePortsEqual(a, b []*v1.FeaturePort) bool

FeaturePortsEqual compares two feature ports for equality.

func IsReservedPrefix

func IsReservedPrefix(key []byte) bool

IsReservedPrefix returns true if the given key is reserved.

func IsValidID added in v0.10.0

func IsValidID(id string) bool

IsValidID returns true if the given identifier is valid and safe to be saved to storage.

func IsValidIDOrWildcard added in v0.11.0

func IsValidIDOrWildcard(id string) bool

IsValidIDOrWildcard returns true if the given identifier is valid and safe to be saved to storage. It also allows the wildcard character.

func IsValidNodeID added in v0.10.0

func IsValidNodeID(id string) bool

IsValidNodeID returns true if the given node ID is valid and safe to be saved to storage.

func IsValidPathID added in v0.12.0

func IsValidPathID(id string) bool

IsValidPathID returns true if the given identifier is valid and safe to be saved to storage.

func MeshNodesEqual

func MeshNodesEqual(a, b MeshNode) bool

MeshNodesEqual compares two mesh nodes for equality.

func ToPrefixes

func ToPrefixes(ss []string) []netip.Prefix

ToPrefixes converts a list of CIDRs to a list of Prefixes. It silently ignores invalid CIDRs.

func TruncateID added in v0.10.4

func TruncateID(id string) string

TruncateID is a helper method to truncate IDs as needed when they are too long and can be safely truncated.

func TruncateIDTo added in v0.10.4

func TruncateIDTo(id string, length int) string

TruncateIDTo is a helper method to truncate IDs as needed when they are too long and can be safely truncated.

func ValidateACL

func ValidateACL(acl NetworkACL) error

ValidateACL validates a NetworkACL.

func ValidateRoute

func ValidateRoute(route Route) error

ValidateRoute validates a Route.

func WireGuardPeerEqual

func WireGuardPeerEqual(a, b *v1.WireGuardPeer) bool

WireGuardPeerEqual compares two WireGuard peers for equality.

func WireGuardPeersEqual

func WireGuardPeersEqual(a, b []*v1.WireGuardPeer) bool

WireGuardPeersEqual recurses the WireGuard peers and compares them for equality. Both lists are sorted by ID first.

Types

type AdjacencyMap

type AdjacencyMap map[NodeID]EdgeMap

AdjacencyMap is a map of node names to a map of node names to edges.

func NewAdjacencyMap

func NewAdjacencyMap(g PeerGraph) (AdjacencyMap, error)

NewAdjacencyMap returns a new adjacency map for the graph.

func (AdjacencyMap) DeepEqual

func (a AdjacencyMap) DeepEqual(b AdjacencyMap) bool

DeepEqual returns true if the given AdjacencyMap is equal to this AdjacencyMap.

type Edge

type Edge graph.Edge[NodeID]

Edge is the graph.Edge implementation for the mesh network.

func (Edge) DeepEqual

func (e Edge) DeepEqual(other Edge) bool

DeepEqual returns true if the given Edge is equal to this Edge.

func (Edge) ToMeshEdge

func (e Edge) ToMeshEdge(source, target NodeID) MeshEdge

ToMeshEdge converts an Edge to a MeshEdge.

type EdgeMap

type EdgeMap map[NodeID]Edge

EdgeMap is a map of node names to edges.

func (EdgeMap) DeepEqual

func (e EdgeMap) DeepEqual(other EdgeMap) bool

DeepEqual returns true if the given EdgeMap is equal to this EdgeMap.

type FilterType added in v0.12.0

type FilterType string

FilterType is the type of filter.

func (FilterType) IsValid added in v0.12.0

func (f FilterType) IsValid() bool

IsValid returns true if the filter type is valid.

type Group added in v0.9.2

type Group struct {
	*v1.Group `json:",inline"`
}

Group wraps a group.

func (Group) ContainsNode added in v0.14.11

func (n Group) ContainsNode(node NodeID) bool

ContainsNode returns true if the group contains the node.

func (Group) DeepCopy added in v0.9.2

func (n Group) DeepCopy() Group

DeepCopy returns a deep copy of the group.

func (Group) DeepCopyInto added in v0.9.2

func (n Group) DeepCopyInto(group *Group)

DeepCopyInto copies the node into the given group.

func (Group) MarshalProtoJSON added in v0.10.0

func (n Group) MarshalProtoJSON() ([]byte, error)

MarshalProtoJSON marshals the group to JSON.

func (Group) Proto added in v0.9.2

func (n Group) Proto() *v1.Group

Proto returns the underlying protobuf.

func (*Group) UnmarshalProtoJSON added in v0.10.0

func (n *Group) UnmarshalProtoJSON(data []byte) error

UnmarshalProtoJSON unmarshals the group from JSON.

func (Group) Validate added in v0.10.0

func (n Group) Validate() error

Validate validates the group.

type MeshEdge

type MeshEdge struct {
	*v1.MeshEdge `json:",inline"`
}

MeshEdge wraps a mesh edge.

func (MeshEdge) AsGraphEdge

func (e MeshEdge) AsGraphEdge() graph.Edge[NodeID]

AsGraphEdge converts a MeshEdge to a graph.Edge.

func (MeshEdge) DeepCopy added in v0.9.4

func (e MeshEdge) DeepCopy() MeshEdge

DeepCopy returns a deep copy of the edge.

func (MeshEdge) DeepCopyInto added in v0.9.4

func (e MeshEdge) DeepCopyInto(edge *MeshEdge)

DeepCopyInto copies the edge into the given edge.

func (MeshEdge) EdgeProperties

func (e MeshEdge) EdgeProperties() graph.EdgeProperties

EdgeProperties returns the edge's properties.

func (MeshEdge) MarshalProtoJSON added in v0.10.0

func (e MeshEdge) MarshalProtoJSON() ([]byte, error)

MarshalProtoJSON marshals a MeshEdge to JSON.

func (MeshEdge) PutInto

func (e MeshEdge) PutInto(ctx context.Context, g PeerGraph) error

PutInto puts the MeshEdge into the given graph.

func (MeshEdge) SourceID

func (e MeshEdge) SourceID() NodeID

SourceID returns the source node's ID.

func (MeshEdge) TargetID

func (e MeshEdge) TargetID() NodeID

TargetID returns the target node's ID.

func (MeshEdge) ToEdge

func (e MeshEdge) ToEdge() Edge

ToEdge converts a MeshEdge to an Edge.

func (*MeshEdge) UnmarshalProtoJSON added in v0.10.0

func (e *MeshEdge) UnmarshalProtoJSON(data []byte) error

UnmarshalProtoJSON unmarshals a MeshEdge from JSON.

type MeshNode

type MeshNode struct {
	*v1.MeshNode `json:",inline"`
}

MeshNode wraps a mesh node.

func ValidateMeshNode added in v0.11.0

func ValidateMeshNode(node MeshNode) (validated MeshNode, err error)

ValidateMeshNode validates the mesh node. It also dedups wireguard endpoints, adds a joined timestamp, and returns the modified node.

func (MeshNode) DNSPort

func (n MeshNode) DNSPort() uint16

DNSPort returns the node's DNS port.

func (MeshNode) DecodePublicKey added in v0.14.11

func (n MeshNode) DecodePublicKey() (crypto.PublicKey, error)

DecodePublicKey decodes the public key of this node.

func (MeshNode) DeepCopy added in v0.9.2

func (n MeshNode) DeepCopy() MeshNode

DeepCopy returns a deep copy of the node.

func (MeshNode) DeepCopyInto added in v0.9.2

func (n MeshNode) DeepCopyInto(node *MeshNode)

DeepCopyInto copies the node into the given node.

func (MeshNode) DeepEqual added in v0.9.2

func (n MeshNode) DeepEqual(node MeshNode) bool

DeepEqual returns true if the node is deeply equal to the given node.

func (MeshNode) HasFeature

func (n MeshNode) HasFeature(feature v1.Feature) bool

HasFeature returns true if the node has the given feature.

func (MeshNode) MarshalProtoJSON added in v0.10.0

func (n MeshNode) MarshalProtoJSON() ([]byte, error)

MarshalProtoJSON marshals the node to JSON.

func (MeshNode) NodeID

func (n MeshNode) NodeID() NodeID

NodeID returns the node's ID.

func (MeshNode) PortFor

func (n MeshNode) PortFor(feature v1.Feature) uint16

PortFor returns the port for the given feature, or 0 if the feature is not available on this node.

func (MeshNode) PrivateAddrV4

func (n MeshNode) PrivateAddrV4() netip.Prefix

PrivateAddrV4 returns the node's private IPv4 address. Be sure to check if the returned Addr IsValid.

func (MeshNode) PrivateAddrV6

func (n MeshNode) PrivateAddrV6() netip.Prefix

PrivateAddrV6 returns the node's private IPv6 address. Be sure to check if the returned Addr IsValid.

func (MeshNode) PrivateDNSAddrV4

func (n MeshNode) PrivateDNSAddrV4() netip.AddrPort

PrivateDNSAddrV4 returns the private IPv4 address for the node's DNS server. Be sure to check if the returned AddrPort IsValid.

func (MeshNode) PrivateDNSAddrV6

func (n MeshNode) PrivateDNSAddrV6() netip.AddrPort

PrivateDNSAddrV6 returns the private IPv6 address for the node's DNS server. Be sure to check if the returned AddrPort IsValid.

func (MeshNode) PrivateRPCAddrV4

func (n MeshNode) PrivateRPCAddrV4() netip.AddrPort

PrivateRPCAddrV4 returns the private IPv4 address for the node's RPC server. Be sure to check if the returned AddrPort IsValid.

func (MeshNode) PrivateRPCAddrV6

func (n MeshNode) PrivateRPCAddrV6() netip.AddrPort

PrivateRPCAddrV6 returns the private IPv6 address for the node's RPC server. Be sure to check if the returned AddrPort IsValid.

func (MeshNode) PrivateStorageAddrV4

func (n MeshNode) PrivateStorageAddrV4() netip.AddrPort

PrivateStorageAddrV4 returns the private IPv4 address for the node's raft listener. Be sure to check if the returned AddrPort IsValid.

func (MeshNode) PrivateStorageAddrV6

func (n MeshNode) PrivateStorageAddrV6() netip.AddrPort

PrivateStorageAddrV6 returns the private IPv6 address for the node's raft listener. Be sure to check if the returned AddrPort IsValid.

func (MeshNode) PrivateTURNAddrV4

func (n MeshNode) PrivateTURNAddrV4() netip.AddrPort

PrivateTURNAddrV4 returns the private IPv4 address for the node's TURN server. Be sure to check if the returned AddrPort IsValid.

func (MeshNode) PrivateTURNAddrV6

func (n MeshNode) PrivateTURNAddrV6() netip.AddrPort

PrivateTURNAddrV6 returns the private IPv6 address for the node's TURN server. Be sure to check if the returned AddrPort IsValid.

func (MeshNode) PublicDNSAddr

func (n MeshNode) PublicDNSAddr() netip.AddrPort

PublicDNSAddr returns the public address for the node's DNS server. Be sure to check if the returned AddrPort IsValid.

func (MeshNode) PublicRPCAddr

func (n MeshNode) PublicRPCAddr() netip.AddrPort

PublicRPCAddr returns the public address for the node's RPC server. Be sure to check if the returned AddrPort IsValid.

func (MeshNode) RPCPort

func (n MeshNode) RPCPort() uint16

RPCPort returns the node's RPC port.

func (MeshNode) StoragePort

func (n MeshNode) StoragePort() uint16

StoragePort returns the node's Storage port.

func (MeshNode) TURNPort

func (n MeshNode) TURNPort() uint16

TURNPort returns the node's TURN port.

func (*MeshNode) UnmarshalProtoJSON added in v0.10.0

func (n *MeshNode) UnmarshalProtoJSON(data []byte) error

UnmarshalProtoJSON unmarshals the node from JSON.

func (MeshNode) WireGuardEndpoints added in v0.10.1

func (n MeshNode) WireGuardEndpoints() []netip.AddrPort

WireGuardEndpoints returns all valid WireGuard endpoints as netip.AddrPorts.

func (MeshNode) WireGuardPort added in v0.10.1

func (n MeshNode) WireGuardPort() uint16

WireGuardPort returns the first wireguard port encountered for this peer.

type NetworkACL

type NetworkACL struct {
	*v1.NetworkACL `json:",inline"`
}

NetworkACL is a Network ACL.

func (NetworkACL) DeepCopy added in v0.9.2

func (n NetworkACL) DeepCopy() NetworkACL

DeepCopy returns a deep copy of the network ACL.

func (NetworkACL) DeepCopyInto added in v0.9.2

func (n NetworkACL) DeepCopyInto(acl *NetworkACL)

DeepCopyInto copies the node into the given acl.

func (NetworkACL) DestinationPrefixes

func (a NetworkACL) DestinationPrefixes() []netip.Prefix

DestinationPrefixes returns the destination prefixes for the ACL. Invalid prefixes will be ignored.

func (NetworkACL) Equals

func (a NetworkACL) Equals(other NetworkACL) bool

Equals returns whether the ACLs are equal.

func (NetworkACL) MarshalProtoJSON added in v0.10.0

func (a NetworkACL) MarshalProtoJSON() ([]byte, error)

MarshalProtoJSON marshals the ACL to protobuf json.

func (NetworkACL) Matches

func (acl NetworkACL) Matches(ctx context.Context, action NetworkAction) bool

Matches checks if an action matches this ACL.

func (NetworkACL) Proto

func (a NetworkACL) Proto() *v1.NetworkACL

Proto returns the protobuf representation of the ACL.

func (NetworkACL) SourcePrefixes

func (a NetworkACL) SourcePrefixes() []netip.Prefix

SourcePrefixes returns the source prefixes for the ACL. Invalid prefixes will be ignored.

func (*NetworkACL) UnmarshalProtoJSON added in v0.10.0

func (a *NetworkACL) UnmarshalProtoJSON(data []byte) error

UnmarshalProtoJSON unmarshals the ACL from a protobuf JSON.

func (NetworkACL) Validate added in v0.10.0

func (a NetworkACL) Validate() error

Validate validates the ACL.

type NetworkACLs

type NetworkACLs []NetworkACL

ACLs is a list of Network ACLs. It contains methods for evaluating actions against contained permissions. It also allows for sorting by priority.

func (NetworkACLs) Accept

func (a NetworkACLs) Accept(ctx context.Context, action NetworkAction) bool

Accept evaluates an action against the ACLs in the list. It assumes the ACLs are sorted by priority. The first ACL that matches the action will be used. If no ACL matches, the action is denied.

func (NetworkACLs) AllowNodesToCommunicate

func (a NetworkACLs) AllowNodesToCommunicate(ctx context.Context, nodeA, nodeB MeshNode) bool

AllowNodesToCommunicate checks if the given nodes are allowed to communicate.

func (NetworkACLs) Len

func (a NetworkACLs) Len() int

Len returns the length of the ACLs list.

func (NetworkACLs) Less

func (a NetworkACLs) Less(i, j int) bool

Less returns whether the ACL at index i should be sorted before the ACL at index j.

func (NetworkACLs) Proto

func (a NetworkACLs) Proto() []*v1.NetworkACL

Proto returns the protobuf representation of the ACLs.

func (NetworkACLs) Sort

func (a NetworkACLs) Sort(direction SortDirection)

Sort sorts the ACLs by priority.

func (NetworkACLs) Swap

func (a NetworkACLs) Swap(i, j int)

Swap swaps the ACLs at the given indices.

type NetworkAction

type NetworkAction struct {
	*v1.NetworkAction `json:",inline"`
}

NetworkAction wraps a NetworkAction.

func (*NetworkAction) DestinationPrefix

func (a *NetworkAction) DestinationPrefix() netip.Prefix

DestinationPrefix returns the destination prefix for the action if it is valid.

func (*NetworkAction) Proto

func (a *NetworkAction) Proto() *v1.NetworkAction

Proto returns the protobuf representation of the action.

func (*NetworkAction) SourcePrefix

func (a *NetworkAction) SourcePrefix() netip.Prefix

SourcePrefix returns the source prefix for the action if it is valid.

type NetworkState added in v0.12.0

type NetworkState struct {
	*v1.NetworkState `json:",inline"`
}

NetworkState wraps a NetworkState.

func (NetworkState) DeepCopy added in v0.12.0

func (n NetworkState) DeepCopy() NetworkState

DeepCopy returns a deep copy of the network state.

func (NetworkState) DeepCopyInto added in v0.12.0

func (n NetworkState) DeepCopyInto(group *NetworkState)

DeepCopyInto copies the node into the given network state.

func (NetworkState) Domain added in v0.12.0

func (n NetworkState) Domain() string

Domain returns the domain.

func (NetworkState) MarshalProtoJSON added in v0.12.0

func (n NetworkState) MarshalProtoJSON() ([]byte, error)

MarshalProtoJSON marshals the network state to JSON.

func (NetworkState) NetworkV4 added in v0.12.0

func (n NetworkState) NetworkV4() netip.Prefix

NetworkV4 returns the IPv4 network as a netip.Prefix.

func (NetworkState) NetworkV6 added in v0.12.0

func (n NetworkState) NetworkV6() netip.Prefix

NetworkV4 returns the IPv6 network as a netip.Prefix.

func (NetworkState) Proto added in v0.12.0

func (n NetworkState) Proto() *v1.NetworkState

Proto returns the underlying protobuf.

func (*NetworkState) UnmarshalProtoJSON added in v0.12.0

func (n *NetworkState) UnmarshalProtoJSON(data []byte) error

UnmarshalProtoJSON unmarshals the network state from JSON.

type NodeID

type NodeID string

NodeID is the type of a node ID.

func (NodeID) Bytes

func (id NodeID) Bytes() []byte

Bytes returns the byte representation of the node ID.

func (NodeID) IsEmpty

func (id NodeID) IsEmpty() bool

IsEmpty returns true if the node ID is empty.

func (NodeID) IsValid added in v0.10.0

func (id NodeID) IsValid() bool

IsValid returns true if the node ID is valid.

func (NodeID) String

func (id NodeID) String() string

String returns the string representation of the node ID.

type PeerGraph

type PeerGraph graph.Graph[NodeID, MeshNode]

PeerGraph is the graph.Graph implementation for the mesh network.

type PeerGraphStore

type PeerGraphStore graph.Store[NodeID, MeshNode]

PeerGraphStore is the graph.Store implementation for the mesh network.

type Prefix

type Prefix struct{ netip.Prefix }

Prefix is wraps a netip.Prefix with a custom JSON marshaller.

func MustParsePrefix added in v0.14.0

func MustParsePrefix(s string) Prefix

MustParsePrefix parses a string into a Prefix and panics on error.

func ParsePrefix added in v0.14.0

func ParsePrefix(s string) (Prefix, error)

ParsePrefix parses a string into a Prefix.

func (Prefix) MarshalJSON added in v0.14.0

func (p Prefix) MarshalJSON() ([]byte, error)

MarshalJSON marshals a Prefix as a string.

func (*Prefix) UnmarshalJSON added in v0.14.0

func (p *Prefix) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals a Prefix from a string.

type QueryFilter added in v0.12.0

type QueryFilter struct {
	// The type of filter.
	Type FilterType
	// Value is the value of the filter.
	Value string
}

QueryFilter is a parsed filter for a storage query.

type QueryFilters added in v0.12.0

type QueryFilters []QueryFilter

QueryFilters is a list of parsed filters for a storage query.

func NewQueryFilters added in v0.12.0

func NewQueryFilters(filters ...QueryFilter) QueryFilters

NewQueryFilters returns a new list of query filters.

func ParseQueryFilters added in v0.15.5

func ParseQueryFilters(req *v1.QueryRequest) QueryFilters

ParseQueryFilters parses the query filters from a query request.

func (QueryFilters) Encode added in v0.12.0

func (q QueryFilters) Encode() string

Encode encodes the query filters into a string.

func (QueryFilters) GetByType added in v0.12.0

func (q QueryFilters) GetByType(ftype FilterType) (QueryFilter, bool)

func (QueryFilters) GetCIDR added in v0.12.0

func (q QueryFilters) GetCIDR() (netip.Prefix, bool)

func (QueryFilters) GetID added in v0.12.0

func (q QueryFilters) GetID() (string, bool)

func (QueryFilters) GetNodeID added in v0.12.0

func (q QueryFilters) GetNodeID() (NodeID, bool)

func (QueryFilters) GetPubKey added in v0.12.0

func (q QueryFilters) GetPubKey() (string, bool)

func (QueryFilters) GetSourceNodeID added in v0.12.0

func (q QueryFilters) GetSourceNodeID() (NodeID, bool)

func (QueryFilters) GetTargetNodeID added in v0.12.0

func (q QueryFilters) GetTargetNodeID() (NodeID, bool)

func (QueryFilters) WithCIDR added in v0.12.0

func (q QueryFilters) WithCIDR(cidr netip.Prefix) QueryFilters

func (QueryFilters) WithID added in v0.12.0

func (q QueryFilters) WithID(id string) QueryFilters

func (QueryFilters) WithNodeID added in v0.12.0

func (q QueryFilters) WithNodeID(id NodeID) QueryFilters

func (QueryFilters) WithPubKey added in v0.12.0

func (q QueryFilters) WithPubKey(pubkey string) QueryFilters

func (QueryFilters) WithSourceNodeID added in v0.12.0

func (q QueryFilters) WithSourceNodeID(id NodeID) QueryFilters

func (QueryFilters) WithTargetNodeID added in v0.12.0

func (q QueryFilters) WithTargetNodeID(id NodeID) QueryFilters

type Role added in v0.9.2

type Role struct {
	*v1.Role `json:",inline"`
}

Role wraps a role.

func (Role) DeepCopy added in v0.9.2

func (n Role) DeepCopy() Role

DeepCopy returns a deep copy of the role.

func (Role) DeepCopyInto added in v0.9.2

func (n Role) DeepCopyInto(role *Role)

DeepCopyInto copies the node into the given role.

func (Role) MarshalProtoJSON added in v0.10.0

func (n Role) MarshalProtoJSON() ([]byte, error)

MarshalProtoJSON marshals the role to JSON.

func (Role) Proto added in v0.9.2

func (n Role) Proto() *v1.Role

Proto returns the underlying protobuf.

func (*Role) UnmarshalProtoJSON added in v0.10.0

func (n *Role) UnmarshalProtoJSON(data []byte) error

UnmarshalProtoJSON unmarshals the role from JSON.

func (Role) Validate added in v0.10.0

func (n Role) Validate() error

Validate validates the role.

type RoleBinding added in v0.9.2

type RoleBinding struct {
	*v1.RoleBinding `json:",inline"`
}

RoleBinding wraps a rolebinding.

func (RoleBinding) ContainsID added in v0.9.6

func (rb RoleBinding) ContainsID(id NodeID) bool

ContainsID returns true if the rolebinding contains the given id either as a node or user.

func (RoleBinding) ContainsNodeID added in v0.9.6

func (rb RoleBinding) ContainsNodeID(nodeID NodeID) bool

ContainsNodeID returns true if the rolebinding contains the given node id.

func (RoleBinding) ContainsUserID added in v0.9.6

func (rb RoleBinding) ContainsUserID(userID NodeID) bool

ContainsUserID returns true if the rolebinding contains the given user id.

func (RoleBinding) DeepCopy added in v0.9.2

func (rb RoleBinding) DeepCopy() RoleBinding

DeepCopy returns a deep copy of the rolebinding.

func (RoleBinding) DeepCopyInto added in v0.9.2

func (rb RoleBinding) DeepCopyInto(role *RoleBinding)

DeepCopyInto copies the node into the given rolebinding.

func (RoleBinding) MarshalProtoJSON added in v0.10.0

func (rb RoleBinding) MarshalProtoJSON() ([]byte, error)

MarshalProtoJSON marshals the rolebinding to JSON.

func (RoleBinding) Proto added in v0.9.2

func (rb RoleBinding) Proto() *v1.RoleBinding

Proto returns the underlying protobuf.

func (*RoleBinding) UnmarshalProtoJSON added in v0.10.0

func (rb *RoleBinding) UnmarshalProtoJSON(data []byte) error

UnmarshalProtoJSON unmarshals the rolebinding from JSON.

func (RoleBinding) Validate added in v0.10.0

func (rb RoleBinding) Validate() error

Validate returns an error if the rolebinding is invalid.

type RolesList

type RolesList []Role

RolesList is a list of roles. It contains methods for evaluating actions against contained permissions.

func (RolesList) Eval

func (l RolesList) Eval(action *v1.RBACAction) bool

Eval evaluates an action against the roles in the list.

type Route

type Route struct {
	*v1.Route `json:",inline"`
}

Route wraps a Route.

func (Route) DeepCopy added in v0.9.2

func (n Route) DeepCopy() Route

DeepCopy returns a deep copy of the route.

func (Route) DeepCopyInto added in v0.9.2

func (n Route) DeepCopyInto(route *Route)

DeepCopyInto copies the node into the given route.

func (*Route) DestinationPrefixes

func (r *Route) DestinationPrefixes() []netip.Prefix

DestinationPrefixes returns the destination prefixes for the route.

func (*Route) Equals

func (r *Route) Equals(other *Route) bool

Equals returns whether the routes are equal.

func (Route) MarshalProtoJSON added in v0.10.0

func (r Route) MarshalProtoJSON() ([]byte, error)

MarshalProtoJSON marshals the route to protobuf json.

func (*Route) Proto

func (r *Route) Proto() *v1.Route

Proto returns the protobuf representation of the route.

func (*Route) UnmarshalProtoJSON added in v0.10.0

func (r *Route) UnmarshalProtoJSON(data []byte) error

UnmarshalProtoJSON unmarshals the route from a protobuf.

func (Route) Validate added in v0.10.0

func (r Route) Validate() error

Validate validates the route.

type Routes

type Routes []Route

Routes is a list of routes.

func (Routes) Len

func (a Routes) Len() int

Len returns the length of the Routes list.

func (Routes) Less

func (a Routes) Less(i, j int) bool

Less returns whether the name of the route at index i is less than the name of the route at index j.

func (Routes) Proto

func (a Routes) Proto() []*v1.Route

Proto returns the protobuf representation of the Routes.

func (Routes) Sort

func (a Routes) Sort()

Sort sorts the routes by name.

func (Routes) Swap

func (a Routes) Swap(i, j int)

Swap swaps the routes at indexes i and j.

type SortDirection

type SortDirection int

SortDirection is the direction to sort ACLs.

const (
	// SortDescending sorts ACLs in descending order.
	SortDescending SortDirection = iota
	// SortAscending sorts ACLs in ascending order.
	SortAscending
)

type SortedWireGuardPeers

type SortedWireGuardPeers []*v1.WireGuardPeer

SortedWireGuardPeers implements a sort.Interface for []*v1.WireGuardPeer.

func (SortedWireGuardPeers) Len

func (s SortedWireGuardPeers) Len() int

func (SortedWireGuardPeers) Less

func (s SortedWireGuardPeers) Less(i, j int) bool

func (SortedWireGuardPeers) Swap

func (s SortedWireGuardPeers) Swap(i, j int)

type StoragePeer added in v0.14.1

type StoragePeer struct {
	*v1.StoragePeer `json:",inline"`
}

StoragePeer wraps a storage peer.

func (StoragePeer) DeepCopy added in v0.14.1

func (n StoragePeer) DeepCopy() StoragePeer

DeepCopy returns a deep copy of the peer.

func (StoragePeer) DeepCopyInto added in v0.14.1

func (n StoragePeer) DeepCopyInto(group *StoragePeer)

DeepCopyInto copies the node into the given peer.

func (StoragePeer) MarshalProtoJSON added in v0.14.1

func (n StoragePeer) MarshalProtoJSON() ([]byte, error)

MarshalProtoJSON marshals the peer to JSON.

func (StoragePeer) Proto added in v0.14.1

func (n StoragePeer) Proto() *v1.StoragePeer

Proto returns the underlying protobuf.

func (*StoragePeer) UnmarshalProtoJSON added in v0.14.1

func (n *StoragePeer) UnmarshalProtoJSON(data []byte) error

UnmarshalProtoJSON unmarshals the peer from JSON.

type StoragePrefix added in v0.14.0

type StoragePrefix []byte

StoragePrefix is a prefix in the storage.

var (
	// RegistryPrefix is the prefix for all data stored in the mesh registry.
	RegistryPrefix StoragePrefix = []byte("/registry")

	// ConsensusPrefix is the prefix for all data stored related to consensus.
	ConsensusPrefix StoragePrefix = []byte("/raft")
)

func (StoragePrefix) Contains added in v0.14.0

func (p StoragePrefix) Contains(key []byte) bool

Contains returns true if the given key is contained in the prefix.

func (StoragePrefix) For added in v0.14.0

func (p StoragePrefix) For(key []byte) StoragePrefix

For is a helper method for creating a key for the prefix.

func (StoragePrefix) ForString added in v0.14.0

func (p StoragePrefix) ForString(key string) StoragePrefix

ForString is a helper method for creating a key for the prefix.

func (StoragePrefix) String added in v0.14.0

func (p StoragePrefix) String() string

String returns the string representation of the prefix.

func (StoragePrefix) TrimFrom added in v0.14.0

func (p StoragePrefix) TrimFrom(key []byte) []byte

TrimFrom returns the key without the prefix.

type StorageQuery added in v0.12.0

type StorageQuery struct {
	*v1.QueryRequest
	// contains filtered or unexported fields
}

StorageQuery represents a parsed storage query.

func ParseStorageQuery added in v0.12.0

func ParseStorageQuery(query *v1.QueryRequest) (StorageQuery, error)

ParseStorageQuery parses a storage query.

func (StorageQuery) Filters added in v0.12.0

func (q StorageQuery) Filters() QueryFilters

Filters returns the parsed filters for the query.

Jump to

Keyboard shortcuts

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