Documentation
¶
Overview ¶
Package pulse manages authentication session lifecycle across a scan. It detects session expiry (redirect to login, 401/403 responses, body changes), re-authenticates using a stored profile, and resumes scanning. This enables long-running thorough scans without manual intervention.
Index ¶
- type Baseline
- type Beat
- func (b *Beat) Alive(client *http.Client) bool
- func (b *Beat) CookieHeader() string
- func (b *Beat) Jar() http.CookieJar
- func (b *Beat) Round(client *http.Client, method, rawURL string, body io.Reader) (*http.Response, error)
- func (b *Beat) Snapshot(client *http.Client) error
- func (b *Beat) Stay(client *http.Client) (*Beat, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Baseline ¶
type Baseline struct {
Status int
BodyLen int
BodyHash string // simple fingerprint
Redirects bool
Location string
}
Baseline captures the healthy-state response signature.
type Beat ¶
type Beat struct {
Name string
Target string
Cookies []*http.Cookie
Headers map[string]string
Baseline *Baseline // snapshot of a healthy session response
// contains filtered or unexported fields
}
Beat tracks one session's health and renewal state.
func New ¶
func New(name, target string, cookies []*http.Cookie, headers map[string]string, renewFn func() (*Beat, error)) *Beat
New creates a fresh session Beat. Provide a renew function that can re-authenticate and return a new Beat when the session expires.
func (*Beat) Alive ¶
Alive returns true if the session is still valid. It sends a probe request and compares against the baseline signature.
func (*Beat) CookieHeader ¶
CookieHeader returns the Cookie header value for the session.
func (*Beat) Round ¶
func (b *Beat) Round(client *http.Client, method, rawURL string, body io.Reader) (*http.Response, error)
Round sends a request through the session. If the session is dead, it renews and retries once. Returns the final response.