opengraph

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

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	Start      NodeId
	End        NodeId
	Kind       EdgeKind
	Properties Properties
}

type EdgeKind

type EdgeKind string

type EdgeKindDef

type EdgeKindDef struct {
	Kind        EdgeKind
	Description string
	Traversable bool
}

type Graph

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

func LoadFrom

func LoadFrom(filename string) (*Graph, error)

func New

func New(sourceKind NodeKind) *Graph

func (*Graph) AddEdge

func (graph *Graph) AddEdge(kind EdgeKind, start NodeId, end NodeId, props ...Properties) (*Edge, error)

func (*Graph) AddNode

func (graph *Graph) AddNode(id NodeId, kinds []NodeKind, props Properties) (*Node, error)

func (*Graph) MarshalJSON

func (graph *Graph) MarshalJSON() ([]byte, error)

func (*Graph) Merge

func (graph *Graph) Merge(other *Graph)

func (*Graph) ToJSON

func (graph *Graph) ToJSON(sorted bool) ([]byte, error)

type Node

type Node struct {
	ID         NodeId     `json:"id"`
	Kinds      []NodeKind `json:"kinds"`
	Properties Properties `json:"properties,omitempty"`
}

type NodeId

type NodeId string

type NodeKind

type NodeKind string

type NodeKindDef

type NodeKindDef struct {
	Kind        NodeKind
	DisplayName string
	Description string
	Icon        string
	Color       string
	IsDisplay   bool
}

type Properties

type Properties map[string]any

type Relation

type Relation struct {
	StartKind   NodeKind
	EdgeKind    EdgeKind
	EndKind     NodeKind
	Traversable bool
}

type Schema

type Schema struct {
	BaseKind    NodeKind
	Name        string
	DisplayName string
	Version     string
	Namespace   string
	// contains filtered or unexported fields
}

func NewSchema

func NewSchema(baseKind NodeKind, name, displayName, version, namespace string) *Schema

func (*Schema) AddEdgeKind

func (s *Schema) AddEdgeKind(kind EdgeKind, description string, traversable bool, relations ...Relation) EdgeKind

func (*Schema) AddEnvironment

func (s *Schema) AddEnvironment(envKind, sourceKind NodeKind, principalKinds ...NodeKind) *Schema

func (*Schema) AddNodeKind

func (s *Schema) AddNodeKind(kind NodeKind, displayName, description, icon, color string, isDisplay bool) NodeKind

func (*Schema) DeriveFrom

func (s *Schema) DeriveFrom(g *Graph, lookup func(*Edge, *Node, *Node) (Relation, error), extra ...*NodeKindDef) *Schema

DeriveFrom returns a new Schema that copies all static kind definitions from s, merges any extra node kind definitions, and populates relations by walking the edges in g. The original schema s is not modified.

func (*Schema) EdgeKindDefs

func (s *Schema) EdgeKindDefs() []*EdgeKindDef

func (*Schema) Extend

func (s *Schema) Extend(nodeKinds []*NodeKindDef, relations ...Relation) *Schema

Extend returns a new Schema that copies all kind definitions from s and appends the given extra node kind definitions and relations. The original schema is not modified.

func (*Schema) Filter

func (s *Schema) Filter(pred func(Relation) bool) *Schema

Filter returns a new Schema containing only the relations for which pred returns true, and the node kind definitions referenced by those relations.

func (*Schema) Neighbourhood

func (s *Schema) Neighbourhood(kind NodeKind) *Schema

Neighbourhood returns a new Schema containing only the relations where kind appears as start or end, and the node kind definitions referenced by those relations.

func (*Schema) NodeKindDefs

func (s *Schema) NodeKindDefs() []*NodeKindDef

func (*Schema) Relations

func (s *Schema) Relations() []Relation

Relations returns the relations (start/edge/end triples).

func (*Schema) ToModelJSON

func (s *Schema) ToModelJSON() ([]byte, error)

ToModelJSON produces the BloodHound custom_types registration payload.

func (*Schema) ToSchemaJSON

func (s *Schema) ToSchemaJSON() ([]byte, error)

ToSchemaJSON produces the full schema.json document.

func (*Schema) Types

func (s *Schema) Types() []*NodeKindDef

Types returns the node kind definitions for all kinds that appear in the derived relations. If no relations have been derived, all registered kinds are returned. Kinds not present in the schema registry are returned with minimal definitions.

type SchemaEnvironment

type SchemaEnvironment struct {
	EnvironmentKind NodeKind   `json:"environment_kind"`
	SourceKind      NodeKind   `json:"source_kind"`
	PrincipalKinds  []NodeKind `json:"principal_kinds"`
}

Jump to

Keyboard shortcuts

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