graph

package
v0.0.0-...-3d855e8 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2018 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OR_REL is a constant used to designate the OR relationship in RelationshipNode instances
	OR_REL = iota
	// AND_REL is a constant used to designate the AND relationship in RelationshipNode instances
	AND_REL
)

Variables

This section is empty.

Functions

func DrawGraph

func DrawGraph(g Node, criticalNodes []CriticalNode) (*gographviz.Graph, string)

DrawGraph initializes a graphviz graph instance rooted on g, then returns it, along with the "root" node of that "subgraph" (since g could be the children of another node). Members of the criticalNodes are highlighted.

Types

type AliasNode

type AliasNode struct {
	// contains filtered or unexported fields
}

AliasNode represents a CNAME in the dependency graph of a name.

func NewAliasNode

func NewAliasNode(target, source string) *AliasNode
NewAliasNode returns a new instance of AliasNode after initializing it.

target is the right-hand name of the CNAME RR

source is the owner name of the CNAME RR

func (*AliasNode) MarshalJSON

func (n *AliasNode) MarshalJSON() ([]byte, error)

Implements json.Marshaler

func (*AliasNode) Source

func (n *AliasNode) Source() string

func (*AliasNode) String

func (n *AliasNode) String() string

func (*AliasNode) Target

func (n *AliasNode) Target() string

func (*AliasNode) UnmarshalJSON

func (n *AliasNode) UnmarshalJSON(bstr []byte) error

Implements json.Unmarshaler

type CriticalASN

type CriticalASN struct {
	ASN int `json:"asn"`
}

type CriticalAlias

type CriticalAlias struct {
	Source string `json:"source"`
	Target string `json:"target"`
}

type CriticalIP

type CriticalIP struct {
	IP net.IP `json:"ip"`
}

type CriticalName

type CriticalName struct {
	Name string `json:"name"`
}

type CriticalNode

type CriticalNode interface {
	// contains filtered or unexported methods
}

type CriticalPrefix

type CriticalPrefix struct {
	Prefix net.IP `json:"prefix"`
}

type Cycle

type Cycle struct {
	// contains filtered or unexported fields
}

Cycle instances represent parts of the graph where circular dependencies are detected. During analysis, they signify that this branch of the graph is always invalid.

func (*Cycle) MarshalJSON

func (c *Cycle) MarshalJSON() ([]byte, error)

Implements json.Marshaler

func (*Cycle) String

func (c *Cycle) String() string

func (*Cycle) UnmarchalJSON

func (c *Cycle) UnmarchalJSON([]byte) error

Implements json.Unmarshaler

type DomainNameNode

type DomainNameNode struct {
	// contains filtered or unexported fields
}

DomainNameNode represents a domain name or an alias of a name within the dependency tree As a metadata, if a node represents a zone apex, a DNSSEC indicator is set if there is a DS record for this name.

func NewDomainNameNode

func NewDomainNameNode(domain string, dnssecProtected bool) *DomainNameNode

NewDomainNameNode returns a new DomainNameNode instance and initializes it with the domain name and the DNSSEC indicator

func (*DomainNameNode) DNSSECProtected

func (n *DomainNameNode) DNSSECProtected() bool

func (*DomainNameNode) Domain

func (n *DomainNameNode) Domain() string

func (*DomainNameNode) MarshalJSON

func (n *DomainNameNode) MarshalJSON() ([]byte, error)

Implements json.Marshaler

func (*DomainNameNode) String

func (n *DomainNameNode) String() string

func (*DomainNameNode) UnmarshalJSON

func (n *DomainNameNode) UnmarshalJSON(bstr []byte) error

Implements json.Unmarshaler

type IPNode

type IPNode struct {
	// contains filtered or unexported fields
}

func NewIPNode

func NewIPNode(ip string, asn int) (n *IPNode)

func NewIPNodeWithName

func NewIPNodeWithName(ip string, dn string, asn int) *IPNode

func (*IPNode) ASN

func (n *IPNode) ASN() int

func (*IPNode) IP

func (n *IPNode) IP() string

func (*IPNode) IsV4

func (n *IPNode) IsV4() bool

func (*IPNode) MarshalJSON

func (n *IPNode) MarshalJSON() ([]byte, error)

func (*IPNode) Prefix

func (n *IPNode) Prefix() string

func (*IPNode) String

func (n *IPNode) String() string

func (*IPNode) UnmarshalJSON

func (n *IPNode) UnmarshalJSON(bstr []byte) error

type LeafNode

type LeafNode interface {
	Node
	// contains filtered or unexported methods
}

A LeafNode is, as the name implies a leaf node in a dependency tree. The only difference with the Node interface is that LeadNode instances can be compared using the similar() method.

type Node

type Node interface {
	String() string
	// contains filtered or unexported methods
}

A node is an intermediary node (RelationshipNode) or a LeafNode in a dependency graph.

type RelationshipNode

type RelationshipNode struct {
	// contains filtered or unexported fields
}

RelationshipNode instances represents intermediary nodes in the dependency graph. RelationshipNode are N-ary trees, not necessarily binary trees. Children of such a node are related following either an "and" or an "or" boolean expression.

func NewRelationshipNode

func NewRelationshipNode(comment string, relation int) *RelationshipNode
NewRelationshipNode returns a new RelationshipNode after initializing it.

comment is a free-form string giving some indication as to why this node exists and what it represents w.r.t. the dependency tree.

relation is either equal to AND_REL or OR_REL

func (*RelationshipNode) AddChild

func (rn *RelationshipNode) AddChild(c Node)

AddChild adds a Node to the children of the receiver. This is the main function used for tree building

func (*RelationshipNode) Analyse

func (rn *RelationshipNode) Analyse(DNSSECOnly bool, tree *iradix.Tree) []CriticalNode

Analyse is the exported version of analyse. It starts the analysis of the tree under the receiver and returns the list of mandatory nodes. IPv4 and IPv6 addresses have normal availability markers (no breakV4/breakV6)

func (*RelationshipNode) AnalyseWithoutV4

func (rn *RelationshipNode) AnalyseWithoutV4(DNSSECOnly bool, tree *iradix.Tree) ([]CriticalNode, error)

AnalyseWithoutV4 runs the same type of analysis as "Analyse" except all IPv4 addresses are marked as unavailable. This may reveal that some IPv6 are actually SPOFs when IPv4 addresses are not available. AnalyseWithoutV4 may either return the list of mandatory leafNodes or an error if the name cannot be resolved without IPv4 address participation.

func (*RelationshipNode) AnalyseWithoutV6

func (rn *RelationshipNode) AnalyseWithoutV6(DNSSECOnly bool, tree *iradix.Tree) ([]CriticalNode, error)

AnalyseWithoutV6 runs the same type of analysis as "Analyse" except all IPv6 addresses are marked as unavailable. This may reveal that some IPv4 are actually SPOFs when IPv6 addresses are not available. AnalyseWithoutV6 may either return the list of mandatory leafNodes or an error if the name cannot be resolved without IPv6 address participation.

func (*RelationshipNode) MarshalJSON

func (rn *RelationshipNode) MarshalJSON() ([]byte, error)

Implements json.Marshaler

func (*RelationshipNode) SimplifyGraph

func (rn *RelationshipNode) SimplifyGraph() *RelationshipNode

SimplifyGraph creates a copy of the tree under the receiver, simplifies the radix under the copy, by applying repetitively auxSimplyGraph and simplifyRelWithCycle until the tree is stable. The copy is then returned.

func (*RelationshipNode) String

func (rn *RelationshipNode) String() string

func (*RelationshipNode) UnmarshalJSON

func (rn *RelationshipNode) UnmarshalJSON(b []byte) error

Implements json.Unmarshaler

type WorkerAnalysisResult

type WorkerAnalysisResult struct {
	Nodes []CriticalNode
	Err   error
}

func PerformAnalyseOnResult

func PerformAnalyseOnResult(g *RelationshipNode, reqConf *tools.RequestConfig, tree *iradix.Tree) (allNamesResult, allNamesNo4Result, allNamesNo6Result, dnssecResult, dnssecNo4Result, dnssecNo6Result *WorkerAnalysisResult)

Jump to

Keyboard shortcuts

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