httpstack

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package httpstack builds the standalone HTTP stack a command sends target traffic through outside the native-scan Runner: a reference on the shared network dialer, a dedup manager, a per-host concurrency limiter, an optional global rate limit, and one egress gate over them, behind a Requester.

The direct scan-url / scan-request path, ingest, finding verify, session check, kit param-mine and the extension test runner each used to hand-assemble this stack, and the copies had drifted: several took a network.Init reference they never released. New pairs every piece with Close.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HostLimiterConfig

func HostLimiterConfig(maxPerHost, maxHosts int, wafPacing, noWafPacing bool) hostlimit.HostRateLimiterConfig

HostLimiterConfig is the per-host limiter config a stack runs with: at most maxPerHost concurrent requests per host (0 = the limiter's default), up to maxHosts tracked hosts (0 = default), and, under wafPacing, the scan's WAF pacing (reactive back-off, plus proactive pre-arm unless noWafPacing). Eviction uses the limiter's defaults. The Runner builds its own limiter from this too, adding adaptive pacing.

Types

type Config

type Config struct {
	// Options are the requester's options and the network policy the shared
	// dialer is initialized with. Required.
	Options *types.Options
	// MaxHosts caps how many hosts the per-host limiter tracks (0 = the
	// limiter's default, 1000). A stack that talks to a handful of hosts
	// passes a small cap.
	MaxHosts int
	// WafPacing paces a host the way a scan does: reactive back-off once it
	// returns WAF/CDN blocks, plus the proactive edge pre-arm unless
	// Options.NoWafPacing.
	WafPacing bool
	// RateLimit caps requests per second across the stack (0 = no global cap;
	// fractions allowed; burst 1).
	RateLimit float64
	// Budget is the request budget the egress gate holds the stack to (nil =
	// none). A refused request fails fast.
	Budget *egress.Budget
}

Config configures New.

type Stack

type Stack struct {
	Requester *http.Requester
	Services  *services.Services
	// contains filtered or unexported fields
}

Stack is a Requester and the Services behind it. Close releases them.

func New

func New(cfg Config) (*Stack, error)

New builds the stack. It takes a reference on the process network dialer (network.Init) that Close returns; on error nothing is left held.

func (*Stack) Close

func (s *Stack) Close()

Close releases the dedup manager, the host limiter and the network reference. Nil-safe and idempotent.

Jump to

Keyboard shortcuts

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