graph

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: Apache-2.0 Imports: 21 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graph

type Graph struct {
	DB *db.AssetDB
	// contains filtered or unexported fields
}

Graph is the object for managing a network infrastructure link graph.

func NewGraph

func NewGraph(system, path string, options string) *Graph

NewGraph returns an intialized Graph object.

func (*Graph) IsCNAMENode

func (g *Graph) IsCNAMENode(ctx context.Context, fqdn string, since time.Time) bool

IsCNAMENode returns true if the FQDN has a CNAME edge to another FQDN in the graph.

func (*Graph) IsMXNode

func (g *Graph) IsMXNode(ctx context.Context, fqdn string, since time.Time) bool

IsMXNode returns true if the FQDN has a MX edge pointing to it in the graph.

func (*Graph) IsNSNode

func (g *Graph) IsNSNode(ctx context.Context, fqdn string, since time.Time) bool

IsNSNode returns true if the FQDN has a NS edge pointing to it in the graph.

func (*Graph) IsPTRNode

func (g *Graph) IsPTRNode(ctx context.Context, fqdn string, since time.Time) bool

IsPTRNode returns true if the FQDN has a PTR edge to another FQDN in the graph.

func (*Graph) NamesToAddrs

func (g *Graph) NamesToAddrs(ctx context.Context, since time.Time, names ...string) ([]*NameAddrPair, error)

NamesToAddrs returns a NameAddrPair for each name / address combination discovered in the graph.

func (*Graph) ReadASPrefixes

func (g *Graph) ReadASPrefixes(ctx context.Context, asn int, since time.Time) []string

func (*Graph) Remove

func (g *Graph) Remove()

func (*Graph) UpsertA

func (g *Graph) UpsertA(ctx context.Context, fqdn, addr string) (*types.Asset, error)

UpsertA creates FQDN, IP address and A record edge in the graph and associates them with a source and event.

func (*Graph) UpsertAAAA

func (g *Graph) UpsertAAAA(ctx context.Context, fqdn, addr string) (*types.Asset, error)

UpsertAAAA creates FQDN, IP address and AAAA record edge in the graph and associates them with a source and event.

func (*Graph) UpsertAddress

func (g *Graph) UpsertAddress(ctx context.Context, addr string) (*types.Asset, error)

UpsertAddress creates an IP address in the graph.

func (*Graph) UpsertCNAME

func (g *Graph) UpsertCNAME(ctx context.Context, fqdn, target string) (*types.Asset, error)

UpsertCNAME adds the FQDNs and CNAME record between them to the graph.

func (*Graph) UpsertFQDN

func (g *Graph) UpsertFQDN(ctx context.Context, name string) (*types.Asset, error)

UpsertFQDN adds a fully qualified domain name to the graph.

func (*Graph) UpsertMX

func (g *Graph) UpsertMX(ctx context.Context, fqdn, target string) (*types.Asset, error)

UpsertMX adds the FQDNs and MX record between them to the graph.

func (*Graph) UpsertNS

func (g *Graph) UpsertNS(ctx context.Context, fqdn, target string) (*types.Asset, error)

UpsertNS adds the FQDNs and NS record between them to the graph.

func (*Graph) UpsertNetblock

func (g *Graph) UpsertNetblock(ctx context.Context, cidr string) (*types.Asset, error)

UpsertNetblock adds a netblock/CIDR to the graph.

func (*Graph) UpsertPTR

func (g *Graph) UpsertPTR(ctx context.Context, fqdn, target string) (*types.Asset, error)

UpsertPTR adds the FQDNs and PTR record between them to the graph.

func (*Graph) UpsertSRV

func (g *Graph) UpsertSRV(ctx context.Context, service, target string) (*types.Asset, error)

UpsertSRV adds the FQDNs and SRV record between them to the graph.

type NameAddrPair

type NameAddrPair struct {
	FQDN *domain.FQDN
	Addr *network.IPAddress
}

NameAddrPair represents a relationship between a DNS name and an IP address it eventually resolves to.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳