dnsgraph

package
v4.10.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 1 Imported by: 0

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

func GetRecordsNamesForGraphables[T Graphable](graphables []T) []string

GetRecordsNamesForGraphables returns names in a graph.

Types

type Dependency

type Dependency struct {
	NameFQDN string
	Type     DependencyType
}

Dependency is a dependency.

func CreateDependencies

func CreateDependencies(dependencyFQDNs []string, dependencyType DependencyType) []Dependency

CreateDependencies creates a dependency list from a list of FQDNs and a DepenendyType.

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 added in v4.7.3

type Edge[T Graphable] struct {
	Dependency Dependency
	Node       *Node[T]
	Direction  edgeDirection
}

Edge an edge on the graph.

type Edges added in v4.7.3

type Edges[T Graphable] []Edge[T]

Edges a list of edges.

func (Edges[T]) Contains added in v4.7.3

func (edges Edges[T]) Contains(toFind *Node[T], direction edgeDirection) bool

Contains returns true if a node is in the graph AND is in that direction.

func (Edges[T]) RemoveNode added in v4.7.3

func (edges Edges[T]) RemoveNode(toRemove *Node[T]) Edges[T]

RemoveNode removes a node from a graph.

type Graph added in v4.7.3

type Graph[T Graphable] struct {
	All  dnsGraphNodes[T]
	Tree *dnstree.DomainTree[dnsGraphNodes[T]]
}

Graph a graph.

func CreateGraph

func CreateGraph[T Graphable](entries []T) *Graph[T]

CreateGraph returns a graph.

func (*Graph[T]) AddEdge added in v4.7.3

func (graph *Graph[T]) AddEdge(sourceNode *Node[T], dependency Dependency)

AddEdge adds an edge to a graph.

func (*Graph[T]) AddNode added in v4.7.3

func (graph *Graph[T]) AddNode(data T)

AddNode adds a node to a graph.

func (*Graph[T]) RemoveNode added in v4.7.3

func (graph *Graph[T]) RemoveNode(toRemove *Node[T])

RemoveNode removes a node from a graph.

type Graphable

type Graphable interface {
	GetType() NodeType
	GetName() string
	GetDependencies() []Dependency
}

Graphable is an interface for things that can be in a graph.

type Node added in v4.7.3

type Node[T Graphable] struct {
	Data  T
	Edges Edges[T]
}

Node a node in the graph.

type NodeType

type NodeType uint8

NodeType enumerates the node types.

const (
	// Change is the type of change.
	Change NodeType = iota
	// Report is a Report.
	Report
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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