Documentation
¶
Index ¶
Constants ¶
View Source
const ( // IncomingEdge is an edge inbound. IncomingEdge edgeDirection = iota // OutgoingEdge is an edge outbound. OutgoingEdge )
Variables ¶
This section is empty.
Functions ¶
func GetRecordsNamesForGraphables ¶
GetRecordsNamesForGraphables returns names in a graph.
Types ¶
type Dependency ¶
type Dependency struct {
NameFQDN string
Type DependencyType
// CNAME would generate Dependency{NameFQDN: target, OnlyType: ""}
// because the dependency is on the target.
//
// However a DS's dependency is on its own label, not the target.
// A DS needs to specify that the dependency is on the NS record at the same label.
// Therefore a DS record returns Dependency{NameFQDN: label, OnlyType: "NS"}
// to indicate that the dependency is only for NS records.
// If OnlyType were "", a DS would also depend on the *other* DS records at its
// label; with two or more DS there, they'd depend on each other and dnsgraph
// reports a cycle.
OnlyType string
}
Dependency is a dependency.
type DependencyType ¶
type DependencyType uint8
DependencyType enumerates the dependency types.
const ( // ForwardDependency is a forward dependency. ForwardDependency DependencyType = iota // BackwardDependency is a backwards dependency. BackwardDependency )
type Edge ¶
type Edge[T Graphable] struct { Dependency Dependency Node *Node[T] Direction edgeDirection }
Edge an edge on the graph.
type Edges ¶
Edges a list of edges.
func (Edges[T]) Contains ¶
Contains returns true if a node is in the graph AND is in that direction.
func (Edges[T]) RemoveNode ¶
RemoveNode removes a node edges.
type Graph ¶
type Graph[T Graphable] struct { All dnsGraphNodes[T] Tree *dnstree.DomainTree[dnsGraphNodes[T]] }
Graph a graph.
func CreateGraph ¶
CreateGraph returns a graph.
func (*Graph[T]) AddEdge ¶
func (graph *Graph[T]) AddEdge(sourceNode *Node[T], dependency Dependency)
AddEdge adds an edge to a graph.
func (*Graph[T]) RemoveNode ¶
RemoveNode removes a node from a graph.
type Graphable ¶
type Graphable interface {
GetType() NodeType
GetName() string
// GetRecordType returns the DNS record type (e.g. "NS", "DS") of the node.
// It is used to satisfy Dependency.OnlyType filters.
GetRecordType() string
GetDependencies() []Dependency
}
Graphable is an interface for things that can be in a graph.
Click to show internal directories.
Click to hide internal directories.