http
http
¶
NIP-66 HTTP metadata container with header extraction capabilities.
Captures Server and X-Powered-By HTTP headers from the WebSocket
upgrade handshake response as part of
NIP-66
monitoring. Supports both clearnet and overlay network relays (overlay
networks require a SOCKS5 proxy).
Note
Headers are captured using aiohttp's TraceConfig hooks during the
WebSocket upgrade handshake, not from a separate HTTP request. This
ensures the captured headers reflect the actual relay WebSocket endpoint
rather than a potentially different HTTP endpoint.
For clearnet relays, SSL verification is enabled by default. When
allow_insecure=True, a non-validating SSL context (CERT_NONE)
is used instead. Overlay networks always use CERT_NONE because
the proxy provides encryption. This is the only NIP-66 test that
supports both clearnet and overlay networks.
See Also
bigbrotr.nips.nip66.data.Nip66HttpData:
Data model for HTTP header fields.
bigbrotr.nips.nip66.logs.Nip66HttpLogs:
Log model for HTTP extraction results.
bigbrotr.nips.nip11.info.Nip11InfoMetadata:
NIP-11 info retrieval that also makes HTTP requests to relays (but uses
Accept: application/nostr+json for JSON document retrieval).
Classes¶
Nip66HttpMetadata
¶
Bases: BaseNipMetadata
Container for HTTP header data and extraction logs.
Provides the execute() class method that initiates a WebSocket
connection and captures server identification headers from the
upgrade response.
See Also
bigbrotr.nips.nip66.nip66.Nip66:
Top-level model that orchestrates this alongside other tests.
bigbrotr.models.metadata.MetadataType:
The NIP66_HTTP variant used when storing these results.
Functions¶
execute
async
classmethod
¶
execute(
relay: Relay,
timeout: float | None = None,
proxy_url: str | None = None,
*,
allow_insecure: bool = False,
) -> Self
Extract HTTP headers from a relay's WebSocket handshake response.
Parameters:
-
relay(Relay) –Relay to connect to.
-
timeout(float | None, default:None) –Connection timeout in seconds (default: 10.0).
-
proxy_url(str | None, default:None) –Optional SOCKS5 proxy URL (required for overlay networks).
-
allow_insecure(bool, default:False) –Use non-validating SSL for clearnet relays.
Returns:
-
Self–An
Nip66HttpMetadatainstance with header data and logs.