Documentation
¶
Overview ¶
Package profile defines a browser profile. A Profile is one checked and ready to use: a small read-only value, safe to copy and to share between clients, that mimicry.Config takes. A Spec is its data, split by concern (TLS, HTTP/2, HTTP/1.1, headers by request kind, cookies, proxies, redirects, connection sharing, WebSocket, QUIC, HTTP/3), to read or to edit through Profile.With. The package loads and validates a profile from JSON, the format the harness writes browser captures in. It imports only the standard library, and internal/checked, through which the root package reads the Spec a Profile holds.
Index ¶
- Constants
- func Encode(p *Spec) ([]byte, error)
- func IsGREASE(v uint16) bool
- func IsGREASETransportParameter(id uint64) bool
- func IsGREASEVersion(v uint32) bool
- type ByteList
- type Bytes
- type Coalescing
- type Code
- type Connections
- type Context
- type Cookies
- type CredentialTiming
- type Discovery
- type ECH
- type Extension
- type Fallback
- type ForwardAuth
- type H3EarlyData
- type H3Grease
- type H3Headers
- type H3Setting
- type H3UniStream
- type HPACK
- type HPKESuite
- type HTTP1
- type HTTP2
- type HTTP3
- type Header
- type HeaderTable
- type HuffmanRule
- type Kind
- type NameMatchRule
- type PlainWebSocket
- type Priority
- type PriorityParam
- type Problem
- type Profile
- type Proxy
- type ProxyWebSocket
- type QPACK
- type QUIC
- type QUICAck
- type QUICCredit
- type QUICCrypto
- type QUICErrorCode
- type QUICGiveUp
- type QUICHello
- type QUICHelloRetry
- type QUICKeepAlive
- type QUICKeyUpdate
- type QUICLoss
- type QUICPathDegrading
- type QUICStreamsBlocked
- type QUICVersion
- type QUICVersionNegotiation
- type Range
- type Redirects
- type Resumption
- type SOCKS5
- type SOCKS5Address
- type Setting
- type SizeUpdateRule
- type Spec
- type TLS
- type TransportParameter
- type TransportParameterID
- type UploadRecords
- type Urgency
- type ValidationError
- type Variant
- type WebSocket
- type WebSocketHello
Examples ¶
Constants ¶
const ( SameSiteLax = "lax" SameSiteNone = "none" // ThirdPartySameSite sends unpartitioned cookies cross-site by their // SameSite (None only) and keys Partitioned cookies by top-level site // (Chrome). ThirdPartySameSite = "samesite" // ThirdPartyPartitionAll keeps every cookie of a cross-site context in // a jar for its top-level site, Partitioned or not (Firefox's Total // Cookie Protection). ThirdPartyPartitionAll = "partition_all" // ThirdPartyPartitionedOnly allows only Partitioned cookies in a // cross-site context (Safari). ThirdPartyPartitionedOnly = "partitioned_only" // RedirectsIgnore judges SameSite by the request URL alone (Chrome). RedirectsIgnore = "ignore" // RedirectsChain treats a request as cross-site when any URL of its // redirect chain is (Firefox). RedirectsChain = "chain" // RedirectsBlockAfterCrossSite sends no cookies on a subresource // request reached through a cross-site hop; a navigation's hops carry // theirs (Safari 27). RedirectsBlockAfterCrossSite = "block_after_cross_site" // NamelessValue makes "knoeq" a cookie with an empty name and value // "knoeq", sent as "knoeq" (Chrome; RFC 6265bis). NamelessValue = "value" // NamelessName makes it a cookie named "knoeq" with an empty value, // sent as "knoeq=" (Firefox). NamelessName = "name" // NamelessDrop ignores it (Safari). NamelessDrop = "drop" // EmptyNameKeep makes "=x" a cookie with an empty name and value "x", // sent as "x" (Chrome; RFC 6265bis). The value must not start with a // cookie prefix, in any case and after whitespace, nor hold "=". EmptyNameKeep = "keep" // EmptyNameDrop ignores it (Firefox, Safari). EmptyNameDrop = "drop" // OrderRFC sends longer paths first, then older cookies first (RFC // 6265; Chrome, Firefox). OrderRFC = "rfc" // OrderDomainName sends longer paths first, then by stored domain // (Domain cookies, stored with a leading dot, first), then by name // (Safari). OrderDomainName = "domain_name" // SameSiteScheme values. SameSiteSchemeful = "schemeful" SameSiteSchemeless = "schemeless" // HostPrefixPathAttribute requires a Path=/ attribute as sent: a // __Host- cookie without Path is refused (RFC 6265bis; Chrome, // Firefox). HostPrefixPathAttribute = "attribute" // HostPrefixPathStored requires the stored path to be "/": a __Host- // cookie without Path whose default path is "/" is kept (Safari). HostPrefixPathStored = "stored" )
Cookie policy values.
const ( OpeningPreface = "preface" OpeningSettings = "SETTINGS" OpeningWindowUpdate = "WINDOW_UPDATE" OpeningPriority = "PRIORITY" OpeningHeaders = "HEADERS" )
What HTTP2.OpeningRecords lists: the connection preface, and frames by their RFC 9113 type names.
const ( // NameMatchStaticFirst refers to the first static entry with the name, // else the newest dynamic one (Chromium, Safari). NameMatchStaticFirst NameMatchRule = "static_first" // NameMatchHighestIndex refers to the entry with the highest index: the // oldest dynamic entry before any static one (Firefox). NameMatchHighestIndex NameMatchRule = "highest_index" // HuffmanShorter codes a string only when that is strictly shorter // (Chromium, Safari). HuffmanShorter HuffmanRule = "shorter" // HuffmanAlways codes every string, even when longer (Firefox). HuffmanAlways HuffmanRule = "always" // SizeUpdatesOnChange signals a table size only when it changes // (Chromium). SizeUpdatesOnChange SizeUpdateRule = "on_change" // SizeUpdatesAlways signals every table size the server sends, even // the unchanged default 4096 (Firefox, Safari). SizeUpdatesAlways SizeUpdateRule = "always" )
HPACK name matching, Huffman and size update rules.
const ( H3SettingQPACKMaxTableCapacity = 0x01 H3SettingMaxFieldSectionSize = 0x06 H3SettingQPACKBlockedStreams = 0x07 )
HTTP/3 settings with special handling (RFC 9204, section 5; RFC 9114, section 7.2.4.1).
const ( H3StreamControl = "control" H3StreamQPACKEncoder = "qpack_encoder" H3StreamQPACKDecoder = "qpack_decoder" )
Values of H3UniStream.Type.
const ( // H3OpenAtHandshake opens the stream with its initial content in the // first 1-RTT (or 0-RTT) packets. H3OpenAtHandshake = "handshake" // H3OpenOnFirstInsert opens the encoder stream with the first request // that inserts into the dynamic table. H3OpenOnFirstInsert = "first_insert" // H3OpenOnSettings opens the encoder stream once the server's SETTINGS // allow a dynamic table, carrying only Set Dynamic Table Capacity to // the server's maximum (at most 64 KiB), and never where they do not: // a browser that announces the table and inserts nothing (Safari on // iOS, without a qpack.encoder; seen with a 64 KiB server only). H3OpenOnSettings = "settings" // H3OpenNever reserves the stream ID and never sends on it. H3OpenNever = "never" )
Values of H3UniStream.Open.
const ( // QPACKIndexAll sends every field as an index, inserting what the // dynamic table lacks before each request (Chrome). QPACKIndexAll = "index_all" // QPACKNewNames inserts once each field whose name is not in the static // table and refers to those entries later (Firefox). QPACKNewNames = "new_names" )
Values of QPACK.Encoder.
const ( // FallbackRace: a request waits for the attempt and falls back after // TCPDelayMillis (or, with ZeroRTTHolds and 0-RTT, at its give-up). FallbackRace = "race" // FallbackBackground: the attempt runs in the background; requests go // on TCP until it is up (except with Hold). FallbackBackground = "background" )
Values of Fallback.Mode.
const ( // PendingTCP retries them on TCP at once. PendingTCP = "tcp" // PendingQUIC sends them on a new QUIC connection, 0-RTT where possible. PendingQUIC = "quic" )
Values of Fallback.Pending.
const ( // SwitchNextRequest: the first request after Alt-Svc starts QUIC but // still goes on HTTP/2; later ones use QUIC once up (Chrome). SwitchNextRequest = "next_request" // SwitchOnAltSvc: the Alt-Svc response starts QUIC at once in the // background (Firefox). SwitchOnAltSvc = "on_alt_svc" // SwitchNewConnection: only a request needing a new connection uses // HTTP/3 (Safari). SwitchNewConnection = "new_connection" )
Values of Discovery.Switch.
const ( KindFrame = "frame" // <iframe src> KindScript = "script" // <script src> in the HTML: blocking KindAsyncScript = "async_script" // <script async src> KindDeferScript = "defer_script" // <script defer src> KindInjectedScript = "injected_script" // a script element created by script KindPreloadScript = "preload_script" // <link rel=preload as=script> KindStyle = "style" // <link rel=stylesheet> KindImage = "image" // <img src> in the HTML KindInjectedImage = "injected_image" // new Image() KindFont = "font" // a web font from CSS @font-face KindPreloadFont = "preload_font" // <link rel=preload as=font crossorigin> KindFetch = "fetch" // fetch() KindXHR = "xhr" // XMLHttpRequest KindBeacon = "beacon" // navigator.sendBeacon // KindPreflight is the CORS preflight (OPTIONS) the browser sends // itself; callers never ask for it. KindPreflight = "preflight" // KindWebSocket is a WebSocket's opening handshake: an HTTP/1.1 // Upgrade or an RFC 8441 extended CONNECT. Its lists have slots for // Sec-WebSocket-Key, -Extensions and -Protocol. KindWebSocket = "websocket" )
Request kinds a profile describes besides the navigation (Spec.Headers, HTTP1 and HTTP2.HeadersPriority). Each is one way a page makes a request, named after the HTML or JavaScript that makes it.
const ( SiteSameOrigin = "" SiteSameSite = "same-site" SiteCrossSite = "cross-site" // SiteNone is a navigation's without a page (a typed URL): Safari // orders its redirects otherwise than a page's (nav-redirect and // redirects2 captures). SiteNone = "none" )
Site relations of a request to its page, as sec-fetch-site names them.
const ( // HashBlink is Blink's HTTPHeaderMap: a WTF::HashMap keyed by the // case-folded name (rapidhash), open addressing with triangular // probing, 8 buckets doubling at half full. HashBlink = "blink" // HashCF is CFNetwork's header dictionary: a CFDictionary keyed by // the lowercased name (CFString's hash), linear probing, prime // bucket counts. HashCF = "cf" )
Values of HeaderTable.Hash.
const ( PreflightCacheReplace = "replace" PreflightCacheMerge = "merge" )
Values of Context.PreflightCache.
const ( // StreamsBlockedEveryRequest sends one for every request made at the // limit, the same limit again for each (Chrome). StreamsBlockedEveryRequest = "every_request" // StreamsBlockedFirstRequest sends one for the first request made at // a limit only; a limit once sent is never sent again (Firefox, // Safari). StreamsBlockedFirstRequest = "first_request" )
Values of QUICStreamsBlocked.AtRequest.
const ( // StreamsBlockedRaiseAlways sends one with the new limit right after // that stream's STREAM frame, whether or not another request still // waits (Chrome). Where a raise in two MAX_STREAMS frames lets two // waiting requests open, the first sends one too, with the first // frame's limit, if it opens its stream before the second frame is // read: Chrome sent one after each stream in 9 of 12 such raises, one // after the second only in 3. StreamsBlockedRaiseAlways = "always" // StreamsBlockedRaiseWaiting sends one with the new limit right // before that stream's STREAM frame, only while another request still // waits, and not for a limit already sent (Firefox). StreamsBlockedRaiseWaiting = "waiting" )
Values of QUICStreamsBlocked.AfterRaise.
const ( // ProbeFlight resends every first-flight Initial packet with the same // CRYPTO frames and new packet numbers (Firefox). ProbeFlight = "flight" // ProbeOnePacket sends one padded Initial carrying the first flight's // CRYPTO data packet by packet, cut afresh per Crypto.Split (Chrome). ProbeOnePacket = "one_packet" )
Values of QUICLoss.Probe.
const ( // CloseTransport is CONNECTION_CLOSE 0x1c NO_ERROR with a reason in an // Initial packet, plus a coalesced 0-RTT copy if 0-RTT was sent. CloseTransport = "transport" // CloseApplication is an application close in an Initial packet, sent // as 0x1c APPLICATION_ERROR without reason (RFC 9000, 10.2.3), plus a // 0x1d close in 0-RTT if 0-RTT was sent. CloseApplication = "application" // CloseZeroRTT is a 0x1d H3_NO_ERROR close in its own 0-RTT packet if // 0-RTT was sent; nothing otherwise. CloseZeroRTT = "zero_rtt" )
Values of QUICGiveUp.Close and QUICLoss.AbandonClose.
const ( // PathMigrate moves to a new UDP socket and the server's next // connection ID: a padded PATH_CHALLENGE, RETIRE_CONNECTION_ID for the // old ID, then the unacknowledged data (Chrome). PathMigrate = "migrate" // PathClose sends CONNECTION_CLOSE (NO_ERROR, CloseReason) and moves // pending requests to a new connection (Fallback.Pending). PathClose = "close" )
Values of QUICPathDegrading.Action.
const ( // KeepAliveFromSent counts from the last ack-eliciting packet sent. KeepAliveFromSent = "sent" // KeepAliveFromIdle counts from the idle timer's last restart (RFC // 9000, section 10.1). KeepAliveFromIdle = "idle" // KeepAliveFromReceived counts from the last packet received. KeepAliveFromReceived = "received" )
Values of QUICKeepAlive.From.
const ( // PaddingScattered spreads PADDING frames between the packet's other // frames (see CryptoSplitShuffle). PaddingScattered = "scattered" // PaddingTrailing pads the datagram with zero bytes after its last // packet; a datagram carrying a 1-RTT packet pads that packet instead. PaddingTrailing = "trailing" // PaddingEnd ends the packet with one run of PADDING frames. PaddingEnd = "end" )
Values of QUIC.Padding.
const ( // CryptoSplitShuffle (Chrome, quiche's QuicChaosProtector): two // Initial packets; the first carries the hello's head [0, h), h in // Head, and its tail, so it holds floor((len-4)/2) bytes; the second // the middle. Each packet's CRYPTO data is split AddedFrames times, // gets Pings PINGs and scattered padding runs, and is shuffled; with // no padding left, nothing is added. CryptoSplitShuffle = "shuffle" // CryptoSplitSNICut (Firefox, neqo's SNI slicing): the hello is cut in // two mid server_name. With n = ceil(len/DatagramSize) and limit = // len/n, the longer piece is shortened so both fit limit; the first // packet carries the tail piece, then as much of the head piece as // fits, and the rest follows in order. CryptoSplitSNICut = "sni_cut" // CryptoSplitOrdered: one CRYPTO frame per packet, in order, // FirstPacket bytes in the first. CryptoSplitOrdered = "ordered" )
Values of QUICCrypto.Split.
const ( // across all spaces. The second Initial's number takes 2 bytes without // a token, else 1. PacketNumbersShared = "shared" // PacketNumbersRandomInitial numbers each space from 0, except Initial, // which starts at 1 + (a & 0x1f) + (max(b, 224) - 224) * 32 for random // bytes a and b (neqo). 1-RTT starts at 1 after 0-RTT, sharing its // space. PacketNumbersRandomInitial = "random_initial" // PacketNumbersPerSpace numbers each space from 0. PacketNumbersPerSpace = "per_space" )
Values of QUIC.PacketNumbers.
const ( // TransportParameterOrderFixed sends TransportParameters in order. TransportParameterOrderFixed = "fixed" // TransportParameterOrderShuffled sends them in a uniform random order // per connection. TransportParameterOrderShuffled = "shuffled" // TransportParameterOrderRotated sends a rotation starting at a random // one, those marked Last kept last in order. TransportParameterOrderRotated = "rotated" )
Values of QUIC.TransportParameterOrder.
const ( // AckDelayActual reports the time since the largest acknowledged // packet arrived. AckDelayActual = "actual" // AckDelayConstant reports one value per connection, drawn from // QUIC.AckDelayConstant. AckDelayConstant = "constant" )
Values of QUIC.AckDelay.
const ( // SpinBitZero always sends 0. SpinBitZero = "zero" // SpinBitRandom sends a random value per packet (RFC 9000, 17.4). SpinBitRandom = "random" // SpinBitSpin sends 0 until the handshake is confirmed, then the // inverse of the spin bit of the server's largest-numbered 1-RTT // packet since. SpinBitSpin = "spin" )
Values of QUIC.SpinBit.
const ( RedirectOriginKeep = "keep" RedirectOriginDrop = "drop" )
Values of Redirects.MethodChangeOrigin.
const ( RedirectPreflightOwn = "own" RedirectPreflightInherit = "inherit" )
Values of Redirects.HopPreflight.
const ( RedirectSiteChain = "chain" RedirectSiteRestart = "restart" )
Values of Redirects.NavigationSite.
const ( )
Values of Redirects.NavigationOrigin.
const ( // TLS12Reuse resumes every new connection with the newest ticket, // concurrent ones included, until a newer one replaces it (Chrome). TLS12Reuse = "reuse" // TLS12SingleUse uses a ticket once, and keeps none a resumed // connection receives, so connections alternate between full and // resumed handshakes (Firefox). TLS12SingleUse = "single_use" )
Values of Resumption.TLS12.
const ( ExtensionOrderFixed = "fixed" ExtensionOrderShuffled = "shuffled" )
Values of TLS.ExtensionOrder.
const ( // CompressionChromiumZlib6 is Chromium's fork of zlib, whose hash // finds different matches than zlib's (Chrome). CompressionChromiumZlib6 = "chromium_zlib6" // CompressionZlib6 is zlib (Safari). CompressionZlib6 = "zlib6" // CompressionZlibRS6 is zlib-rs, a port of zlib-ng (Firefox). CompressionZlibRS6 = "zlib_rs6" )
Values of WebSocket.Compression. Each is the library's raw deflate at level 6, memLevel 8 and the default strategy, each message ended with a sync flush whose 00 00 ff ff is cut, byte for byte.
const ( // UncompressedNever compresses every message, an empty one as the // single byte 00 (Chrome). UncompressedNever = "never" // UncompressedEmptyOrLonger sends an empty message uncompressed, and, // with client_no_context_takeover, one whose compressed form is // longer than it (Firefox). UncompressedEmptyOrLonger = "empty_or_longer" // UncompressedEmptyOrNotShorter sends an empty message uncompressed, // and one whose compressed form is not shorter than it, after which // the compression context starts over (Safari). UncompressedEmptyOrNotShorter = "empty_or_not_shorter" )
Values of WebSocket.Uncompressed.
const ( // WindowBits8As9 compresses with a 9-bit window (Chrome). WindowBits8As9 = "as_9" // WindowBits8Fail fails the socket once its handshake is done: the // transport ends at once, as CloseH1 and CloseH2 end it, with // nothing sent (Safari). WindowBits8Fail = "fail" )
Values of WebSocket.WindowBits8.
const ( // H2DataTogether writes each WebSocket frame, header and payload, // into as few DATA frames as the cap allows (Chrome). H2DataTogether = "together" // H2DataHeaderAlone writes a frame's header (mask included) in a DATA // frame of its own when its payload exceeds 1000 bytes (Firefox's // kCopyBreak), then the payload. H2DataHeaderAlone = "header_alone" // H2DataSplitControl is H2DataTogether, except replies to control // frames go as three DATA frames: header, mask, payload (Safari). H2DataSplitControl = "split_control" )
Values of WebSocket.H2Data.
const ( // CloseAfterWait closes the TCP connection CloseWaitMillis after the // close handshake unless the server did first (Chrome). CloseAfterWait = "after_wait" // CloseAtOnce closes the TCP connection as soon as the close // handshake is done (Safari). CloseAtOnce = "at_once" // CloseEndStream sets END_STREAM on the DATA frame carrying the // browser's close frame, its own or its reply (Chrome). CloseEndStream = "end_stream" // CloseResetStream sends RST_STREAM NO_ERROR once the close handshake // is done (Safari). CloseResetStream = "rst_stream" )
Values of WebSocket.CloseH1 and WebSocket.CloseH2.
const AckOnlyMaxData = "MAX_DATA"
AckOnlyMaxData is a QUIC.AckOnlyFrame value: MAX_DATA with the connection's current limit.
const DCIDLengthBiased = "biased"
DCIDLengthBiased picks max(8, 5 + (v & (v >> 4))) for a random byte v (neqo).
const MaxRecord = 16384
MaxRecord is the most content a TLS record carries (RFC 8446, section 5.1): every record of an upload is this full but the last of the head or body, in every captured browser.
const OtherHeaders = "*"
OtherHeaders is a header name that, in a kind's lists, marks where headers the list does not name go: those the page sets itself (a fetch's custom headers). Without it they follow the listed ones.
Variables ¶
This section is empty.
Functions ¶
func Encode ¶
Encode writes p as indented JSON with a trailing newline. It does not validate p, so captures of unusual browser behaviour can be recorded.
func IsGREASETransportParameter ¶
IsGREASETransportParameter reports a reserved transport parameter ID.
func IsGREASEVersion ¶
IsGREASEVersion reports a reserved QUIC version.
Types ¶
type ByteList ¶
type ByteList []uint8
ByteList is a list of single-byte values written in JSON as an array of numbers rather than encoding/json's default base64 string.
func (ByteList) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*ByteList) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type Bytes ¶
type Bytes []byte
Bytes is raw data written in JSON as a hex string.
func (Bytes) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Bytes) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type Coalescing ¶
type Coalescing string
Coalescing is when a request takes another host's HTTP/2 connection: a value of Connections.Coalesce.
const ( // CoalesceOnLookup looks the host's addresses up before connecting // and sends the request on a connection to one of them, opening none // (Chrome, Safari). CoalesceOnLookup Coalescing = "lookup" // CoalesceOnConnect completes the TLS handshake first; if a connection // to the reached address exists, the new one sends its HTTP/2 preface // and a GOAWAY, closes, and the request uses the existing one (Firefox). CoalesceOnConnect Coalescing = "connect" )
Values of Coalescing.
type Code ¶
type Code uint16
Code is a 16-bit TLS registry value: a cipher suite, extension type, named group, signature scheme, protocol version or certificate compression algorithm. In JSON it is a hex string such as "0x1301".
All GREASE values (RFC 8701) are represented by GREASE and written as "GREASE": a browser picks them at random per connection, so a profile only records where they go.
Extension types QUIC hellos add.
const ( ExtServerName Code = 0x0000 ExtStatusRequest Code = 0x0005 ExtSupportedGroups Code = 0x000a ExtECPointFormats Code = 0x000b ExtSignatureAlgorithms Code = 0x000d ExtALPN Code = 0x0010 ExtSignedCertificateTimestamp Code = 0x0012 ExtPadding Code = 0x0015 ExtExtendedMasterSecret Code = 0x0017 ExtCompressCertificate Code = 0x001b ExtRecordSizeLimit Code = 0x001c ExtDelegatedCredentials Code = 0x0022 ExtSessionTicket Code = 0x0023 ExtSupportedVersions Code = 0x002b ExtPSKKeyExchangeModes Code = 0x002d ExtSignatureAlgorithmsCert Code = 0x0032 ExtApplicationSettingsOld Code = 0x4469 ExtApplicationSettings Code = 0x44cd ExtEncryptedClientHello Code = 0xfe0d ExtRenegotiationInfo Code = 0xff01 )
Extension types with special handling in profiles.
const GREASE Code = 0x0a0a
GREASE stands for any GREASE value. It is the lowest one, 0x0a0a.
func (Code) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Code) UnmarshalText ¶
UnmarshalText accepts "GREASE" or "0x" followed by one to four hex digits. Any GREASE value is stored as GREASE.
type Connections ¶
type Connections struct {
// HTTP1PerHost is the most HTTP/1.1 connections open at once to one
// host (scheme, host, port, partition, proxy), dials included. Busy
// requests wait in order. At least 1.
HTTP1PerHost int `json:"http1PerHost"`
// Coalesce is when a request takes another host's HTTP/2 connection:
// CoalesceOnLookup or CoalesceOnConnect. The connection must be in the
// same partition, same port, unproxied, with a certificate covering
// the host.
Coalesce Coalescing `json:"coalesce"`
}
Connections are how the browser shares connections between requests: HTTP/1.1 connections per host, and HTTP/2 coalescing. Required (decision 0008).
type Context ¶
type Context struct {
// StorageAccess is the sec-fetch-storage-access value on cross-site
// requests that carry credentials ("active" in Chrome, "none" in
// Firefox); empty sends none (Safari).
StorageAccess string `json:"storageAccess,omitempty"`
// SameOriginElementOrigin sends Origin on same-origin requests that
// elements make in CORS mode (a crossorigin attribute, fonts), as
// Chrome and Safari do; Firefox sends it on cross-origin ones only.
SameOriginElementOrigin bool `json:"sameOriginElementOrigin,omitempty"`
// StylesheetReferrer sends a stylesheet's URL as the Referer of the
// fonts and images it loads (Chrome, Firefox); otherwise the page's
// (Safari).
StylesheetReferrer bool `json:"stylesheetReferrer,omitempty"`
// AnonymousConnections keeps requests sent without credentials on
// connections of their own, separate from those that carry cookies
// (Chrome).
AnonymousConnections bool `json:"anonymousConnections,omitempty"`
// FrameConnections keeps a cross-site frame's navigation on connections
// of its own (Chrome's network partitioning by frame site).
FrameConnections bool `json:"frameConnections,omitempty"`
// PreflightCache is how successful CORS preflights are remembered, per
// page origin, URL and credentials mode: PreflightCacheReplace (Chrome,
// Safari: the latest answer replaces the URL's entry) or
// PreflightCacheMerge (Firefox: what every answer allowed). Empty: not
// measured, so requests that need a preflight are an error.
PreflightCache string `json:"preflightCache,omitempty"`
// HeaderTable is how the browser orders the headers a page sets on a
// fetch() or XHR among its own, where the kind's list has no
// OtherHeaders slot. Nil: those lists place them after the rest,
// sorted by name (Firefox's lists all have the slot).
HeaderTable *HeaderTable `json:"headerTable,omitempty"`
}
Context is how a browser fills the headers and connections that depend on which page makes a request and how.
type Cookies ¶
type Cookies struct {
// UnsetSameSite is how a cookie without SameSite behaves: SameSiteLax
// (Chrome) or SameSiteNone (Firefox, Safari).
UnsetSameSite string `json:"unsetSamesite"`
// LaxAllowsUnsafeSeconds lets an unset-SameSite cookie younger than
// this go on a cross-site top-level navigation with an unsafe method
// (a form POST): Chrome's exception, 120. Zero: none.
LaxAllowsUnsafeSeconds int `json:"laxAllowsUnsafeSeconds,omitempty"`
// NoneRequiresSecure rejects SameSite=None without Secure (Chrome,
// Firefox).
NoneRequiresSecure bool `json:"noneRequiresSecure,omitempty"`
// ThirdParty is the policy for cookies of a cross-site context: a
// request whose site is not its top-level page's.
ThirdParty string `json:"thirdParty"`
// WebSocketUnpartitioned also sends a cross-site WebSocket handshake its
// host's unpartitioned Lax and None cookies, whatever ThirdParty says
// (Safari 26, not 27). Strict ones stay behind (not measured).
WebSocketUnpartitioned bool `json:"websocketUnpartitioned,omitempty"`
// Redirects is how a redirect chain affects which cookies go.
Redirects string `json:"redirects"`
// Nameless is what a Set-Cookie pair without "=" sets.
Nameless string `json:"nameless"`
// EmptyName is what a pair with nothing before its "=" ("=x") sets.
EmptyName string `json:"emptyName"`
// Latin1Values re-encodes non-ASCII value bytes as if each were a
// Latin-1 character (Safari: "café" in UTF-8 becomes "café").
Latin1Values bool `json:"latin1Values,omitempty"`
// Order is the order of cookies in the Cookie header.
Order string `json:"order"`
// NewValueRenews gives a cookie replaced with a different value a new
// creation time, moving it later in the order (Chrome); otherwise it
// keeps the old one's. Only with OrderRFC.
NewValueRenews bool `json:"newValueRenews,omitempty"`
// PartitionedFirst sends the Partitioned cookies of a request before
// its unpartitioned ones, each group in Order (Safari). Off, they
// take their place in Order with the rest.
PartitionedFirst bool `json:"partitionedFirst,omitempty"`
// SameSiteScheme is whether a site, for SameSite, includes the scheme:
// SameSiteSchemeful makes http:// and https:// of one host cross-site
// (Chrome; RFC 6265bis), SameSiteSchemeless does not (Firefox,
// Safari).
SameSiteScheme string `json:"samesiteScheme"`
// HostPrefixPath is what the __Host- prefix's Path=/ rule checks.
HostPrefixPath string `json:"hostPrefixPath"`
// HTTPPrefix enforces the __Http- and __Host-Http- prefixes: Secure
// and HttpOnly, and __Host-'s rules for the latter (Chrome, Firefox).
// Off, they are ordinary names, __Host-Http- still a __Host- name
// (Safari).
HTTPPrefix bool `json:"httpPrefix,omitempty"`
// SecureLoopback treats plain http:// to a loopback host (localhost,
// *.localhost, 127.0.0.0/8, ::1) as secure for cookies (not Safari 26).
SecureLoopback bool `json:"secureLoopback,omitempty"`
// MaxPerSite is how many cookies a registrable domain keeps per
// partition: past it, the least recently used are evicted down to
// EvictTo (Chrome, Firefox: 180 and 150). Zero: no limit.
MaxPerSite int `json:"maxPerSite,omitempty"`
EvictTo int `json:"evictTo,omitempty"`
}
Cookies are a browser's cookie rules where browsers differ; the rules they share (RFC 6265bis) are the jar's own. See docs/decisions/0012.
func DefaultCookies ¶
func DefaultCookies() *Cookies
DefaultCookies are RFC 6265bis's rules, for a jar used without a profile (a profile must state its browser's).
type CredentialTiming ¶
type CredentialTiming string
CredentialTiming is when a request to a proxy carries credentials: a value of Proxy.ConnectCredentials and Proxy.ForwardCredentials.
const ( // CredentialsAfterChallenge sends the first request to a proxy without // credentials, answers its 407 on the same connection, and sends them // unasked on every later request to that proxy (Chrome, Firefox). CredentialsAfterChallenge CredentialTiming = "after_challenge" // CredentialsOnChallenge sends every request without credentials and // answers each 407 on the same connection (Safari's CONNECT). CredentialsOnChallenge CredentialTiming = "on_challenge" // CredentialsAlways sends them on every request, the first included // (Safari's plain-HTTP requests). CredentialsAlways CredentialTiming = "always" )
Values of CredentialTiming.
type Discovery ¶
type Discovery struct {
// Switch is SwitchNextRequest, SwitchOnAltSvc or SwitchNewConnection.
Switch string `json:"switch"`
// GoAwayTCP sends GOAWAY on the origin's HTTP/2 connection once QUIC
// is up; otherwise it stays open and unused.
GoAwayTCP bool `json:"goawayTcp,omitempty"`
// RaceAfterGoAway: after a server GOAWAY on HTTP/3, the next request
// goes on TCP while QUIC is dialled RaceDelayMillis later; later
// requests wait for QUIC (Fallback.Hold). Otherwise QUIC is dialled
// alone.
RaceAfterGoAway bool `json:"raceAfterGoaway,omitempty"`
// RaceDelayMillis is the range of the delay between the two dials.
RaceDelayMillis *Range `json:"raceDelayMs,omitempty"`
// DialDelayMillis are the browser's measured delays (whole ms, sorted)
// from the request that waits for it to a new fresh QUIC connection's
// first datagram (Safari); ResumedDialDelayMillis a resumed one's
// (Safari, Firefox). A dial draws one, so delays come as often as in
// the captures. Empty: at once. Applied only with
// Config.BrowserDialDelay (decision 0050); Fallback.TCPDelayMillis
// counts from the dial. Not the reconnection after a dead connection
// (Fallback.ReconnectMillis), nor a dial no request waits for (an
// Alt-Svc validation, Chrome's beside its request on TCP).
DialDelayMillis []int `json:"dialDelayMs,omitempty"`
ResumedDialDelayMillis []int `json:"resumedDialDelayMs,omitempty"`
// Fallback is what requests do while QUIC to their origin is not up,
// when it fails, and when a live QUIC connection dies.
Fallback Fallback `json:"fallback"`
}
Discovery is when and how a browser moves an origin to HTTP/3 after an Alt-Svc h3 advertisement. Never through a proxy. Once used, a request finding no QUIC connection dials a new one (0-RTT where QUIC.ZeroRTT), unless RaceAfterGoAway says otherwise.
type ECH ¶
type ECH struct {
// CipherSuites are the HPKE symmetric cipher suites, sorted.
CipherSuites []HPKESuite `json:"cipherSuites"`
// EncLength is the encapsulated key's length: 32 for X25519.
EncLength uint16 `json:"encLength"`
// PayloadLengths are the payload's lengths, the AEAD tag included,
// sorted.
PayloadLengths []uint16 `json:"payloadLengths"`
}
ECH is the shape of the GREASE encrypted_client_hello extension sent to a server with no known ECH configuration. All but its lengths are random; the cipher suite and payload length are picked per connection from CipherSuites and PayloadLengths.
type Extension ¶
type Extension struct {
Type Code `json:"type"`
// Data is the exact body of an extension without a typed field.
Data Bytes `json:"data,omitempty"`
// Groups for supported_groups.
Groups []Code `json:"groups,omitempty"`
// are generated per connection.
KeyShares []Code `json:"keyShares,omitempty"`
// order, for key_share. A group fixes its key's length; a GREASE share's
// is the browser's choice (BoringSSL: one byte).
KeyShareLengths []uint16 `json:"keyShareLengths,omitempty"`
// ECH for encrypted_client_hello: the GREASE extension's shape.
ECH *ECH `json:"ech,omitempty"`
// SignatureAlgorithms for signature_algorithms, signature_algorithms_cert
// and delegated_credentials.
SignatureAlgorithms []Code `json:"signatureAlgorithms,omitempty"`
// Versions for supported_versions.
Versions []Code `json:"versions,omitempty"`
// ALPN protocols for application_layer_protocol_negotiation.
ALPN []string `json:"alpn,omitempty"`
// ALPS protocols for application_settings (either codepoint).
ALPS []string `json:"alps,omitempty"`
// PointFormats for ec_point_formats.
PointFormats ByteList `json:"pointFormats,omitempty"`
// PSKModes for psk_key_exchange_modes.
PSKModes ByteList `json:"pskModes,omitempty"`
// CertCompression algorithms for compress_certificate.
CertCompression []Code `json:"certCompression,omitempty"`
// RecordSizeLimit for record_size_limit.
RecordSizeLimit uint16 `json:"recordSizeLimit,omitempty"`
}
Extension is one ClientHello extension. Type is required. The payload is given in one of three ways, depending on Type:
- Generated per connection, with no payload in the profile: server_name, padding, pre_shared_key and session_ticket.
- Typed fields: Groups for supported_groups, KeyShares and KeyShareLengths for key_share, ECH for encrypted_client_hello, and so on (see each field).
- Data, the exact body, for every other type including GREASE. Absent Data means an empty body. uTLS writes some bodies itself, so Data must be the one it sends: empty for the first GREASE extension (of at most two), 00 for the second; empty for extended_master_secret and signed_certificate_timestamp; 0100000000 for status_request; 00 for renegotiation_info.
func (*Extension) Pinned ¶
Pinned reports whether e keeps its position when a browser shuffles its extensions: GREASE brackets the list, padding sizes the record, and pre_shared_key must be last (RFC 8446, section 4.2.11).
type Fallback ¶
type Fallback struct {
// Mode is FallbackRace or FallbackBackground.
Mode string `json:"mode"`
// TCPDelayMillis: with FallbackRace, a request waiting for an attempt
// whose handshake has not completed, 0-RTT ones included unless
// ZeroRTTHolds, falls back this long after the attempt it started
// started, or after it began waiting on one already running.
TCPDelayMillis *Range `json:"tcpDelayMs,omitempty"`
// ZeroRTTHolds: a 0-RTT request and those after it wait with no TCP
// until the attempt gives up; then a fresh attempt and TCP start
// together, counted with it as one.
ZeroRTTHolds bool `json:"zeroRttHolds,omitempty"`
// AbandonOnTCP drops the QUIC attempt (QUIC.Loss.AbandonClose) once the
// request went on TCP, counting it as failed; otherwise it runs on.
AbandonOnTCP bool `json:"abandonOnTcp,omitempty"`
// Hold: with FallbackBackground, requests made while a resumed attempt
// after the server's close is pending wait for it, then go on TCP if
// it gives up.
Hold bool `json:"hold,omitempty"`
// BrokenAfter is how many failed attempts in a row mark the origin's
// HTTP/3 broken for the Transport's life.
BrokenAfter int `json:"brokenAfter"`
// BrokenCountsResumed counts failed resumed attempts towards
// BrokenAfter; otherwise a fresh attempt follows a failed resumed one.
BrokenCountsResumed bool `json:"brokenCountsResumed,omitempty"`
// RevalidateMillis: with FallbackBackground, a request at least this
// long after a failed resumed attempt or dead connection starts a
// fresh QUIC attempt beside TCP.
RevalidateMillis *Range `json:"revalidateMs,omitempty"`
// Pending is where requests waiting on a dying QUIC connection go:
// PendingTCP or PendingQUIC.
Pending string `json:"pending"`
// ReconnectMillis is the delay before the new connection with
// PendingQUIC.
ReconnectMillis *Range `json:"reconnectMs,omitempty"`
}
Fallback is how a browser falls back from QUIC to TCP. An attempt fails when it gives up (QUIC.Loss), gets Version Negotiation it does not retry, or is abandoned (AbandonOnTCP). Fallen-back requests use an open HTTP/2 connection if any.
type ForwardAuth ¶
type ForwardAuth struct {
// After places it after the last of these headers the request
// carries (Chrome: connection, content-length; Safari:
// accept-encoding).
After []string `json:"after,omitempty"`
// Before places it before this header (Firefox: connection).
Before string `json:"before,omitempty"`
// RetryLast places it last instead on a request sent again because
// the proxy asked for credentials (Firefox).
RetryLast bool `json:"retryLast,omitempty"`
}
ForwardAuth is where Proxy-Authorization goes in a plain-HTTP request sent to a proxy, by the request's other headers (lowercase names; for Connection, the name before ForwardConnection renames it). With neither After nor Before, or when the request has none of the headers named, it goes last.
type H3EarlyData ¶
type H3EarlyData struct {
// Methods are the methods sent in 0-RTT. Other requests made during
// the handshake wait for it and go in 1-RTT.
Methods []string `json:"methods"`
// HeldWithFinished sends a held request in the client's Finished
// datagram; otherwise in its own right after it, or with
// RequestsAfterConfirmed once the handshake is confirmed.
HeldWithFinished bool `json:"heldWithFinished,omitempty"`
// RetryTooEarly resends a 0-RTT request answered 425 Too Early (RFC
// 8470) in 1-RTT on the same connection; otherwise the 425 stands.
RetryTooEarly bool `json:"retryTooEarly,omitempty"`
}
H3EarlyData is how requests use a resumed connection's 0-RTT.
type H3Grease ¶
type H3Grease struct {
IDBits int `json:"idBits,omitempty"`
// ValueBits: a setting's value is uniform below 2^ValueBits.
ValueBits int `json:"valueBits,omitempty"`
// MaxLength: a frame's payload is random bytes, its length uniform in
// [0, MaxLength].
MaxLength int `json:"maxLength,omitempty"`
}
H3Grease is the shape of a reserved setting or frame: identifier 0x1f * N + 0x21 (RFC 9114, 7.2.4.1 and 7.2.8), N uniform below 2^IDBits; IDBits 0 spans every N that fits a varint.
type H3Headers ¶
type H3Headers struct {
// PseudoHeaderOrder replaces HTTP2.PseudoHeaderOrder.
PseudoHeaderOrder []string `json:"pseudoHeaderOrder"`
// Drop are HTTP/2 headers HTTP/3 leaves out.
Drop []string `json:"drop,omitempty"`
// AltUsed places alt-used (RFC 7838, section 5) by request kind: before
// the first header the request sends that is the named one or follows
// it in the request's HTTP/2 list; last if none. A kind without an
// entry was not measured over HTTP/3.
AltUsed map[string]string `json:"altUsed,omitempty"`
AltUsedNavigation string `json:"altUsedNavigation,omitempty"`
}
H3Headers is how a browser's HTTP/3 header lists differ from its HTTP/2 ones (Firefox).
type H3UniStream ¶
type H3UniStream struct {
// Type is H3StreamControl, H3StreamQPACKEncoder or H3StreamQPACKDecoder.
Type string `json:"type"`
// Open is when it is opened: H3OpenAtHandshake, H3OpenOnFirstInsert,
// H3OpenOnSettings or H3OpenNever.
Open string `json:"open"`
}
H3UniStream is one unidirectional stream the client opens.
type HPACK ¶
type HPACK struct {
// WithoutIndexing names are sent as literals without indexing and never
// enter the dynamic table.
WithoutIndexing []string `json:"withoutIndexing,omitempty"`
// NeverIndexed names are sent as never-indexed literals.
NeverIndexed []string `json:"neverIndexed,omitempty"`
// NeverIndexBelow sends fields with these names never-indexed when their
// value is shorter than the given number of bytes: Firefox and Safari
// never index cookie crumbs under 20 bytes (19 never, 20 indexed).
NeverIndexBelow map[string]int `json:"neverIndexBelow,omitempty"`
// LiteralOnExactMatch sends a WithoutIndexing field that matches a table
// entry exactly as a literal naming that entry (Firefox), instead of as
// an indexed field (Chromium, Safari).
LiteralOnExactMatch bool `json:"literalOnExactMatch,omitempty"`
// NameMatch chooses which entry a literal's name refers to when several
// carry it: NameMatchStaticFirst or NameMatchHighestIndex.
NameMatch NameMatchRule `json:"nameMatch"`
// Huffman says when strings are Huffman-coded: HuffmanShorter or
// HuffmanAlways.
Huffman HuffmanRule `json:"huffman"`
// MaxTableSize caps the dynamic table the encoder announces and uses,
// whatever the server allows (Safari: 4096). Zero: the server's size.
MaxTableSize uint32 `json:"maxTableSize,omitempty"`
// SizeUpdates says when a table size the server sets is signalled:
// SizeUpdatesOnChange or SizeUpdatesAlways.
SizeUpdates SizeUpdateRule `json:"sizeUpdates"`
}
HPACK describes a browser's header compression choices (RFC 7541). Captures cannot record it; it is derived from connection traces and checked by re-encoding them byte for byte.
type HPKESuite ¶
HPKESuite is an HPKE symmetric cipher suite (RFC 9180, section 7).
type HTTP1 ¶
type HTTP1 struct {
// Headers of a navigation request, in order, named exactly as sent
// ("User-Agent", "sec-ch-ua"). Host takes the request's host, and
// Content-Length the body's length; values work as in Spec.Headers.
Headers []Header `json:"headers"`
// UploadRecords is how the browser cuts a request with a body into
// TLS records; hellogen derives it from the http1-upload captures.
// Nil: not measured, and the request goes out as one stream in full
// records, as with HeadApart false.
UploadRecords *UploadRecords `json:"uploadRecords,omitempty"`
}
HTTP1 describes a browser's HTTP/1.1 requests.
type HTTP2 ¶
type HTTP2 struct {
// Settings in the order sent in the first SETTINGS frame.
Settings []Setting `json:"settings"`
// WindowUpdate is the connection-level WINDOW_UPDATE increment sent after
// SETTINGS. Zero sends none.
WindowUpdate uint32 `json:"windowUpdate,omitempty"`
// Priorities are PRIORITY frames sent after SETTINGS, in order.
Priorities []Priority `json:"priorities,omitempty"`
// OpeningRecords is how the browser cuts a new connection's first
// writes into TLS records when the first request is waiting as the
// connection opens: one entry per record, each listing what it
// carries in order, OpeningPreface and frame types (OpeningSettings,
// OpeningWindowUpdate, OpeningPriority), through the first request's
// OpeningHeaders and its stream WINDOW_UPDATE. A request's own frames
// are always one record, the last; they may share the opening's last.
// Nil: unmeasured, and every frame goes in a record of its own.
// hellogen derives it from the captured connections' records.
OpeningRecords [][]string `json:"openingRecords,omitempty"`
// HeadersPriority is the priority carried on the request's HEADERS frame.
// Nil sends none.
HeadersPriority *PriorityParam `json:"headersPriority,omitempty"`
// ChainPriorities makes each request depend exclusively on another
// stream as Chromium chains them, instead of on HeadersPriority.DependsOn:
// the parent is the newest open stream at the nearest weight level at or
// above the request's (0 when none). Needs HeadersPriority.
ChainPriorities bool `json:"chainPriorities,omitempty"`
// PseudoHeaderOrder is the order of :method, :authority, :scheme, :path.
PseudoHeaderOrder []string `json:"pseudoHeaderOrder"`
// FirstStreamID is the first request's stream ID. Zero means 1; Firefox
// starts at 3.
FirstStreamID uint32 `json:"firstStreamId,omitempty"`
// StreamWindowUpdate is a WINDOW_UPDATE increment sent on every stream
// right after its HEADERS, as Firefox does. Zero sends none.
StreamWindowUpdate uint32 `json:"streamWindowUpdate,omitempty"`
// MaxDataFrame caps the payload of the DATA frames carrying a request
// body. Zero uses the peer's SETTINGS_MAX_FRAME_SIZE; the smaller wins.
MaxDataFrame uint32 `json:"maxDataFrame,omitempty"`
// StreamUpdateThreshold and ConnectionUpdateThreshold are how many
// received bytes the reader consumes before a WINDOW_UPDATE returns them,
// per stream and for the connection. Zero means half the window.
StreamUpdateThreshold uint32 `json:"streamUpdateThreshold,omitempty"`
ConnectionUpdateThreshold uint32 `json:"connectionUpdateThreshold,omitempty"`
// WindowUpdateIntervalMillis also returns credit, however little, once
// this long has passed since the last WINDOW_UPDATE (Chromium: 5000).
// Zero: thresholds only.
WindowUpdateIntervalMillis uint32 `json:"windowUpdateIntervalMs,omitempty"`
// IdlePingMillis: a request starting after this long with nothing
// received sends a PING after its HEADERS (Chromium: 10000); one
// unanswered as long again closes the connection. Zero sends none.
IdlePingMillis uint32 `json:"idlePingMs,omitempty"`
// GoAwayReply is the error code, by its RFC 9113 name ("NO_ERROR"), of
// the GOAWAY sent at once when the server's GOAWAY arrives, as Firefox
// does. Empty sends none. hellogen derives it from the connections the
// capture server sent GOAWAY on.
GoAwayReply string `json:"goawayReply,omitempty"`
// SplitCookie sends each cookie as its own header field (RFC 9113,
// 8.2.3), as every captured browser does, instead of one joined field.
SplitCookie bool `json:"splitCookie,omitempty"`
// HPACK is how header blocks are encoded. Required.
HPACK *HPACK `json:"hpack,omitempty"`
}
HTTP2 describes what a browser sends on an HTTP/2 connection: how it opens it, its requests' frames, and how it encodes headers and returns flow-control credit.
type HTTP3 ¶
type HTTP3 struct {
// Settings are the control stream's SETTINGS, in order.
Settings []H3Setting `json:"settings"`
// GreaseSetting is a reserved setting sent after Settings. Nil: none
// (Firefox).
GreaseSetting *H3Grease `json:"greaseSetting,omitempty"`
// GreaseFrame is a reserved frame sent on the control stream right
// after SETTINGS. Nil: none (Safari).
GreaseFrame *H3Grease `json:"greaseFrame,omitempty"`
// UniStreams are the client's unidirectional streams, in the order of
// their stream IDs (2, 6, 10, ...). The control stream is first.
UniStreams []H3UniStream `json:"uniStreams"`
// StreamsWithFinished coalesces the handshake-time streams with the
// client's Finished; otherwise they follow in their own datagram.
StreamsWithFinished bool `json:"streamsWithFinished,omitempty"`
// EarlyRequestFirst puts a 0-RTT request's stream before the
// unidirectional streams on a connection dialled for it.
EarlyRequestFirst bool `json:"earlyRequestFirst,omitempty"`
// EarlyStreamsWithRequest sends the handshake-time streams in the
// 0-RTT packet of the request a connection was dialled for, before
// it (Safari); otherwise they leave first, in a packet of their own
// (Chrome). Not with EarlyRequestFirst.
EarlyStreamsWithRequest bool `json:"earlyStreamsWithRequest,omitempty"`
// RequestsAfterConfirmed holds a request waiting for a full handshake
// until the handshake is confirmed (HANDSHAKE_DONE acked), not the
// client's Finished (Safari); so too a request held out of 0-RTT
// (EarlyData.Methods).
RequestsAfterConfirmed bool `json:"requestsAfterConfirmed,omitempty"`
// EarlyData is which requests go in 0-RTT and how 425 is handled.
// Required with quic.zeroRtt, and only then.
EarlyData *H3EarlyData `json:"earlyData,omitempty"`
// QPACK is how field sections are encoded.
QPACK QPACK `json:"qpack"`
// PriorityUpdate sends a PRIORITY_UPDATE frame (RFC 9218) on the
// control stream before each request carrying a priority header, in
// the same packet (Chrome).
PriorityUpdate bool `json:"priorityUpdate,omitempty"`
// CloseOnGoAway closes the connection (CONNECTION_CLOSE, H3_NO_ERROR)
// as soon as the server's GOAWAY has arrived and no request on it is
// open (Safari); otherwise it stays open until the server closes it or
// it idles out.
CloseOnGoAway bool `json:"closeOnGoaway,omitempty"`
// MaxDataFrame caps a request body's DATA frames and FirstDataFrame
// the first one. Zero sends the body in one DATA frame.
MaxDataFrame int `json:"maxDataFrame,omitempty"`
FirstDataFrame int `json:"firstDataFrame,omitempty"`
// High and Low are the priority header values (empty: none) for
// fetchpriority high and low, by kind, where only HTTP/3 measured them.
// Derived by kindsgen.
High map[string]string `json:"high,omitempty"`
Low map[string]string `json:"low,omitempty"`
// Headers is how a request's header list over HTTP/3 differs from its
// HTTP/2 list. Nil: it is the HTTP/2 list (Chrome, Safari).
Headers *H3Headers `json:"headers,omitempty"`
// Discovery is when the browser moves an origin to HTTP/3.
Discovery Discovery `json:"discovery"`
}
HTTP3 is what a browser sends at the HTTP/3 layer (RFC 9114) and how it moves an origin to HTTP/3. Generated by internal/harness/cmd/h3gen (Headers by kindsgen); not hand-edited. Header lists and priorities are the profile's HTTP/2 ones, as changed by Headers.
type Header ¶
Header is one request header, in the browser's order. Names are tokens (RFC 9110, section 5.6.2): lowercase in HTTP/2 lists, as sent in HTTP/1.1 and proxy lists. Values hold no CR, LF or NUL. An empty Value only fixes where a header supplied by the caller goes; a non-empty Value is also sent by default.
type HeaderTable ¶
type HeaderTable struct {
// Hash is the table: HashBlink or HashCF.
Hash string `json:"hash"`
// Own are the browser's own headers in the table, lowercase. They
// enter it in the list's order.
Own []string `json:"own"`
// PageFirst: the page's headers enter the table first, then the
// browser's own (Chrome). Otherwise the browser's own are in the table
// as the list has them, and the page's enter after (Safari).
PageFirst bool `json:"pageFirst,omitempty"`
// AsPage are list headers that enter the table with the page's, sorted
// among them (Chrome's content-type, which a page sets in its fetch()
// headers).
AsPage []string `json:"asPage,omitempty"`
// Late are list headers that enter the table after the page's
// (Safari's content-length, set once the body is).
Late []string `json:"late,omitempty"`
// Redirected: the table orders a request made by following a redirect
// as any other (Chrome). Otherwise such a request with the page's
// headers takes only a variant captured with them (Safari, whose
// redirects reorder every header).
Redirected bool `json:"redirected,omitempty"`
}
HeaderTable models a browser's request header hash table: a fetch()'s or XHR's headers go out in the table's order, so a page header's place depends on every name in the table. The table's names go out as one run, where the list puts its first one.
func (*HeaderTable) Members ¶
func (t *HeaderTable) Members() []string
Members returns the table's list headers: Own, AsPage and Late.
type Kind ¶
type Kind struct {
// Headers over HTTP/2, in order, as Spec.Headers: default values,
// and slots (empty values) for headers that depend on the request
// (referer, origin, cookie, sec-fetch-site, content-type, ...). This
// is the order of a same-origin GET that is not CORS-checked.
Headers []Header `json:"headers"`
// HTTP1 is the same over HTTP/1.1, named exactly as sent, with Host and
// Connection placed. Required when the profile has HTTP1.
HTTP1 []Header `json:"http1,omitempty"`
// Variants are the orders the browser uses instead for other requests
// of the kind, with values as Headers'.
Variants []Variant `json:"variants,omitempty"`
// Weight is the HEADERS frame's priority weight; the dependency and
// exclusivity are HTTP2.HeadersPriority's. Zero keeps
// HTTP2.HeadersPriority's weight.
Weight uint8 `json:"weight,omitempty"`
// High and Low are the priority header and weight the kind gets with
// fetchpriority high or low. Nil: not measured, so not offered.
High *Urgency `json:"high,omitempty"`
Low *Urgency `json:"low,omitempty"`
}
Kind is how a browser sends one kind of request.
type PlainWebSocket ¶
type PlainWebSocket string
PlainWebSocket is how a ws:// socket goes through an HTTP proxy: a value of ProxyWebSocket.Plain.
const ( // PlainWebSocketTunnel opens a CONNECT tunnel of its own to the // host and port and sends the handshake through it (Chrome, Firefox). PlainWebSocketTunnel PlainWebSocket = "tunnel" // PlainWebSocketForward sends the handshake to the proxy whole on its // own connection, the request line naming the ws:// URL (Safari). PlainWebSocketForward PlainWebSocket = "forward" )
Values of PlainWebSocket.
type Priority ¶
type Priority struct {
StreamID uint32 `json:"streamId"`
PriorityParam
}
Priority is a PRIORITY frame.
type PriorityParam ¶
type PriorityParam struct {
// DependsOn is the stream this one depends on.
DependsOn uint32 `json:"dependsOn"`
// Exclusive sets the exclusive flag.
Exclusive bool `json:"exclusive"`
// Weight as sent on the wire: the priority weight minus one, so 255 means
// 256.
Weight uint8 `json:"weight"`
}
PriorityParam is the priority information of a PRIORITY frame or a HEADERS frame.
type Problem ¶
Problem is one validation failure. Path locates the value, for example "tls.extensions[3].keyShares".
type Profile ¶
type Profile struct {
// contains filtered or unexported fields
}
Profile is a checked browser profile, ready to use: a small value with no exported fields, safe to copy and to share between clients, which nothing can change. The built-in profiles are in package profiles; Parse reads one from JSON; With makes an edited copy. The zero Profile is no profile.
Profiles of equal content share one checked copy of it, so building a client from a Profile copies and checks nothing: build each profile once, and reuse it for every client.
func Parse ¶
Parse decodes a profile from JSON, as Decode, validates it and returns it checked, sharing its copy with every Profile of equal content.
func (Profile) Name ¶
Name is the profile's name, such as "chrome-156-macos"; "" for the zero Profile.
func (Profile) Spec ¶ added in v0.2.0
Spec returns a deep copy of the profile's data, for reading what the profile sends, saving it with Encode, or a value Name and UserAgent don't cover (a standalone cookie jar's Cookies rules, say). Changing the copy changes no Profile; to edit a profile, use With. A copy costs as much as With, so read it once rather than per request; requests never need it. The zero Profile's is empty.
Example ¶
Read what a profile sends, or save it, through Spec: a deep copy of the profile's data, as costly as With. Requests never need it; a client takes the Profile itself. Changing the copy changes no Profile.
package main
import (
"fmt"
"log"
"github.com/roachadam/mimicry/profile"
"github.com/roachadam/mimicry/profiles"
)
func main() {
s := profiles.Chrome156MacOS().Spec()
for _, setting := range s.HTTP2.Settings {
fmt.Printf("SETTINGS %d=%d\n", setting.ID, setting.Value)
}
fmt.Println("cookies without SameSite:", s.Cookies.UnsetSameSite)
// Save it, to diff with another profile or to load later with Parse.
data, err := profile.Encode(s)
if err != nil {
log.Fatal(err)
}
if _, err := profile.Parse(data); err != nil {
log.Fatal(err)
}
}
Output: SETTINGS 1=65536 SETTINGS 2=0 SETTINGS 4=6291456 SETTINGS 6=262144 cookies without SameSite: lax
func (Profile) UserAgent ¶ added in v0.2.0
UserAgent is the User-Agent header the profile's navigation sends; "" for the zero Profile.
func (Profile) With ¶ added in v0.2.0
With returns a copy of p with edit applied to a copy of its data, checked once. With never fails: when the edited data is invalid, the Profile it returns carries the problems (a *ValidationError), and building a client from it returns them. Its Spec is then the edited data, so a further With can fix it. On the zero Profile, edit starts from an empty Spec.
With reads the whole profile, a fraction of a millisecond; a client built from its result copies nothing. Edit once and reuse the result: what differs between the clients of one profile (a user agent, the Accept-Language, a proxy) belongs in mimicry.Config, its Header and Proxy, not in a Profile per client. Profiles With returns for equal data share one copy of it.
Example ¶
Edit a profile once and build every client from the result: With copies the profile, applies the edit and checks it, and a client built from a Profile copies nothing. With never fails: an edit that leaves the profile invalid is the error of the client built from it.
package main
import (
"fmt"
"log"
"github.com/roachadam/mimicry"
"github.com/roachadam/mimicry/profile"
"github.com/roachadam/mimicry/profiles"
)
func main() {
mine := profiles.ChromeMacOS().With(func(s *profile.Spec) {
s.Name = "my-chrome"
})
for range 3 {
if _, err := mimicry.NewClient(mimicry.Config{
Profile: mine,
}); err != nil {
log.Fatal(err)
}
}
fmt.Println(mine.Name())
broken := profiles.ChromeMacOS().With(func(s *profile.Spec) {
s.Name = ""
})
_, err := mimicry.NewClient(mimicry.Config{
Profile: broken,
})
fmt.Println(err)
}
Output: my-chrome profile: invalid: name: is required
type Proxy ¶
type Proxy struct {
// Connect are a CONNECT request's headers without credentials, in
// order, named as sent. Host takes the target's host and port, and
// User-Agent the user agent in the profile's headers, which must have
// one; others are sent as given.
Connect []Header `json:"connect"`
// ConnectAuth are a CONNECT request's headers when it carries
// credentials, Proxy-Authorization included, filled in as Connect's.
// Nil: the browser's way with proxy credentials is not measured, and a
// proxy URL with credentials is an error.
ConnectAuth []Header `json:"connectAuth,omitempty"`
// ConnectCredentials is when a CONNECT carries credentials:
// CredentialsAfterChallenge or CredentialsOnChallenge. Empty, with
// ConnectAuth: the browser's answer to a proxy's 407 is not measured
// (Safari on iOS answers none), so credentials go with the first
// request and a challenge flow (Config.BrowserProxyAuth) is an error.
ConnectCredentials CredentialTiming `json:"connectCredentials,omitempty"`
// ForwardCredentials is when a plain-HTTP request sent to a proxy
// carries them: CredentialsAfterChallenge or CredentialsAlways. Empty
// as ConnectCredentials, and only with it.
ForwardCredentials CredentialTiming `json:"forwardCredentials,omitempty"`
// ForwardConnection, when set, is the header that carries Connection's
// value, in its place, on a plain-HTTP request sent to a proxy
// ("Proxy-Connection": Chrome). Empty keeps Connection.
ForwardConnection string `json:"forwardConnection,omitempty"`
// ForwardAuth places Proxy-Authorization in a plain-HTTP request sent
// to a proxy. Nil: last.
ForwardAuth *ForwardAuth `json:"forwardAuth,omitempty"`
// SOCKS5 is the browser's SOCKS5 handshake. Nil: not measured, so a
// SOCKS5 proxy is an error.
SOCKS5 *SOCKS5 `json:"socks5,omitempty"`
// ConnectNoResume: TLS connections through an HTTP proxy's CONNECT
// tunnel offer no earlier session; through SOCKS5, and directly, they
// resume as TLS.Resumption says (Firefox).
ConnectNoResume bool `json:"connectNoResume,omitempty"`
// WebSocket is how the browser opens WebSockets through a proxy. Nil:
// not measured, and a WebSocket through a proxy is an error.
WebSocket *ProxyWebSocket `json:"websocket,omitempty"`
}
Proxy is how the browser talks to a proxy, as its proxy sees it; what reaches the server through the proxy is the rest of the profile, unchanged. See docs/decisions/0014.
type ProxyWebSocket ¶
type ProxyWebSocket struct {
// Plain is how a ws:// socket goes through an HTTP proxy:
// PlainWebSocketTunnel or PlainWebSocketForward. Required.
Plain PlainWebSocket `json:"plain"`
// Credentials: the browser's way with proxy credentials was measured
// for sockets; PlainWebSocketForward then needs ForwardCredentials
// CredentialsAlways. False: a WebSocket through a proxy URL with
// credentials is an error. Requires ConnectAuth.
Credentials bool `json:"credentials,omitempty"`
}
ProxyWebSocket is how a browser takes WebSockets through a proxy. A wss:// socket goes as it does directly, inside the proxy tunnel. A ws:// socket through SOCKS5 was never measured.
type QPACK ¶
type QPACK struct {
// Encoder is QPACKIndexAll or QPACKNewNames, capacity set to the
// server's maximum. Empty: not measured.
Encoder string `json:"encoder,omitempty"`
// InsertsFirst sends a request's inserts ahead of its HEADERS in the
// same packet; otherwise after them.
InsertsFirst bool `json:"insertsFirst,omitempty"`
// Huffman is when strings are Huffman-coded: HuffmanShorter or
// HuffmanAlways.
Huffman HuffmanRule `json:"huffman"`
}
QPACK is how a browser encodes field sections (RFC 9204). Without a dynamic table from the server, every browser sends an exact static match indexed, else a literal naming a static entry, else a literal.
type QUIC ¶
type QUIC struct {
// Version is the QUIC version of every packet: 1.
Version uint32 `json:"version"`
// DatagramSize is the length Initial-carrying datagrams are padded to,
// and the longest datagram the browser sends.
DatagramSize int `json:"datagramSize"`
// Padding is where a datagram carrying an Initial packet is padded:
// PaddingScattered, PaddingTrailing or PaddingEnd.
Padding string `json:"padding"`
// Crypto is how the ClientHello is cut into CRYPTO frames and Initial
// packets.
Crypto QUICCrypto `json:"crypto"`
// PacketNumbers is how packet numbers are assigned:
// PacketNumbersShared, PacketNumbersRandomInitial or
// PacketNumbersPerSpace.
PacketNumbers string `json:"packetNumbers"`
// DCIDLength is the length of the first Initial's random Destination
// Connection ID; with DCIDLengthBiased, the shortest length it picks.
DCIDLength int `json:"dcidLength"`
// DCIDLengthRule is how DCIDLength is picked per connection: empty is
// always DCIDLength; DCIDLengthBiased.
DCIDLengthRule string `json:"dcidLengthRule,omitempty"`
// SCIDLength is the length of the client's own connection IDs. Zero
// means it issues none.
SCIDLength int `json:"scidLength"`
// NewConnectionIDs is how many connection IDs the client issues with
// NEW_CONNECTION_ID to a server whose active_connection_id_limit is 4.
// Zero with SCIDLength 0.
NewConnectionIDs int `json:"newConnectionIds,omitempty"`
// TransportParameters are the ClientHello's quic_transport_parameters
// (RFC 9000, section 18) in one observed order, permuted as
// TransportParameterOrder says.
TransportParameters []TransportParameter `json:"transportParameters"`
// TransportParameterOrder is TransportParameterOrderFixed,
// TransportParameterOrderShuffled or TransportParameterOrderRotated.
TransportParameterOrder string `json:"transportParameterOrder"`
// AckInitial acknowledges the server's Initial packets. Otherwise the
// Initial keys are dropped at the first Handshake packet.
AckInitial bool `json:"ackInitial,omitempty"`
// AckBeforeFinished acknowledges the server's first flight in
// datagrams before the one carrying the Finished; otherwise the
// Handshake ACK goes with the Finished.
AckBeforeFinished bool `json:"ackBeforeFinished,omitempty"`
// Coalesce puts packets of different spaces that are ready together in
// one datagram (RFC 9000, section 12.2); otherwise one per datagram.
Coalesce bool `json:"coalesce,omitempty"`
// AckDelay is what an ACK frame's ACK Delay says: AckDelayActual or
// AckDelayConstant.
AckDelay string `json:"ackDelay"`
// AckDelayConstant is the range a connection's constant ACK Delay is
// drawn from, as sent (before ack_delay_exponent).
AckDelayConstant *Range `json:"ackDelayConstant,omitempty"`
// AckOnlyLimit: after this many consecutive ACK-only 1-RTT packets,
// the next carries AckOnlyFrame to make it ack-eliciting. Zero: never.
AckOnlyLimit int `json:"ackOnlyLimit,omitempty"`
AckOnlyFrame string `json:"ackOnlyFrame,omitempty"`
// SpinBit is how the latency spin bit of 1-RTT packets is set:
// SpinBitZero, SpinBitRandom or SpinBitSpin.
SpinBit string `json:"spinBit"`
// Tokens sends the server's last NEW_TOKEN token on a new connection.
Tokens bool `json:"tokens,omitempty"`
// ZeroRTT resumes QUIC connections with a ticket an earlier QUIC
// connection to the origin received, and sends a resumed connection's
// first requests in 0-RTT (HTTP3.EarlyData). False: every QUIC
// connection is a full handshake (resuming without 0-RTT was never
// captured). Independent of TLS.Resumption, which is TCP's: Safari
// resumes over QUIC only.
ZeroRTT bool `json:"zeroRtt,omitempty"`
// CloseReply answers the server's CONNECTION_CLOSE with a NO_ERROR
// CONNECTION_CLOSE (frame type 0x1d) plus ACK; otherwise silence.
// Unused connections end by max_idle_timeout.
CloseReply bool `json:"closeReply,omitempty"`
// Loss is handshake probing, give-up, and path degrading.
Loss QUICLoss `json:"loss"`
// KeepAlive is the PING sent while a request waits on a quiet
// connection.
KeepAlive QUICKeepAlive `json:"keepAlive"`
// Ack is how often the client acknowledges a bulk receive.
Ack QUICAck `json:"ack"`
// Credit is how the client returns flow-control credit.
Credit QUICCredit `json:"credit"`
// KeyUpdate is how the client takes part in 1-RTT key updates (RFC
// 9001, section 6).
KeyUpdate QUICKeyUpdate `json:"keyUpdate"`
// VersionNegotiation is what a Version Negotiation packet makes the
// client do.
VersionNegotiation QUICVersionNegotiation `json:"versionNegotiation"`
// StreamsBlocked is the STREAMS_BLOCKED the client sends while its
// requests wait for the server's limit on bidirectional streams. Nil:
// not measured; the client sends none.
StreamsBlocked *QUICStreamsBlocked `json:"streamsBlocked,omitempty"`
}
QUIC is how a browser speaks QUIC version 1 (RFC 9000) for HTTP/3: Initial packets, connection IDs, transport parameters, acknowledgements, loss recovery, credit, Version Negotiation, resumption, stream limits and close. Generated by internal/harness/cmd/h3gen from the h3 captures; not hand-edited.
type QUICAck ¶
type QUICAck struct {
// Every acknowledges every Every-th ack-eliciting packet, or at
// max_ack_delay.
Every int `json:"every"`
// WarmupPackets: until this many packets have arrived, acknowledge
// every WarmupEvery-th instead.
WarmupPackets int `json:"warmupPackets,omitempty"`
WarmupEvery int `json:"warmupEvery,omitempty"`
// Batched waits until arrived packets are all read, so one ACK may
// cover more than Every; otherwise exactly Every.
Batched bool `json:"batched,omitempty"`
// AfterRTT also acknowledges at once, while an acknowledgement is
// pending, once a smoothed RTT has passed since the last ACK sent: a
// lone packet arriving after a quiet spell is acknowledged when it
// arrives, not at max_ack_delay (Firefox).
AfterRTT bool `json:"afterRtt,omitempty"`
}
QUICAck is how often a client acknowledges during a bulk receive. The ACK delay and ACK-only rules are QUIC's AckDelay and AckOnlyLimit.
type QUICCredit ¶
type QUICCredit struct {
// StreamDivisor sends MAX_STREAM_DATA once the bytes received since
// the last update reach window / StreamDivisor.
StreamDivisor int `json:"streamDivisor"`
// ConnectionDivisor: MAX_DATA likewise for the connection. Zero with
// ConnectionStreamWindow.
ConnectionDivisor int `json:"connectionDivisor,omitempty"`
// ConnectionStreamWindow sets the connection limit to bytes received
// plus the stream window once that passes the initial limit, then
// with every MAX_STREAM_DATA.
ConnectionStreamWindow bool `json:"connectionStreamWindow,omitempty"`
}
QUICCredit is how a client returns flow-control credit. Its windows are its initial transport parameters (initial_max_stream_data_bidi_local, initial_max_data) and never grow: an update sets the limit to the bytes received plus the window.
type QUICCrypto ¶
type QUICCrypto struct {
// Split is CryptoSplitShuffle, CryptoSplitSNICut or CryptoSplitOrdered.
Split string `json:"split"`
// FirstPacket is how many ClientHello bytes the first Initial packet
// carries with CryptoSplitOrdered.
FirstPacket int `json:"firstPacket,omitempty"`
// Head is the range of the length of the ClientHello's head that
// stays in the first packet with CryptoSplitShuffle.
Head *Range `json:"head,omitempty"`
// AddedFrames is the range of how many times a packet's CRYPTO data is
// split further with CryptoSplitShuffle, while padding lasts.
AddedFrames *Range `json:"addedFrames,omitempty"`
// Pings is the range of how many PING frames a packet gets with
// CryptoSplitShuffle, while padding lasts.
Pings *Range `json:"pings,omitempty"`
}
QUICCrypto is how the ClientHello is cut into CRYPTO frames across the client's Initial packets.
type QUICErrorCode ¶
type QUICErrorCode uint64
QUICErrorCode is a QUIC transport error code. In JSON it is a hex string such as "0x53f8".
func (QUICErrorCode) MarshalText ¶
func (c QUICErrorCode) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler.
func (QUICErrorCode) String ¶
func (c QUICErrorCode) String() string
String returns the code in hex.
func (*QUICErrorCode) UnmarshalText ¶
func (c *QUICErrorCode) UnmarshalText(text []byte) error
UnmarshalText accepts "0x" followed by hex digits.
type QUICGiveUp ¶
type QUICGiveUp struct {
// AfterMillis ends the attempt this long after it started if the
// handshake is incomplete. Zero: it lasts until max_idle_timeout, or
// is not measured.
AfterMillis int `json:"afterMs,omitempty"`
// Close is what the client sends at AfterMillis: CloseTransport,
// CloseApplication, or empty for nothing (Firefox fresh).
Close string `json:"close,omitempty"`
// Reason is CloseTransport's reason phrase, "{elapsed_us}" replaced by
// the microseconds since the attempt started.
Reason string `json:"reason,omitempty"`
// DatagramSize is the close datagram's padded size: inside the Initial
// packet, or trailing zeros with CloseApplication.
DatagramSize int `json:"datagramSize,omitempty"`
}
QUICGiveUp is when an unanswered handshake ends and what the client sends then.
type QUICHello ¶
type QUICHello struct {
// CipherSuites replaces TLS.CipherSuites. Required.
CipherSuites []Code `json:"cipherSuites"`
// SessionIDLength is legacy_session_id's length (RFC 9001, section
// 8.4).
SessionIDLength uint8 `json:"sessionIdLength"`
// ExtensionOrder is ExtensionOrderFixed or ExtensionOrderShuffled,
// independent of TLS's.
ExtensionOrder string `json:"extensionOrder"`
// Last are extensions a shuffled hello keeps last, in this order,
// before pre_shared_key.
Last []Code `json:"last,omitempty"`
// Drop are TLS's extensions the hello leaves out; GREASE drops both
// GREASE extensions.
Drop []Code `json:"drop,omitempty"`
// Replace are extensions whose bodies differ from TLS's, each
// replacing the one of its type in place.
Replace []Extension `json:"replace,omitempty"`
// TransportParametersBefore is the extension quic_transport_parameters
// precedes in a fixed order. Required with ExtensionOrderFixed.
TransportParametersBefore *Code `json:"transportParametersBefore,omitempty"`
// EarlyDataBefore is the extension early_data precedes in a resumed
// hello of a fixed order (Safari: supported_versions); nil puts it
// after the others, before Last.
EarlyDataBefore *Code `json:"earlyDataBefore,omitempty"`
// ResumedECHPayloadLengths are GREASE ECH's payload lengths in a
// resumed hello. Required with QUIC.ZeroRTT and
// encrypted_client_hello.
ResumedECHPayloadLengths []uint16 `json:"resumedEchPayloadLengths,omitempty"`
// VersionNegotiation is how the hello of a connection retried after
// Version Negotiation differs from a full one. Nil: the profile does
// not retry.
VersionNegotiation *QUICHelloRetry `json:"versionNegotiation,omitempty"`
}
QUICHello is how a browser's QUIC ClientHello differs from its TLS one (Spec.TLS): TLS's extensions without Drop, Replace applied, plus quic_transport_parameters, ordered per ExtensionOrder. A resumed hello (QUIC.ZeroRTT) also applies TLS.Resumption.Drop where TLS resumes, adds early_data, and ends with pre_shared_key. Required with Spec.QUIC; derived by internal/harness/cmd/hellogen.
type QUICHelloRetry ¶
type QUICHelloRetry struct {
// Drop are the full hello's extensions it leaves out.
Drop []Code `json:"drop,omitempty"`
// Replace are extensions whose bodies differ, each replacing the one
// of its type in place.
Replace []Extension `json:"replace,omitempty"`
// Padding adds padding (0x0015) last, sized as NSS and BoringSSL
// size it: a hello of 256 to 511 bytes is padded to 512.
Padding bool `json:"padding,omitempty"`
}
QUICHelloRetry is how a retried QUIC hello differs from a full one.
type QUICKeepAlive ¶
type QUICKeepAlive struct {
// PeriodMillis is the PING period.
PeriodMillis int `json:"periodMs"`
// From is KeepAliveFromSent, KeepAliveFromIdle or
// KeepAliveFromReceived.
From string `json:"from"`
}
QUICKeepAlive is the PING a client sends while a request waits for its response and nothing arrives: PeriodMillis after the moment From names, then every PeriodMillis. An idle connection sends none.
type QUICKeyUpdate ¶
type QUICKeyUpdate struct {
// Initiate starts key updates of the client's own. No browser does;
// each only follows the server's.
Initiate bool `json:"initiate"`
}
QUICKeyUpdate is how a client takes part in key updates.
type QUICLoss ¶
type QUICLoss struct {
// InitialPTOMillis is the first probe timeout with no RTT sample.
// Zero: not measured.
InitialPTOMillis int `json:"initialPtoMs,omitempty"`
// CachedRTT starts a resumed connection from the RTT of the connection
// whose ticket it resumes (RFC 9002, section 6.2.2).
CachedRTT bool `json:"cachedRtt,omitempty"`
// PTOAckDelay counts max_ack_delay in the probe timeout before the
// handshake completes too, not only in 1-RTT as RFC 9002 does.
PTOAckDelay bool `json:"ptoAckDelay,omitempty"`
// Probe is what a handshake probe sends: ProbeFlight or
// ProbeOnePacket. Empty: not measured (Safari).
Probe string `json:"probe,omitempty"`
// SkipPacketNumber skips one packet number before every probe, in the
// handshake and 1-RTT, but not before a close.
SkipPacketNumber bool `json:"skipPacketNumber,omitempty"`
// Fresh and Resumed are when a handshake without and with a resumed
// ticket gives up, and how it ends.
Fresh QUICGiveUp `json:"fresh"`
Resumed QUICGiveUp `json:"resumed"`
// AbandonClose is how the client ends an attempt dropped because TCP
// won (HTTP3.Discovery.Fallback.AbandonOnTCP): CloseZeroRTT or empty.
AbandonClose string `json:"abandonClose,omitempty"`
// PathDegrading is when a live connection's path counts as dead and
// what follows. Nil: never; the connection runs to its idle timeout.
PathDegrading *QUICPathDegrading `json:"pathDegrading,omitempty"`
}
QUICLoss is how a client recovers from loss where it differs from RFC 9002. Probe timeouts double after each unanswered probe.
type QUICPathDegrading ¶
type QUICPathDegrading struct {
// AfterPTOs: the path is degrading once the oldest unacknowledged
// ack-eliciting packet is this many PTOs old, without back-off.
AfterPTOs int `json:"afterPtos,omitempty"`
// AfterMillis: the path is dead once nothing has arrived for this
// long while a request waits.
AfterMillis int `json:"afterMs,omitempty"`
// Action is PathMigrate or PathClose.
Action string `json:"action"`
// CloseReason is PathClose's CONNECTION_CLOSE reason phrase.
CloseReason string `json:"closeReason,omitempty"`
}
QUICPathDegrading is a client's path-degrading rule. Exactly one of AfterPTOs and AfterMillis is set.
type QUICStreamsBlocked ¶ added in v0.2.0
type QUICStreamsBlocked struct {
// AtRequest is what a request made at the limit sends, each frame in a
// packet of its own: StreamsBlockedEveryRequest or
// StreamsBlockedFirstRequest.
AtRequest string `json:"atRequest"`
// AfterRaise is what a waiting request sends when, the limit raised,
// it opens its stream and takes the last one the limit allows:
// StreamsBlockedRaiseAlways, StreamsBlockedRaiseWaiting, or empty for
// nothing.
AfterRaise string `json:"afterRaise,omitempty"`
}
QUICStreamsBlocked is when a client sends STREAMS_BLOCKED (RFC 9000, section 19.14). A request made when the streams the server allows are all taken waits on its connection, in the order made, until MAX_STREAMS raises the limit. Every frame is for bidirectional streams (type 0x16) and carries the limit the client has at the time.
type QUICVersion ¶
type QUICVersion uint32
QUICVersion is a QUIC version. In JSON it is 8 hex digits with 0x, such as "0x00000001", or "GREASE" for a reserved version 0x?a?a?a?a (RFC 9000, section 15) picked at random per connection.
const GREASEVersion QUICVersion = 0x0a0a0a0a
GREASEVersion stands for any reserved version: the lowest, 0x0a0a0a0a.
func (QUICVersion) MarshalText ¶
func (v QUICVersion) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler.
func (QUICVersion) String ¶
func (v QUICVersion) String() string
String returns "GREASE" or the version in hex.
func (*QUICVersion) UnmarshalText ¶
func (v *QUICVersion) UnmarshalText(text []byte) error
UnmarshalText accepts "GREASE" or "0x" followed by 1-8 hex digits. Any reserved version is stored as GREASEVersion.
type QUICVersionNegotiation ¶
type QUICVersionNegotiation struct {
// Retry starts a new connection at once in a version the packet lists
// from version_information's available ones.
Retry bool `json:"retry"`
// DowngradeError closes the retried connection with this error code
// (0x1c) once the server's transport parameters lack
// version_information (RFC 9368's downgrade check). Zero with Retry:
// no check.
DowngradeError QUICErrorCode `json:"downgradeError,omitempty"`
}
QUICVersionNegotiation is what a Version Negotiation packet makes a client do. Without Retry the attempt fails at once and no other version is tried.
type Redirects ¶
type Redirects struct {
// MethodChangeOrigin is what a redirect that turns a fetch() or XHR
// into a GET does with the Origin it sent: RedirectOriginKeep sends it
// on; RedirectOriginDrop leaves it to the GET's own rules.
MethodChangeOrigin string `json:"methodChangeOrigin"`
// follows; the request after the last is never sent (Chrome: 19).
// Required.
NavigationLimit int `json:"navigationLimit"`
// HopPreflight is whether a CORS request's cross-origin hop is
// preflighted because the request before it was:
// RedirectPreflightOwn decides each hop alone; RedirectPreflightInherit
// preflights it. Required.
HopPreflight string `json:"hopPreflight"`
// redirect to another site: RedirectSiteChain uses the whole chain;
// RedirectSiteRestart counts only URLs from that redirect on.
// Required.
NavigationSite string `json:"navigationSite"`
// 307 or 308) becomes "null": RedirectNavOriginTaint once the chain is
// tainted per Fetch; RedirectNavOriginCrossOrigin once any redirect
// changed origin. Required.
NavigationOrigin string `json:"navigationOrigin"`
}
Redirects is how a browser follows redirects, where browsers differ; what they share is mimicry's own. See decision 0022.
type Resumption ¶
type Resumption struct {
// Drop are extensions a TLS 1.3 resumed ClientHello leaves out
// (Firefox: session_ticket).
Drop []Code `json:"drop,omitempty"`
// TLS12 is how TLS 1.2 session tickets are used: TLS12Reuse or
// TLS12SingleUse. Empty: TLS 1.2 sessions are not resumed.
TLS12 string `json:"tls12,omitempty"`
// ECHPayloadLengths replace ech.payloadLengths in a TLS 1.3 resumed
// ClientHello, since the padded inner hello carries the ticket (Firefox:
// 400 instead of 240). Required when the ClientHello has
// encrypted_client_hello.
ECHPayloadLengths []uint16 `json:"echPayloadLengths,omitempty"`
}
Resumption describes how a browser resumes sessions. A TLS 1.3 resumed ClientHello is the full one minus Drop, with pre_shared_key last; each ticket is used once, so concurrent connections resume one at a time. A TLS 1.2 ticket goes in session_ticket, used as TLS12 says.
type SOCKS5 ¶
type SOCKS5 struct {
// Methods are the authentication methods offered, in order: 0, no
// authentication, is all browsers offer.
Methods []int `json:"methods"`
// Address is how the target is named: SOCKS5Domain, the host name for
// the proxy to resolve.
Address SOCKS5Address `json:"address"`
}
SOCKS5 is a browser's SOCKS5 (RFC 1928) handshake.
type SOCKS5Address ¶
type SOCKS5Address string
SOCKS5Address is how a SOCKS5 request names its target: a value of SOCKS5.Address.
const (
SOCKS5Domain SOCKS5Address = "domain"
)
Values of SOCKS5Address.
type Spec ¶ added in v0.2.0
type Spec struct {
// Name identifies the profile, for example "chrome-155-macos":
// lowercase letters and digits in parts joined by dashes.
Name string `json:"name"`
Browser string `json:"browser"`
Version string `json:"version"`
Platform string `json:"platform"`
// Deprecated marks a built-in profile older than the newest five
// versions of its browser on its platform. See decision 0035.
Deprecated bool `json:"deprecated,omitempty"`
// CapturesFrom names, per capture scenario ("cookies", "h3-page"), the
// profile whose captures the harness checks this one against, because
// the scenario was not recaptured: an earlier version of its browser on
// its platform, or its own or an earlier version on the platform whose
// network stack it shares (Safari on iOS: macOS). Only the harness
// reads it. See decisions 0035 and 0051.
CapturesFrom map[string]string `json:"capturesFrom,omitempty"`
TLS TLS `json:"tls"`
// HTTP2 is required when the profile offers h2 in ALPN.
HTTP2 *HTTP2 `json:"http2,omitempty"`
// Headers of a top-level navigation request over HTTP/2, in order: the
// profile's base request (KindNavigate in the client).
Headers []Header `json:"headers"`
// HTTP1 describes the same request over HTTP/1.1. Nil writes Headers in
// canonical casing after Host and Connection; set, every kind needs its
// HTTP/1.1 list too.
HTTP1 *HTTP1 `json:"http1,omitempty"`
// Variants are the orders the navigation takes otherwise (a form POST),
// as Kind.Variants.
Variants []Variant `json:"variants,omitempty"`
// Kinds describe the browser's other requests, by kind (KindFetch, ...).
Kinds map[string]*Kind `json:"kinds,omitempty"`
// Context is how the browser fills what depends on which page makes a
// request. Nil: as the Fetch standard says, with no browser extras.
Context *Context `json:"context,omitempty"`
// Cookies are the browser's cookie rules. Required.
Cookies *Cookies `json:"cookies,omitempty"`
// Proxy is how the browser talks to HTTP and SOCKS5 proxies. Nil: not
// measured, so sending through a proxy is an error.
Proxy *Proxy `json:"proxy,omitempty"`
// Redirects is how the browser follows redirects where browsers
// differ. Nil: not measured, so a redirect that changes a request's
// method is an error.
Redirects *Redirects `json:"redirects,omitempty"`
// Connections are how the browser shares connections: its HTTP/1.1
// connections per host and HTTP/2 coalescing. Required.
Connections *Connections `json:"connections,omitempty"`
// WebSocket is how the browser speaks on WebSockets. Nil: not measured,
// so opening a WebSocket is an error.
WebSocket *WebSocket `json:"websocket,omitempty"`
// QUIC and HTTP3 are how the browser speaks HTTP/3; TLS.QUIC is its
// ClientHello. Both or neither. Nil: not measured, so HTTP/3 is never
// used.
QUIC *QUIC `json:"quic,omitempty"`
HTTP3 *HTTP3 `json:"http3,omitempty"`
}
Spec is a browser profile's data: one browser version on one platform.
func Decode ¶
Decode decodes a profile from JSON without validating it, for harness captures, which lack what a complete profile needs. Unknown, miscased and repeated keys and trailing data are errors.
func (*Spec) Validate ¶ added in v0.2.0
Validate checks p and returns a *ValidationError listing every problem, or nil. It rejects what is malformed, forbidden, beyond what mimicry can send, or not measured (decision 0008), but not what is merely unusual: real browsers do odd things a profile must reproduce.
type TLS ¶
type TLS struct {
// RecordVersion is the record-layer version of the records carrying the
// ClientHello: 0x0301 for every browser captured. Zero in a capture
// whose records were not kept.
RecordVersion Code `json:"recordVersion,omitempty"`
// LegacyVersion is the ClientHello's legacy_version: 0x0303 in a TLS 1.3
// ClientHello (RFC 8446, section 4.1.2).
LegacyVersion Code `json:"legacyVersion"`
// SessionIDLength is the length of legacy_session_id, whose bytes are
// random per connection: 32 in TLS 1.3's middlebox compatibility mode
// (RFC 8446, appendix D.4).
SessionIDLength uint8 `json:"sessionIdLength"`
// CipherSuites in the order the browser offers them.
CipherSuites []Code `json:"cipherSuites"`
// CompressionMethods, normally [0] (null).
CompressionMethods ByteList `json:"compressionMethods"`
// ExtensionOrder says whether the browser sends Extensions in this exact
// order (ExtensionOrderFixed) or permutes them per connection
// (ExtensionOrderShuffled, Chrome since 110). Pinned extensions keep their
// position either way; see Extension.Pinned.
ExtensionOrder string `json:"extensionOrder"`
// Extensions in the order of one observed ClientHello: a full
// handshake's.
Extensions []Extension `json:"extensions"`
// X25519Reuse says every ClientHello with both key shares, full or
// resumed, over TCP or QUIC, sends one X25519 key in both:
// X25519MLKEM768's X25519 part is the x25519 share (Firefox).
// hellogen derives it from the captured hellos' key bytes.
X25519Reuse bool `json:"x25519Reuse,omitempty"`
// Resumption is how the browser resumes a TLS 1.3 session on a new
// TCP connection to a server it holds a ticket for. Nil: it does not
// (Safari), and every TCP connection is a full handshake. Over QUIC
// the browser resumes as QUIC.ZeroRTT says.
Resumption *Resumption `json:"resumption,omitempty"`
// WebSocketH1 is how the hello of a WebSocket's own HTTP/1.1
// connection differs from this one. Required with Spec.WebSocket;
// hellogen derives it.
WebSocketH1 *WebSocketHello `json:"websocketH1,omitempty"`
// QUIC is how the hello sent over QUIC differs from this one.
// Required with Spec.QUIC; hellogen derives it.
QUIC *QUICHello `json:"quic,omitempty"`
}
TLS describes a browser's ClientHello.
type TransportParameter ¶
type TransportParameter struct {
ID TransportParameterID `json:"id"`
// Value is a parameter's value that is one variable-length integer.
Value *uint64 `json:"value,omitempty"`
// Data is the exact value of a parameter that is not an integer.
Data Bytes `json:"data,omitempty"`
// Versions of version_information (RFC 9368): the chosen version,
// then the available ones. GREASEVersion stands for a reserved
// version 0x?a?a?a?a, random per connection.
Versions []QUICVersion `json:"versions,omitempty"`
// ShuffleVersions sends the available versions in a random order per
// connection (Chrome).
ShuffleVersions bool `json:"shuffleVersions,omitempty"`
// MaxLength is the longest random value of a GREASE parameter; its
// length is uniform in [0, MaxLength].
MaxLength int `json:"maxLength,omitempty"`
// Resumed sends the parameter only on a resumed connection.
Resumed bool `json:"resumed,omitempty"`
// Last keeps the parameter last, in order, whatever
// TransportParameterOrder permutes.
Last bool `json:"last,omitempty"`
}
TransportParameter is one QUIC transport parameter. Its value is given in one of these ways, by ID:
- initial_source_connection_id: none; it is the client's Source Connection ID (SCIDLength bytes).
- initial_rtt (0x3127): none; Resumed, and the RTT measured on the connection whose ticket is resumed, in microseconds (Chrome).
- version_information (0x11): Versions.
- GREASE: MaxLength.
- Value for an integer parameter, Data for any other (absent: empty).
type TransportParameterID ¶
type TransportParameterID uint64
TransportParameterID is a transport parameter's ID. In JSON it is a hex string such as "0x0f", or "GREASE" for a reserved ID (31 * N + 27, RFC 9000, section 18.1) picked at random per connection.
const ( TPMaxIdleTimeout TransportParameterID = 0x01 TPMaxUDPPayloadSize TransportParameterID = 0x03 TPInitialMaxData TransportParameterID = 0x04 TPInitialMaxStreamDataBidiLocal TransportParameterID = 0x05 TPInitialMaxStreamDataBidiRem TransportParameterID = 0x06 TPInitialMaxStreamDataUni TransportParameterID = 0x07 TPInitialMaxStreamsBidi TransportParameterID = 0x08 TPInitialMaxStreamsUni TransportParameterID = 0x09 TPAckDelayExponent TransportParameterID = 0x0a TPMaxAckDelay TransportParameterID = 0x0b TPActiveConnectionIDLimit TransportParameterID = 0x0e TPInitialSourceConnectionID TransportParameterID = 0x0f TPVersionInformation TransportParameterID = 0x11 TPInitialRTT TransportParameterID = 0x3127 )
Transport parameter IDs with special handling in profiles.
const GREASETransportParameter TransportParameterID = 27
GREASETransportParameter stands for any reserved transport parameter ID: the lowest, 27.
func (TransportParameterID) MarshalText ¶
func (id TransportParameterID) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler.
func (TransportParameterID) String ¶
func (id TransportParameterID) String() string
String returns "GREASE" or the ID in hex, at least two digits.
func (*TransportParameterID) UnmarshalText ¶
func (id *TransportParameterID) UnmarshalText(text []byte) error
UnmarshalText accepts "GREASE" or "0x" followed by hex digits. Unlike Code, a reserved ID in hex stays itself: browsers send real parameters in the reserved space (Firefox's min_ack_delay, 0xff02de1a).
type UploadRecords ¶ added in v0.2.0
type UploadRecords struct {
// HeadApart sends the head in a record of its own, the body starting
// a new one (Chrome, Safari); false sends head and body as one
// stream, cut into full records from the head's first byte (Firefox).
HeadApart bool `json:"headApart"`
// JoinUpTo, with HeadApart, sends a request whose head and body
// together are at most this many bytes in one record (Chrome: 1400);
// 0: never.
JoinUpTo int `json:"joinUpTo,omitempty"`
}
UploadRecords is how a browser cuts an HTTP/1.1 request with a body into TLS records. Every record is full (MaxRecord bytes of content) but the last of the head or of the body.
type Urgency ¶
type Urgency struct {
// Priority is the priority header's value; empty sends none.
Priority string `json:"priority,omitempty"`
Weight uint8 `json:"weight,omitempty"`
}
Urgency is a request's priority signals.
type ValidationError ¶
type ValidationError struct {
Problems []Problem
}
ValidationError lists every problem found in a profile.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
type Variant ¶
type Variant struct {
// Method is the request's method; empty is GET.
Method string `json:"method,omitempty"`
// Site is the request URL's own relation to its page (after a
// redirect too, where sec-fetch-site reports the whole chain's):
// SiteSameSite or SiteCrossSite; empty is same-origin; SiteNone a
// navigation no page made (a typed URL), whatever its URL.
Site string `json:"site,omitempty"`
// CORSChecked is a request that carries Origin or headers the page
// set.
CORSChecked bool `json:"corsChecked,omitempty"`
// PageSet is a request that carries a header the page set itself (not
// one the kind's list names). Such a request is CORS-checked, so
// PageSet needs CORSChecked.
PageSet bool `json:"pageSet,omitempty"`
// Redirected is a request made by following a redirect.
Redirected bool `json:"redirected,omitempty"`
// CrossOriginRedirect is a redirected request to another origin than
// the URL whose redirect it follows (Safari then sends no
// Sec-Fetch-*). Needs Redirected.
CrossOriginRedirect bool `json:"crossOriginRedirect,omitempty"`
// OriginBeforeRedirect is a redirected request whose previous request,
// the one the redirect answered, carried Origin (Chrome keeps that
// Origin's place; one the redirect adds goes after Sec-Fetch-*).
// Needs Redirected.
OriginBeforeRedirect bool `json:"originBeforeRedirect,omitempty"`
// MethodChangedByRedirect is a redirected request whose method the
// redirect changed (a PATCH answered 303 goes on as a GET): Chrome
// drops the Origin the previous request carried and adds its own
// after Sec-Fetch-*. Needs Redirected.
MethodChangedByRedirect bool `json:"methodChangedByRedirect,omitempty"`
// InsecureBeforeRedirect is a redirected request whose previous
// request went to a non-secure URL (a typed http:// answered with a
// redirect to https://): Safari carries Upgrade-Insecure-Requests over
// and orders the hop otherwise. Needs Redirected.
InsecureBeforeRedirect bool `json:"insecureBeforeRedirect,omitempty"`
// CrossSiteRedirect is a redirected navigation to another site than
// the URL whose redirect it follows (schemeful sites): Safari sends
// Referer before Sec-Fetch-Dest on such a hop, after it on one that
// stays on its site (nav-redirect-page). Navigations only; needs
// CrossOriginRedirect.
CrossSiteRedirect bool `json:"crossSiteRedirect,omitempty"`
// Insecure is a request to a URL that is not potentially trustworthy
// (plain http:// to non-loopback). Such a variant has HTTP1 and no
// Headers. A non-secure request with no exact match takes the kind's
// Insecure-only variant.
Insecure bool `json:"insecure,omitempty"`
Headers []Header `json:"headers,omitempty"`
// HTTP1 is the variant over HTTP/1.1. Empty on a secure variant: not
// measured over HTTP/1.1 (its capture was HTTP/2 only), so a request
// matching it there is an error.
HTTP1 []Header `json:"http1,omitempty"`
}
Variant is the header order a browser uses for some requests of a kind (a POST, a CORS-checked request, a redirect). A request takes the variant whose condition it matches exactly, else the kind's own order; once a kind has a redirected variant, a redirected request takes only an exact one. A header the variant's lists lack is not sent.
type WebSocket ¶
type WebSocket struct {
// Extensions is the Sec-WebSocket-Extensions offer, exactly as sent.
// Required.
Extensions string `json:"extensions"`
// Compression is the deflate implementation (level 6) used once the
// server accepts permessage-deflate: CompressionChromiumZlib6,
// CompressionZlib6 or CompressionZlibRS6. Required.
Compression string `json:"compression"`
// Uncompressed is which messages the browser sends uncompressed (RSV1
// clear) on such a socket: UncompressedNever,
// UncompressedEmptyOrLonger or UncompressedEmptyOrNotShorter.
// Required.
Uncompressed string `json:"uncompressed"`
// WindowBits8 is what the browser does when the server answers
// client_max_window_bits=8, which zlib cannot compress with:
// WindowBits8As9 or WindowBits8Fail. Required.
WindowBits8 string `json:"windowBits8"`
// H2Data is how a socket over HTTP/2 writes its frames into DATA
// frames, each at most HTTP2.MaxDataFrame long: H2DataTogether,
// H2DataHeaderAlone or H2DataSplitControl. Required.
H2Data string `json:"h2Data"`
// CloseH1 is what the browser does with the HTTP/1.1 connection once
// the close handshake is done: CloseAfterWait or CloseAtOnce. Empty:
// not measured, and the connection is left for the server to close.
CloseH1 string `json:"closeH1,omitempty"`
// CloseWaitMillis is how long CloseAfterWait waits for the server to
// close first (Chrome: 2000).
CloseWaitMillis int `json:"closeWaitMs,omitempty"`
// CloseH2 is how the browser ends the socket's HTTP/2 stream:
// CloseEndStream or CloseResetStream. Empty: not measured, and the
// stream is left for the server to end.
CloseH2 string `json:"closeH2,omitempty"`
}
WebSocket is how the browser speaks on a WebSocket once its handshake is sent. The handshake itself is the websocket kind (KindWebSocket); the HTTP/1.1-only connection opened when the server allows no extended CONNECT says hello as TLS.WebSocketH1.
type WebSocketHello ¶
type WebSocketHello struct {
// ALPN replaces the ALPN extension's protocols (every browser:
// http/1.1 only). Required.
ALPN []string `json:"alpn"`
// Drop are extensions it leaves out besides those resumption drops
// (Chrome: ALPS; Firefox: compress_certificate).
Drop []Code `json:"drop,omitempty"`
}
WebSocketHello is how the ClientHello of a WebSocket's own HTTP/1.1 connection differs from TLS's. It resumes as TLS.Resumption says; only resumed ones were captured, so a full handshake is assumed alike.