types

package
v5.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: Apache-2.0 Imports: 20 Imported by: 23

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AmassRangerEntry

type AmassRangerEntry interface {
	Network() net.IPNet
	AutonomousSystem() int
	Source() *Source
}

type Asset

type Asset struct {
	Session uuid.UUID `json:"sessionToken,omitempty"`
	Name    string    `json:"assetName,omitempty"`
	Data    AssetData `json:"data,omitempty"`
}

type AssetData

type AssetData struct {
	OAMAsset oam.Asset     `json:"asset"`
	OAMType  oam.AssetType `json:"type"`
}

type AssetPipeline

type AssetPipeline struct {
	Pipeline *pipeline.Pipeline
	Queue    *PipelineQueue
}

type Association added in v5.1.1

type Association struct {
	Submission  *dbt.Entity
	ScopeChange bool
	BestMatch   *dbt.Entity
	Evidence    []*dbt.Entity
	Rationale   string
	Confidence  int
}

type Backlog added in v5.1.1

type Backlog interface {
	Has(e *dbt.Entity) bool

	Enqueue(e *dbt.Entity) error
	EnqueueDone(e *dbt.Entity) error

	// ClaimNext leases up to num entities of this asset type.
	// Claimed items will not be returned again until Ack/Release or lease expiry.
	ClaimNext(atype oam.AssetType, num int) ([]*dbt.Entity, error)

	// Ack marks completion (done). Call on actual completion (e.g. pipeline finished).
	Ack(e *dbt.Entity, enforceOwner bool) error

	// Release returns a leased item back to queued (e.g. backpressure/admission failure).
	Release(e *dbt.Entity, atype oam.AssetType, enforceOwner bool) error

	Counts(atype oam.AssetType) (queued, leased, done int64, err error)

	Delete(e *dbt.Entity) error
	Close() error

	// Optional knobs:
	SetOwner(owner string)
	SetLeaseTTL(ttl time.Duration)
}

Backlog is the durable, per-session work backlog with claim/lease semantics. Items are:

  • Enqueued (queued)
  • Claimed (leased/in-flight)
  • Acked (done) or Released (returned to queued)

type Dispatcher

type Dispatcher interface {
	DispatchEvent(e *Event) error
	Shutdown()
}

type EmailMeta

type EmailMeta struct {
	VerifyAttempted bool
	Verified        bool
}

type Event

type Event struct {
	Name       string
	Entity     *dbt.Entity
	Meta       any
	Dispatcher Dispatcher
	Session    Session
}

type EventDataElement

type EventDataElement struct {
	Event *Event
	Error error
	Exit  chan *EventDataElement
	Ref   any
}

func NewEventDataElement

func NewEventDataElement(e *Event) *EventDataElement

func (*EventDataElement) Clone

func (ede *EventDataElement) Clone() pipeline.Data

type Handler

type Handler struct {
	Plugin       Plugin
	Name         string
	Position     int
	Exclusive    bool
	MaxInstances int
	EventType    oam.AssetType
	Transforms   []string
	Callback     func(*Event) error
}

type PipelineQueue

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

func NewPipelineQueue

func NewPipelineQueue() *PipelineQueue

func (*PipelineQueue) Append added in v5.1.1

func (pq *PipelineQueue) Append(data *EventDataElement) error

func (*PipelineQueue) Data

func (pq *PipelineQueue) Data() pipeline.Data

Data implements the pipeline InputSource interface.

func (*PipelineQueue) Drain added in v5.1.1

func (pq *PipelineQueue) Drain()

func (*PipelineQueue) Error

func (pq *PipelineQueue) Error() error

Error implements the pipeline InputSource interface.

func (*PipelineQueue) Len added in v5.1.1

func (pq *PipelineQueue) Len() int

func (*PipelineQueue) Next

func (pq *PipelineQueue) Next(ctx context.Context) bool

Next implements the pipeline InputSource interface.

type Plugin

type Plugin interface {
	Name() string
	Start(r Registry) error
	Stop()
}

type Registry

type Registry interface {
	Log() *slog.Logger
	RegisterHandler(h *Handler) error
	BuildAssetPipeline(ctx context.Context, atype oam.AssetType) (*AssetPipeline, error)
}

type Scope added in v5.1.1

type Scope interface {
	// Methods for modifying and querying the scope
	Add(a oam.Asset) bool
	IsAssetInScope(a oam.Asset, conf int) (oam.Asset, int)
	AddBlacklist(name string)
	IsBlacklisted(a oam.Asset) bool

	// Methods that support detecting association
	IsAssociated(req *Association) ([]*Association, error)
	AssetsWithAssociation(asset *dbt.Entity) []*dbt.Entity

	// Methods for adding and getting FQDNs
	Domains() []string
	FQDNs() []*oamdns.FQDN
	AddDomain(d string) bool

	// Methods for adding and getting IP addresses
	Addresses() []string
	AddAddress(addr string) bool
	IPAddresses() []*oamnet.IPAddress

	// Methods for adding and getting Netblocks
	CIDRs() []string
	AddCIDR(cidr string) bool
	Netblocks() []*oamnet.Netblock

	// Methods for adding and getting autonomous systems
	ASNs() []int
	AddASN(asn int) bool
	AutonomousSystems() []*oamnet.AutonomousSystem

	// Methods for adding and getting Organizations
	AddOrgByName(o string) bool
	Organizations() []*oamorg.Organization

	// Methods for adding and getting Locations
	Locations() []*oamcon.Location
	AddLocation(loc *oamcon.Location) bool
}

type Session

type Session interface {
	ID() uuid.UUID
	Ctx() context.Context
	Log() *slog.Logger
	PubSub() *pubsub.Logger
	NetSem() SessionSemaphone
	Config() *config.Config
	Scope() Scope
	StartTime() time.Time
	DB() repository.Repository
	Backlog() Backlog
	Pipelines() SessionPipelines
	Clients() *SessionHTTPClients
	CIDRanger() cidranger.Ranger
	TmpDir() string
	Stats() *SessionStats
	Done() bool
	Kill()
}

type SessionHTTPClients added in v5.1.1

type SessionHTTPClients struct {
	General *http.Client
	Probe   *http.Client
	Crawl   *http.Client
}

type SessionManager

type SessionManager interface {
	NewSession(cfg *config.Config) (Session, error)
	AddSession(s Session) error
	CancelSession(id uuid.UUID)
	GetSession(id uuid.UUID) Session
	GetSessions() []Session
	Shutdown()
}

type SessionPipelines added in v5.1.1

type SessionPipelines map[oam.AssetType]*AssetPipeline

type SessionSemaphone added in v5.1.1

type SessionSemaphone interface {
	Acquire()
	Release()
}

type SessionStats

type SessionStats struct {
	sync.RWMutex
	WorkItemsCompleted int `json:"workItemsCompleted"`
	WorkItemsTotal     int `json:"workItemsTotal"`
}

type Source

type Source struct {
	Name       string
	Confidence int
}

Jump to

Keyboard shortcuts

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