Class: NetworkInterceptor

Constructor

new NetworkInterceptor()

Methods

getClientIp() → {string}

Returns the captured public client IP, or an empty string if not yet resolved.

getDomain() → {string}

Returns the captured domain. Priorities: 1. Captured Origin from request headers (if any) 2. window.location.hostname

getTrustedTime() → {number|null}

Returns the current trusted time (server time) if available.

init()

Initialize interception - must be called after Logger is available.

updateClientIpFromTraceBody(traceBody)

Captures the public client IP from a Cloudflare /cdn-cgi/trace response body. The trace response is plain text with one key=value per line; we extract the `ip=` line. Safe to call repeatedly; the most recent value wins.
Parameters:
Name Type Description
traceBody string Plain-text body of the Cloudflare trace response.

updateTimeFromHeader(dateHeader)

Updates the trusted time from a Date header string. Can be called externally (e.g., from Shaka response filters).
Parameters:
Name Type Description
dateHeader string | null The Date header value from a response.