utils

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 14 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateDelayWithJitter added in v0.0.257

func CalculateDelayWithJitter(baseDelaySeconds int, jitterPercent int) time.Duration

func GetEntriesFromTXTFiles added in v0.0.83

func GetEntriesFromTXTFiles(paths []string) ([]string, error)

GetEntriesFromTXTFiles returns a list of entries from a list of text files

func HostAllowed added in v0.37.0

func HostAllowed(scope *Scope, anchorURL string, candidateURL string) bool

HostAllowed reports whether candidateURL is the anchor's host, under it, or under a seed.

func HostInSeedScope added in v0.37.0

func HostInSeedScope(scope *Scope, candidateURL string) bool

HostInSeedScope reports whether candidateURL's host is under a scope domain or inside a scope CIDR.

func IsHostInScope added in v0.0.283

func IsHostInScope(baseURL string, targetURL string) bool

IsHostInScope reports whether targetURL is the same host as baseURL or a subdomain (child) of it. The comparison is case-insensitive and ignores the port. Scope is anchored on the FULL base host, so children are allowed while the apex domain and sibling subdomains are excluded. For a base of www.example.com this admits www.example.com and app.www.example.com, but not example.com (parent) or careers.example.com (sibling). IP addresses have no subdomain hierarchy, so they require an exact match.

func IsStaticAsset added in v0.0.83

func IsStaticAsset(url string) bool

IsStaticAsset returns true if the URL is a static asset, false otherwise

func IsTrailingSlashRedirect added in v0.0.97

func IsTrailingSlashRedirect(from, to string) bool

IsTrailingSlashRedirect checks if the redirect is just adding a trailing slash. Default ports are normalized so https://host:443/path and https://host/path/ are treated as the same origin.

func ParseResponseCodes added in v0.0.120

func ParseResponseCodes(responseCodes string) (map[int]bool, error)

ParseResponseCodes parses a comma-separated or range-based string of response codes (e.g., "200,301,404-410") and returns a map of valid codes.

func UnrestrictedCidrs added in v0.37.0

func UnrestrictedCidrs() []string

UnrestrictedCidrs is the CIDR list of UnrestrictedScope, for flat scope fields.

func UnrestrictedDomains added in v0.37.0

func UnrestrictedDomains() []string

UnrestrictedDomains is the domain list of UnrestrictedScope, for flat scope fields.

Types

type Scope added in v0.37.0

type Scope struct {
	Domains []string
	Cidrs   []string
}

Scope is the seed domains and CIDRs a scan may follow and report beyond its target.

func NewScope added in v0.37.0

func NewScope(domains []string, cidrs []string) (*Scope, error)

NewScope normalizes seed domains and CIDRs, returning nil when both are empty.

func ScopeOf added in v0.37.0

func ScopeOf(domains []string, cidrs []string) *Scope

ScopeOf returns the seed scope for a config's flat scope fields, or nil when both are empty.

func ScopeWithAnchor added in v0.37.0

func ScopeWithAnchor(scope *Scope, anchorURL string) *Scope

ScopeWithAnchor returns scope widened to include the anchor's host and its subdomains.

func UnrestrictedScope added in v0.37.0

func UnrestrictedScope() *Scope

UnrestrictedScope admits every host.

Directories

Path Synopsis
retry
Package retry retries rate-limited or transiently failed HTTP requests with jittered backoff.
Package retry retries rate-limited or transiently failed HTTP requests with jittered backoff.
Package useragent resolves User-Agent strings from a preset enum.
Package useragent resolves User-Agent strings from a preset enum.

Jump to

Keyboard shortcuts

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