assets

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultWebPropertyPort = 443

DefaultWebPropertyPort is the default port that will be used if no port is specified in the input.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset interface {
	AssetType() AssetType
}

type AssetClassifier

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

AssetClassifier classifies raw string inputs into typed asset identifiers and reports errors. It also deduplicates values within each asset category.

func NewAssetClassifier

func NewAssetClassifier(rawAssets ...string) *AssetClassifier

NewAssetClassifier creates a classifier and immediately classifies the provided raw assets.

func (*AssetClassifier) AssetType

AssetType returns the type of assets that were passed to the classifier. If no assets were passed, it returns AssetTypeUnknown. If multiple asset types were passed, it returns a MixedAssetTypesError.

func (*AssetClassifier) CertificateIDs

func (a *AssetClassifier) CertificateIDs() []CertificateID

func (*AssetClassifier) HostIDs

func (a *AssetClassifier) HostIDs() []HostID

func (*AssetClassifier) KnownAssetCount

func (a *AssetClassifier) KnownAssetCount() int

KnownAssetCount returns the number of known asset types that were passed to the classifier.

func (*AssetClassifier) KnownAssetIDs

func (a *AssetClassifier) KnownAssetIDs() []string

KnownAssetIDs returns the IDs of the known asset types that were passed to the classifier.

func (*AssetClassifier) UnknownAssets

func (a *AssetClassifier) UnknownAssets() []string

func (*AssetClassifier) WebPropertyIDs

func (a *AssetClassifier) WebPropertyIDs() []WebPropertyID

type AssetType

type AssetType string

AssetType represents the inferred type for a given collection of user-supplied assets. Supported values are "host", "certificate", and "webproperty".

const (
	AssetTypeUnknown     AssetType = "unknown"
	AssetTypeHost        AssetType = "host"
	AssetTypeCertificate AssetType = "certificate"
	AssetTypeWebProperty AssetType = "webproperty"
)

func (AssetType) String

func (a AssetType) String() string

type Certificate

type Certificate struct{ components.Certificate }

Certificate represents a certificate asset. This has 1:1 correspondence with the SDK's Certificate type.

func NewCertificate

func NewCertificate(cert components.Certificate) Certificate

func (Certificate) AssetType

func (c Certificate) AssetType() AssetType

type CertificateID

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

CertificateID represents a validated SHA-256 hex string (64 chars).

func NewCertificateFingerprint

func NewCertificateFingerprint(raw string) (CertificateID, error)

NewCertificateFingerprint parses a sha256 hex string into a CertificateID.

func (CertificateID) String

func (c CertificateID) String() string

type Host

type Host struct {
	components.Host
	MatchedServices []components.MatchedService `json:"matched_services,omitempty"`
}

Host represents a host asset. This has 1:1 correspondence with the SDK's Host type.

func NewHost

func NewHost(host components.Host) Host

func NewHostWithMatchedServices

func NewHostWithMatchedServices(host components.Host, matchedServices []components.MatchedService) Host

func (Host) AssetType

func (h Host) AssetType() AssetType

type HostID

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

HostID represents a validated IP address (v4 or v6).

func NewHostID

func NewHostID(raw string) (HostID, error)

NewHostID parses an IP address into a HostID. Supports defanged IPs with [.] or (.) patterns.

func (HostID) String

func (h HostID) String() string

type InvalidAssetIDError

type InvalidAssetIDError interface {
	cenclierrors.CencliError
}

InvalidAssetIDError represents an error that occurs when an invalid asset ID is provided.

func NewInvalidAssetIDError

func NewInvalidAssetIDError(assetID string, reason string) InvalidAssetIDError

type MixedAssetTypesError

type MixedAssetTypesError interface {
	cenclierrors.CencliError
}

MixedAssetTypesError represents an error that occurs when mixed asset types are provided.

func NewMixedAssetTypesError

func NewMixedAssetTypesError(typesFound ...AssetType) MixedAssetTypesError

type NoAssetsError

type NoAssetsError interface {
	cenclierrors.CencliError
}

NoAssetsError represents an error that occurs when no assets are provided.

func NewNoAssetsError

func NewNoAssetsError() NoAssetsError

type TooManyAssetsError

type TooManyAssetsError interface {
	cenclierrors.CencliError
}

func NewTooManyAssetsError

func NewTooManyAssetsError(provided int, supported int) TooManyAssetsError

type WebProperty

type WebProperty struct{ components.Webproperty }

WebProperty represents a web property asset. This has 1:1 correspondence with the SDK's Webproperty type.

func NewWebProperty

func NewWebProperty(webProperty components.Webproperty) WebProperty

func (WebProperty) AssetType

func (w WebProperty) AssetType() AssetType

type WebPropertyID

type WebPropertyID struct {
	Hostname string
	Port     int
}

WebPropertyID represents a hostname:port tuple.

func NewWebPropertyID

func NewWebPropertyID(raw string, defaultPort int) (WebPropertyID, error)

NewWebPropertyID parses a hostname:port string into a WebPropertyID. Supports refanged URLs with http:// or https:// prefixes. Hostnames that are not IP addresses must have a period. Handles IPv6 addresses with or without brackets. For compressed IPv6 addresses (containing ::) that end with a numeric segment that could be a port (e.g., ::1:8080), an error is returned to avoid ambiguity. Use brackets to disambiguate. If no port is specified, defaultPort is used.

func (WebPropertyID) String

func (w WebPropertyID) String() string

Jump to

Keyboard shortcuts

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