Documentation
¶
Index ¶
- Constants
- Variables
- func ConnectProtoFromEdgeAttrs(attrs map[string]string) v1.ConnectProtocol
- func DrawPeerGraph(ctx context.Context, g PeerGraph, w io.Writer) error
- func EdgeAttrsForConnectProto(proto v1.ConnectProtocol) map[string]string
- func EvalRole(role Role, action *v1.RBACAction) bool
- func EvalRule(rule *v1.Rule, action *v1.RBACAction) bool
- func FeaturePortEqual(a, b *v1.FeaturePort) bool
- func FeaturePortsEqual(a, b []*v1.FeaturePort) bool
- func IsReservedPrefix(key []byte) bool
- func IsValidID(id string) bool
- func IsValidIDOrWildcard(id string) bool
- func IsValidNodeID(id string) bool
- func IsValidPathID(id string) bool
- func MeshNodesEqual(a, b MeshNode) bool
- func ToPrefixes(ss []string) []netip.Prefix
- func TruncateID(id string) string
- func TruncateIDTo(id string, length int) string
- func ValidateACL(acl NetworkACL) error
- func ValidateRoute(route Route) error
- func WireGuardPeerEqual(a, b *v1.WireGuardPeer) bool
- func WireGuardPeersEqual(a, b []*v1.WireGuardPeer) bool
- type AdjacencyMap
- type Edge
- type EdgeMap
- type FilterType
- type Group
- type MeshEdge
- func (e MeshEdge) AsGraphEdge() graph.Edge[NodeID]
- func (e MeshEdge) DeepCopy() MeshEdge
- func (e MeshEdge) DeepCopyInto(edge *MeshEdge)
- func (e MeshEdge) EdgeProperties() graph.EdgeProperties
- func (e MeshEdge) MarshalProtoJSON() ([]byte, error)
- func (e MeshEdge) PutInto(ctx context.Context, g PeerGraph) error
- func (e MeshEdge) SourceID() NodeID
- func (e MeshEdge) TargetID() NodeID
- func (e MeshEdge) ToEdge() Edge
- func (e *MeshEdge) UnmarshalProtoJSON(data []byte) error
- type MeshNode
- func (n MeshNode) DNSPort() uint16
- func (n MeshNode) DecodePublicKey() (crypto.PublicKey, error)
- func (n MeshNode) DeepCopy() MeshNode
- func (n MeshNode) DeepCopyInto(node *MeshNode)
- func (n MeshNode) DeepEqual(node MeshNode) bool
- func (n MeshNode) HasFeature(feature v1.Feature) bool
- func (n MeshNode) MarshalProtoJSON() ([]byte, error)
- func (n MeshNode) NodeID() NodeID
- func (n MeshNode) PortFor(feature v1.Feature) uint16
- func (n MeshNode) PrivateAddrV4() netip.Prefix
- func (n MeshNode) PrivateAddrV6() netip.Prefix
- func (n MeshNode) PrivateDNSAddrV4() netip.AddrPort
- func (n MeshNode) PrivateDNSAddrV6() netip.AddrPort
- func (n MeshNode) PrivateRPCAddrV4() netip.AddrPort
- func (n MeshNode) PrivateRPCAddrV6() netip.AddrPort
- func (n MeshNode) PrivateStorageAddrV4() netip.AddrPort
- func (n MeshNode) PrivateStorageAddrV6() netip.AddrPort
- func (n MeshNode) PrivateTURNAddrV4() netip.AddrPort
- func (n MeshNode) PrivateTURNAddrV6() netip.AddrPort
- func (n MeshNode) PublicDNSAddr() netip.AddrPort
- func (n MeshNode) PublicRPCAddr() netip.AddrPort
- func (n MeshNode) RPCPort() uint16
- func (n MeshNode) StoragePort() uint16
- func (n MeshNode) TURNPort() uint16
- func (n *MeshNode) UnmarshalProtoJSON(data []byte) error
- func (n MeshNode) WireGuardEndpoints() []netip.AddrPort
- func (n MeshNode) WireGuardPort() uint16
- type NetworkACL
- func (n NetworkACL) DeepCopy() NetworkACL
- func (n NetworkACL) DeepCopyInto(acl *NetworkACL)
- func (a NetworkACL) DestinationPrefixes() []netip.Prefix
- func (a NetworkACL) Equals(other NetworkACL) bool
- func (a NetworkACL) MarshalProtoJSON() ([]byte, error)
- func (acl NetworkACL) Matches(ctx context.Context, action NetworkAction) bool
- func (a NetworkACL) Proto() *v1.NetworkACL
- func (a NetworkACL) SourcePrefixes() []netip.Prefix
- func (a *NetworkACL) UnmarshalProtoJSON(data []byte) error
- func (a NetworkACL) Validate() error
- type NetworkACLs
- func (a NetworkACLs) Accept(ctx context.Context, action NetworkAction) bool
- func (a NetworkACLs) AllowNodesToCommunicate(ctx context.Context, nodeA, nodeB MeshNode) bool
- func (a NetworkACLs) Len() int
- func (a NetworkACLs) Less(i, j int) bool
- func (a NetworkACLs) Proto() []*v1.NetworkACL
- func (a NetworkACLs) Sort(direction SortDirection)
- func (a NetworkACLs) Swap(i, j int)
- type NetworkAction
- type NetworkState
- func (n NetworkState) DeepCopy() NetworkState
- func (n NetworkState) DeepCopyInto(group *NetworkState)
- func (n NetworkState) Domain() string
- func (n NetworkState) MarshalProtoJSON() ([]byte, error)
- func (n NetworkState) NetworkV4() netip.Prefix
- func (n NetworkState) NetworkV6() netip.Prefix
- func (n NetworkState) Proto() *v1.NetworkState
- func (n *NetworkState) UnmarshalProtoJSON(data []byte) error
- type NodeID
- type PeerGraph
- type PeerGraphStore
- type Prefix
- type QueryFilter
- type QueryFilters
- func (q QueryFilters) Encode() string
- func (q QueryFilters) GetByType(ftype FilterType) (QueryFilter, bool)
- func (q QueryFilters) GetCIDR() (netip.Prefix, bool)
- func (q QueryFilters) GetID() (string, bool)
- func (q QueryFilters) GetNodeID() (NodeID, bool)
- func (q QueryFilters) GetPubKey() (string, bool)
- func (q QueryFilters) GetSourceNodeID() (NodeID, bool)
- func (q QueryFilters) GetTargetNodeID() (NodeID, bool)
- func (q QueryFilters) WithCIDR(cidr netip.Prefix) QueryFilters
- func (q QueryFilters) WithID(id string) QueryFilters
- func (q QueryFilters) WithNodeID(id NodeID) QueryFilters
- func (q QueryFilters) WithPubKey(pubkey string) QueryFilters
- func (q QueryFilters) WithSourceNodeID(id NodeID) QueryFilters
- func (q QueryFilters) WithTargetNodeID(id NodeID) QueryFilters
- type Role
- type RoleBinding
- func (rb RoleBinding) ContainsID(id NodeID) bool
- func (rb RoleBinding) ContainsNodeID(nodeID NodeID) bool
- func (rb RoleBinding) ContainsUserID(userID NodeID) bool
- func (rb RoleBinding) DeepCopy() RoleBinding
- func (rb RoleBinding) DeepCopyInto(role *RoleBinding)
- func (rb RoleBinding) MarshalProtoJSON() ([]byte, error)
- func (rb RoleBinding) Proto() *v1.RoleBinding
- func (rb *RoleBinding) UnmarshalProtoJSON(data []byte) error
- func (rb RoleBinding) Validate() error
- type RolesList
- type Route
- func (n Route) DeepCopy() Route
- func (n Route) DeepCopyInto(route *Route)
- func (r *Route) DestinationPrefixes() []netip.Prefix
- func (r *Route) Equals(other *Route) bool
- func (r Route) MarshalProtoJSON() ([]byte, error)
- func (r *Route) Proto() *v1.Route
- func (r *Route) UnmarshalProtoJSON(data []byte) error
- func (r Route) Validate() error
- type Routes
- type SortDirection
- type SortedWireGuardPeers
- type StoragePeer
- type StoragePrefix
- type StorageQuery
Constants ¶
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. )
const (
// GroupReference is the prefix of a node name that indicates it is a group reference.
GroupReference = "group:"
)
const MaxIDLength = 63
MaxIDLength is the maximum length of a key ID.
Variables ¶
var InvalidIDChars = []rune{'/', '\\', ':', '*', '?', '"', '\'', '<', '>', '|', ',', ' '}
InvalidIDChars are the characters that are not allowed in node IDs.
var ReservedNodeIDs = []string{"self", "local", "localhost", "leader", "voters", "observers"}
ReservedNodeIDs are reserved node IDs.
var ReservedPrefixes = []StoragePrefix{ RegistryPrefix, ConsensusPrefix, }
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 ¶
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 ¶
IsReservedPrefix returns true if the given key is reserved.
func IsValidID ¶ added in v0.10.0
IsValidID returns true if the given identifier is valid and safe to be saved to storage.
func IsValidIDOrWildcard ¶ added in v0.11.0
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
IsValidNodeID returns true if the given node ID is valid and safe to be saved to storage.
func IsValidPathID ¶ added in v0.12.0
IsValidPathID returns true if the given identifier is valid and safe to be saved to storage.
func MeshNodesEqual ¶
MeshNodesEqual compares two mesh nodes for equality.
func ToPrefixes ¶
ToPrefixes converts a list of CIDRs to a list of Prefixes. It silently ignores invalid CIDRs.
func TruncateID ¶ added in v0.10.4
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
TruncateIDTo is a helper method to truncate IDs as needed when they are too long and can be safely truncated.
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 ¶
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 ¶
Edge is the graph.Edge implementation for the mesh network.
func (Edge) ToMeshEdge ¶
ToMeshEdge converts an Edge to a MeshEdge.
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
Group wraps a group.
func (Group) ContainsNode ¶ added in v0.14.11
ContainsNode returns true if the group contains the node.
func (Group) DeepCopyInto ¶ added in v0.9.2
DeepCopyInto copies the node into the given group.
func (Group) MarshalProtoJSON ¶ added in v0.10.0
MarshalProtoJSON marshals the group to JSON.
func (*Group) UnmarshalProtoJSON ¶ added in v0.10.0
UnmarshalProtoJSON unmarshals the group from JSON.
type MeshEdge ¶
MeshEdge wraps a mesh edge.
func (MeshEdge) AsGraphEdge ¶
AsGraphEdge converts a MeshEdge to a graph.Edge.
func (MeshEdge) DeepCopyInto ¶ added in v0.9.4
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
MarshalProtoJSON marshals a MeshEdge to JSON.
func (*MeshEdge) UnmarshalProtoJSON ¶ added in v0.10.0
UnmarshalProtoJSON unmarshals a MeshEdge from JSON.
type MeshNode ¶
MeshNode wraps a mesh node.
func ValidateMeshNode ¶ added in v0.11.0
ValidateMeshNode validates the mesh node. It also dedups wireguard endpoints, adds a joined timestamp, and returns the modified node.
func (MeshNode) DecodePublicKey ¶ added in v0.14.11
DecodePublicKey decodes the public key of this node.
func (MeshNode) DeepCopyInto ¶ added in v0.9.2
DeepCopyInto copies the node into the given node.
func (MeshNode) DeepEqual ¶ added in v0.9.2
DeepEqual returns true if the node is deeply equal to the given node.
func (MeshNode) HasFeature ¶
HasFeature returns true if the node has the given feature.
func (MeshNode) MarshalProtoJSON ¶ added in v0.10.0
MarshalProtoJSON marshals the node to JSON.
func (MeshNode) PortFor ¶
PortFor returns the port for the given feature, or 0 if the feature is not available on this node.
func (MeshNode) PrivateAddrV4 ¶
PrivateAddrV4 returns the node's private IPv4 address. Be sure to check if the returned Addr IsValid.
func (MeshNode) PrivateAddrV6 ¶
PrivateAddrV6 returns the node's private IPv6 address. Be sure to check if the returned Addr IsValid.
func (MeshNode) PrivateDNSAddrV4 ¶
PrivateDNSAddrV4 returns the private IPv4 address for the node's DNS server. Be sure to check if the returned AddrPort IsValid.
func (MeshNode) PrivateDNSAddrV6 ¶
PrivateDNSAddrV6 returns the private IPv6 address for the node's DNS server. Be sure to check if the returned AddrPort IsValid.
func (MeshNode) PrivateRPCAddrV4 ¶
PrivateRPCAddrV4 returns the private IPv4 address for the node's RPC server. Be sure to check if the returned AddrPort IsValid.
func (MeshNode) PrivateRPCAddrV6 ¶
PrivateRPCAddrV6 returns the private IPv6 address for the node's RPC server. Be sure to check if the returned AddrPort IsValid.
func (MeshNode) PrivateStorageAddrV4 ¶
PrivateStorageAddrV4 returns the private IPv4 address for the node's raft listener. Be sure to check if the returned AddrPort IsValid.
func (MeshNode) PrivateStorageAddrV6 ¶
PrivateStorageAddrV6 returns the private IPv6 address for the node's raft listener. Be sure to check if the returned AddrPort IsValid.
func (MeshNode) PrivateTURNAddrV4 ¶
PrivateTURNAddrV4 returns the private IPv4 address for the node's TURN server. Be sure to check if the returned AddrPort IsValid.
func (MeshNode) PrivateTURNAddrV6 ¶
PrivateTURNAddrV6 returns the private IPv6 address for the node's TURN server. Be sure to check if the returned AddrPort IsValid.
func (MeshNode) PublicDNSAddr ¶
PublicDNSAddr returns the public address for the node's DNS server. Be sure to check if the returned AddrPort IsValid.
func (MeshNode) PublicRPCAddr ¶
PublicRPCAddr returns the public address for the node's RPC server. Be sure to check if the returned AddrPort IsValid.
func (MeshNode) StoragePort ¶
StoragePort returns the node's Storage port.
func (*MeshNode) UnmarshalProtoJSON ¶ added in v0.10.0
UnmarshalProtoJSON unmarshals the node from JSON.
func (MeshNode) WireGuardEndpoints ¶ added in v0.10.1
WireGuardEndpoints returns all valid WireGuard endpoints as netip.AddrPorts.
func (MeshNode) WireGuardPort ¶ added in v0.10.1
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) 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.
type PeerGraphStore ¶
PeerGraphStore is the graph.Store implementation for the mesh network.
type Prefix ¶
Prefix is wraps a netip.Prefix with a custom JSON marshaller.
func MustParsePrefix ¶ added in v0.14.0
MustParsePrefix parses a string into a Prefix and panics on error.
func ParsePrefix ¶ added in v0.14.0
ParsePrefix parses a string into a Prefix.
func (Prefix) MarshalJSON ¶ added in v0.14.0
MarshalJSON marshals a Prefix as a string.
func (*Prefix) UnmarshalJSON ¶ added in v0.14.0
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 (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) 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
Role wraps a role.
func (Role) DeepCopyInto ¶ added in v0.9.2
DeepCopyInto copies the node into the given role.
func (Role) MarshalProtoJSON ¶ added in v0.10.0
MarshalProtoJSON marshals the role to JSON.
func (*Role) UnmarshalProtoJSON ¶ added in v0.10.0
UnmarshalProtoJSON unmarshals the role from JSON.
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.
type Route ¶
Route wraps a Route.
func (Route) DeepCopyInto ¶ added in v0.9.2
DeepCopyInto copies the node into the given route.
func (*Route) DestinationPrefixes ¶
DestinationPrefixes returns the destination prefixes for the route.
func (Route) MarshalProtoJSON ¶ added in v0.10.0
MarshalProtoJSON marshals the route to protobuf json.
func (*Route) UnmarshalProtoJSON ¶ added in v0.10.0
UnmarshalProtoJSON unmarshals the route from a protobuf.
type Routes ¶
type Routes []Route
Routes is a list of routes.
func (Routes) Less ¶
Less returns whether the name of the route at index i is less than the name of the route at index 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.