Help us shape the future of Go! Take the 2026 Go Developer Survey

source

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnrichFromVuln

func EnrichFromVuln(entry *PackageEntry, vuln *malindex.Vulnerability)

EnrichFromVuln fills display fields on entry from vuln.

func FeedTime

func FeedTime(e PackageEntry) time.Time

FeedTime is the disclosure timestamp used for --since filtering, sorting, dashboard age buckets, and card header badges (published date only).

func FormatShare

func FormatShare(share float64) string

FormatShare returns a short percent string for display.

func InFeedWindow

func InFeedWindow(e PackageEntry, since time.Time) bool

InFeedWindow reports whether e was published on or after since.

func SortPackageEntriesByPublished

func SortPackageEntriesByPublished(entries []PackageEntry)

SortPackageEntriesByPublished sorts entries newest-published-first.

Types

type CorpusStats

type CorpusStats struct {
	Source          string `json:"source,omitempty"`
	IndexedPackages int    `json:"indexed_packages,omitempty"`
	LastSync        string `json:"last_sync,omitempty"`
	PendingSync     int    `json:"pending_sync,omitempty"`
}

CorpusStats describes the local malicious-package index snapshot.

type CountBucket

type CountBucket struct {
	Label string  `json:"label"`
	Count int     `json:"count"`
	Share float64 `json:"share_percent,omitempty"`
}

CountBucket is a labeled count with optional share (0–100).

type PackageEntry

type PackageEntry struct {
	Ecosystem   string    `json:"ecosystem"`
	Name        string    `json:"name"`
	Version     string    `json:"version,omitempty"`
	PackageURL  string    `json:"registry_url,omitempty"`
	IDs         []string  `json:"ids"`
	Aliases     []string  `json:"aliases,omitempty"`
	ModifiedAt  time.Time `json:"modified_at"`
	Published   time.Time `json:"published_at,omitempty"`
	ImportedAt  time.Time `json:"imported_at,omitempty"`
	Summary     string    `json:"summary,omitempty"`
	Withdrawn   bool      `json:"withdrawn"`
	Quarantined bool      `json:"quarantined,omitempty"`
}

func EntryFromVuln

func EntryFromVuln(v *malindex.Vulnerability) PackageEntry

EntryFromVuln builds a display entry from a full OSV record.

func FilterPackageEntriesByFeedTime

func FilterPackageEntriesByFeedTime(entries []PackageEntry, since time.Time) []PackageEntry

FilterPackageEntriesByFeedTime keeps entries published within the active window.

type WindowStats

type WindowStats struct {
	Advisories     int           `json:"advisories"`
	UniquePackages int           `json:"unique_packages"`
	Ecosystems     []CountBucket `json:"ecosystems,omitempty"`
	Namespaces     []CountBucket `json:"namespaces,omitempty"`
	Age            []CountBucket `json:"age,omitempty"`
	Withdrawn      int           `json:"withdrawn"`
	WithAliases    int           `json:"with_aliases"`
}

WindowStats aggregates feed entries in the active --since window.

func ComputeWindowStats

func ComputeWindowStats(entries []PackageEntry) WindowStats

ComputeWindowStats builds dashboard metrics from all entries in the feed window.

Jump to

Keyboard shortcuts

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