network

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package network implements the Network domain. Network domain allows tracking network activities of the page. It exposes information about http, file, data and other requests and responses, their headers, bodies, timing, etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(conn *rpcc.Conn) *domainClient

NewClient returns a client for the Network domain with the connection set to conn.

Types

type AuthChallenge

type AuthChallenge struct {
	Source *string `json:"source,omitempty"` // Source of the authentication challenge.
	Origin string  `json:"origin"`           // Origin of the challenger.
	Scheme string  `json:"scheme"`           // The authentication scheme used, such as basic or digest
	Realm  string  `json:"realm"`            // The realm of the challenge. May be empty.
}

AuthChallenge Authorization challenge for HTTP status code 401 or 407.

type AuthChallengeResponse

type AuthChallengeResponse struct {
	Response string  `json:"response"`           // The decision on what to do in response to the authorization challenge.  Default means deferring to the default behavior of the net stack, which will likely either the Cancel authentication or display a popup dialog box.
	Username *string `json:"username,omitempty"` // The username to provide, possibly empty. Should only be set if response is ProvideCredentials.
	Password *string `json:"password,omitempty"` // The password to provide, possibly empty. Should only be set if response is ProvideCredentials.
}

AuthChallengeResponse Response to an AuthChallenge.

type BlockedReason

type BlockedReason int

BlockedReason The reason why request was blocked.

const (
	BlockedReasonNotSet BlockedReason = iota
	BlockedReasonCsp
	BlockedReasonMixedContent
	BlockedReasonOrigin
	BlockedReasonInspector
	BlockedReasonSubresourceFilter
	BlockedReasonOther
)

BlockedReason as enums.

func (BlockedReason) MarshalJSON

func (e BlockedReason) MarshalJSON() ([]byte, error)

MarshalJSON encodes enum into a string or null when not set.

func (BlockedReason) String

func (e BlockedReason) String() string

func (*BlockedReason) UnmarshalJSON

func (e *BlockedReason) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes a string value into a enum.

func (BlockedReason) Valid

func (e BlockedReason) Valid() bool

Valid returns true if enum is set.

type CachedResource

type CachedResource struct {
	URL      string       `json:"url"`                // Resource URL. This is the url of the original network request.
	Type     ResourceType `json:"type"`               // Type of this resource.
	Response *Response    `json:"response,omitempty"` // Cached response data.
	BodySize float64      `json:"bodySize"`           // Cached response body size.
}

CachedResource Information about the cached resource.

type CanClearBrowserCacheReply

type CanClearBrowserCacheReply struct {
	Result bool `json:"result"` // True if browser cache can be cleared.
}

CanClearBrowserCacheReply represents the return values for CanClearBrowserCache in the Network domain.

type CanClearBrowserCookiesReply

type CanClearBrowserCookiesReply struct {
	Result bool `json:"result"` // True if browser cookies can be cleared.
}

CanClearBrowserCookiesReply represents the return values for CanClearBrowserCookies in the Network domain.

type CanEmulateNetworkConditionsReply

type CanEmulateNetworkConditionsReply struct {
	Result bool `json:"result"` // True if emulation of network conditions is supported.
}

CanEmulateNetworkConditionsReply represents the return values for CanEmulateNetworkConditions in the Network domain.

type ConnectionType

type ConnectionType int

ConnectionType Loading priority of a resource request.

const (
	ConnectionTypeNotSet ConnectionType = iota
	ConnectionTypeNone
	ConnectionTypeCellular2g
	ConnectionTypeCellular3g
	ConnectionTypeCellular4g
	ConnectionTypeBluetooth
	ConnectionTypeEthernet
	ConnectionTypeWifi
	ConnectionTypeWimax
	ConnectionTypeOther
)

ConnectionType as enums.

func (ConnectionType) MarshalJSON

func (e ConnectionType) MarshalJSON() ([]byte, error)

MarshalJSON encodes enum into a string or null when not set.

func (ConnectionType) String

func (e ConnectionType) String() string

func (*ConnectionType) UnmarshalJSON

func (e *ConnectionType) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes a string value into a enum.

func (ConnectionType) Valid

func (e ConnectionType) Valid() bool

Valid returns true if enum is set.

type ContinueInterceptedRequestArgs

type ContinueInterceptedRequestArgs struct {
	InterceptionID        InterceptionID         `json:"interceptionId"`                  //
	ErrorReason           ErrorReason            `json:"errorReason,omitempty"`           // If set this causes the request to fail with the given reason. Must not be set in response to an authChallenge.
	RawResponse           *string                `json:"rawResponse,omitempty"`           // If set the requests completes using with the provided base64 encoded raw response, including HTTP status line and headers etc... Must not be set in response to an authChallenge.
	URL                   *string                `json:"url,omitempty"`                   // If set the request url will be modified in a way that's not observable by page. Must not be set in response to an authChallenge.
	Method                *string                `json:"method,omitempty"`                // If set this allows the request method to be overridden. Must not be set in response to an authChallenge.
	PostData              *string                `json:"postData,omitempty"`              // If set this allows postData to be set. Must not be set in response to an authChallenge.
	Headers               Headers                `json:"headers,omitempty"`               // If set this allows the request headers to be changed. Must not be set in response to an authChallenge.
	AuthChallengeResponse *AuthChallengeResponse `json:"authChallengeResponse,omitempty"` // Response to a requestIntercepted with an authChallenge. Must not be set otherwise.
}

ContinueInterceptedRequestArgs represents the arguments for ContinueInterceptedRequest in the Network domain.

func NewContinueInterceptedRequestArgs

func NewContinueInterceptedRequestArgs(interceptionID InterceptionID) *ContinueInterceptedRequestArgs

NewContinueInterceptedRequestArgs initializes ContinueInterceptedRequestArgs with the required arguments.

func (*ContinueInterceptedRequestArgs) SetAuthChallengeResponse

func (a *ContinueInterceptedRequestArgs) SetAuthChallengeResponse(authChallengeResponse AuthChallengeResponse) *ContinueInterceptedRequestArgs

SetAuthChallengeResponse sets the AuthChallengeResponse optional argument. Response to a requestIntercepted with an authChallenge. Must not be set otherwise.

func (*ContinueInterceptedRequestArgs) SetErrorReason

SetErrorReason sets the ErrorReason optional argument. If set this causes the request to fail with the given reason. Must not be set in response to an authChallenge.

func (*ContinueInterceptedRequestArgs) SetHeaders

SetHeaders sets the Headers optional argument. If set this allows the request headers to be changed. Must not be set in response to an authChallenge.

func (*ContinueInterceptedRequestArgs) SetMethod

SetMethod sets the Method optional argument. If set this allows the request method to be overridden. Must not be set in response to an authChallenge.

func (*ContinueInterceptedRequestArgs) SetPostData

SetPostData sets the PostData optional argument. If set this allows postData to be set. Must not be set in response to an authChallenge.

func (*ContinueInterceptedRequestArgs) SetRawResponse

SetRawResponse sets the RawResponse optional argument. If set the requests completes using with the provided base64 encoded raw response, including HTTP status line and headers etc... Must not be set in response to an authChallenge.

func (*ContinueInterceptedRequestArgs) SetURL

SetURL sets the URL optional argument. If set the request url will be modified in a way that's not observable by page. Must not be set in response to an authChallenge.

type Cookie struct {
	Name     string         `json:"name"`               // Cookie name.
	Value    string         `json:"value"`              // Cookie value.
	Domain   string         `json:"domain"`             // Cookie domain.
	Path     string         `json:"path"`               // Cookie path.
	Expires  float64        `json:"expires"`            // Cookie expiration date as the number of seconds since the UNIX epoch.
	Size     int            `json:"size"`               // Cookie size.
	HTTPOnly bool           `json:"httpOnly"`           // True if cookie is http-only.
	Secure   bool           `json:"secure"`             // True if cookie is secure.
	Session  bool           `json:"session"`            // True in case of session cookie.
	SameSite CookieSameSite `json:"sameSite,omitempty"` // Cookie SameSite type.
}

Cookie Cookie object

type CookieSameSite

type CookieSameSite int

CookieSameSite Represents the cookie's 'SameSite' status: https://tools.ietf.org/html/draft-west-first-party-cookies

const (
	CookieSameSiteNotSet CookieSameSite = iota
	CookieSameSiteStrict
	CookieSameSiteLax
)

CookieSameSite as enums.

func (CookieSameSite) MarshalJSON

func (e CookieSameSite) MarshalJSON() ([]byte, error)

MarshalJSON encodes enum into a string or null when not set.

func (CookieSameSite) String

func (e CookieSameSite) String() string

func (*CookieSameSite) UnmarshalJSON

func (e *CookieSameSite) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes a string value into a enum.

func (CookieSameSite) Valid

func (e CookieSameSite) Valid() bool

Valid returns true if enum is set.

type DataReceivedClient

type DataReceivedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*DataReceivedReply, error)
	rpcc.Stream
}

DataReceivedClient is a client for DataReceived events. Fired when data chunk was received over the network.

type DataReceivedReply

type DataReceivedReply struct {
	RequestID         RequestID     `json:"requestId"`         // Request identifier.
	Timestamp         MonotonicTime `json:"timestamp"`         // Timestamp.
	DataLength        int           `json:"dataLength"`        // Data chunk length.
	EncodedDataLength int           `json:"encodedDataLength"` // Actual bytes received (might be less than dataLength for compressed encodings).
}

DataReceivedReply is the reply for DataReceived events.

type DeleteCookieArgs

type DeleteCookieArgs struct {
	CookieName string `json:"cookieName"` // Name of the cookie to remove.
	URL        string `json:"url"`        // URL to match cooke domain and path.
}

DeleteCookieArgs represents the arguments for DeleteCookie in the Network domain.

func NewDeleteCookieArgs

func NewDeleteCookieArgs(cookieName string, url string) *DeleteCookieArgs

NewDeleteCookieArgs initializes DeleteCookieArgs with the required arguments.

type EmulateNetworkConditionsArgs

type EmulateNetworkConditionsArgs struct {
	Offline            bool           `json:"offline"`                  // True to emulate internet disconnection.
	Latency            float64        `json:"latency"`                  // Additional latency (ms).
	DownloadThroughput float64        `json:"downloadThroughput"`       // Maximal aggregated download throughput.
	UploadThroughput   float64        `json:"uploadThroughput"`         // Maximal aggregated upload throughput.
	ConnectionType     ConnectionType `json:"connectionType,omitempty"` // Connection type if known.
}

EmulateNetworkConditionsArgs represents the arguments for EmulateNetworkConditions in the Network domain.

func NewEmulateNetworkConditionsArgs

func NewEmulateNetworkConditionsArgs(offline bool, latency float64, downloadThroughput float64, uploadThroughput float64) *EmulateNetworkConditionsArgs

NewEmulateNetworkConditionsArgs initializes EmulateNetworkConditionsArgs with the required arguments.

func (*EmulateNetworkConditionsArgs) SetConnectionType

func (a *EmulateNetworkConditionsArgs) SetConnectionType(connectionType ConnectionType) *EmulateNetworkConditionsArgs

SetConnectionType sets the ConnectionType optional argument. Connection type if known.

type EnableArgs

type EnableArgs struct {
	MaxTotalBufferSize    *int `json:"maxTotalBufferSize,omitempty"`    // Buffer size in bytes to use when preserving network payloads (XHRs, etc).
	MaxResourceBufferSize *int `json:"maxResourceBufferSize,omitempty"` // Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).
}

EnableArgs represents the arguments for Enable in the Network domain.

func NewEnableArgs

func NewEnableArgs() *EnableArgs

NewEnableArgs initializes EnableArgs with the required arguments.

func (*EnableArgs) SetMaxResourceBufferSize

func (a *EnableArgs) SetMaxResourceBufferSize(maxResourceBufferSize int) *EnableArgs

SetMaxResourceBufferSize sets the MaxResourceBufferSize optional argument. Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).

func (*EnableArgs) SetMaxTotalBufferSize

func (a *EnableArgs) SetMaxTotalBufferSize(maxTotalBufferSize int) *EnableArgs

SetMaxTotalBufferSize sets the MaxTotalBufferSize optional argument. Buffer size in bytes to use when preserving network payloads (XHRs, etc).

type ErrorReason

type ErrorReason int

ErrorReason Network level fetch failure reason.

const (
	ErrorReasonNotSet ErrorReason = iota
	ErrorReasonFailed
	ErrorReasonAborted
	ErrorReasonTimedOut
	ErrorReasonAccessDenied
	ErrorReasonConnectionClosed
	ErrorReasonConnectionReset
	ErrorReasonConnectionRefused
	ErrorReasonConnectionAborted
	ErrorReasonConnectionFailed
	ErrorReasonNameNotResolved
	ErrorReasonInternetDisconnected
	ErrorReasonAddressUnreachable
)

ErrorReason as enums.

func (ErrorReason) MarshalJSON

func (e ErrorReason) MarshalJSON() ([]byte, error)

MarshalJSON encodes enum into a string or null when not set.

func (ErrorReason) String

func (e ErrorReason) String() string

func (*ErrorReason) UnmarshalJSON

func (e *ErrorReason) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes a string value into a enum.

func (ErrorReason) Valid

func (e ErrorReason) Valid() bool

Valid returns true if enum is set.

type EventSourceMessageReceivedClient

type EventSourceMessageReceivedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*EventSourceMessageReceivedReply, error)
	rpcc.Stream
}

EventSourceMessageReceivedClient is a client for EventSourceMessageReceived events. Fired when EventSource message is received.

type EventSourceMessageReceivedReply

type EventSourceMessageReceivedReply struct {
	RequestID RequestID     `json:"requestId"` // Request identifier.
	Timestamp MonotonicTime `json:"timestamp"` // Timestamp.
	EventName string        `json:"eventName"` // Message type.
	EventID   string        `json:"eventId"`   // Message identifier.
	Data      string        `json:"data"`      // Message content.
}

EventSourceMessageReceivedReply is the reply for EventSourceMessageReceived events.

type FrameID deprecated

type FrameID = internal.PageFrameID

FrameID is an alias for page.FrameID to avoid a circular dependency.

Deprecated: Use page.FrameID instead.

type GetAllCookiesReply

type GetAllCookiesReply struct {
	Cookies []Cookie `json:"cookies"` // Array of cookie objects.
}

GetAllCookiesReply represents the return values for GetAllCookies in the Network domain.

type GetCertificateArgs

type GetCertificateArgs struct {
	Origin string `json:"origin"` // Origin to get certificate for.
}

GetCertificateArgs represents the arguments for GetCertificate in the Network domain.

func NewGetCertificateArgs

func NewGetCertificateArgs(origin string) *GetCertificateArgs

NewGetCertificateArgs initializes GetCertificateArgs with the required arguments.

type GetCertificateReply

type GetCertificateReply struct {
	TableNames []string `json:"tableNames"` //
}

GetCertificateReply represents the return values for GetCertificate in the Network domain.

type GetCookiesArgs

type GetCookiesArgs struct {
	URLs []string `json:"urls,omitempty"` // The list of URLs for which applicable cookies will be fetched
}

GetCookiesArgs represents the arguments for GetCookies in the Network domain.

func NewGetCookiesArgs

func NewGetCookiesArgs() *GetCookiesArgs

NewGetCookiesArgs initializes GetCookiesArgs with the required arguments.

func (*GetCookiesArgs) SetURLs

func (a *GetCookiesArgs) SetURLs(urls []string) *GetCookiesArgs

SetURLs sets the URLs optional argument. The list of URLs for which applicable cookies will be fetched

type GetCookiesReply

type GetCookiesReply struct {
	Cookies []Cookie `json:"cookies"` // Array of cookie objects.
}

GetCookiesReply represents the return values for GetCookies in the Network domain.

type GetResponseBodyArgs

type GetResponseBodyArgs struct {
	RequestID RequestID `json:"requestId"` // Identifier of the network request to get content for.
}

GetResponseBodyArgs represents the arguments for GetResponseBody in the Network domain.

func NewGetResponseBodyArgs

func NewGetResponseBodyArgs(requestID RequestID) *GetResponseBodyArgs

NewGetResponseBodyArgs initializes GetResponseBodyArgs with the required arguments.

type GetResponseBodyReply

type GetResponseBodyReply struct {
	Body          string `json:"body"`          // Response body.
	Base64Encoded bool   `json:"base64Encoded"` // True, if content was sent as base64.
}

GetResponseBodyReply represents the return values for GetResponseBody in the Network domain.

type Headers

type Headers []byte

Headers Request / response headers as keys / values of JSON object.

func (Headers) Map

func (n Headers) Map() (map[string]string, error)

Map returns the headers decoded into a map.

func (Headers) MarshalJSON

func (h Headers) MarshalJSON() ([]byte, error)

MarshalJSON copies behavior of json.RawMessage.

func (*Headers) UnmarshalJSON

func (h *Headers) UnmarshalJSON(data []byte) error

UnmarshalJSON copies behavior of json.RawMessage.

type Initiator

type Initiator struct {
	Type       string              `json:"type"`                 // Type of this initiator.
	Stack      *runtime.StackTrace `json:"stack,omitempty"`      // Initiator JavaScript stack trace, set for Script only.
	URL        *string             `json:"url,omitempty"`        // Initiator URL, set for Parser type or for Script type (when script is importing module).
	LineNumber *float64            `json:"lineNumber,omitempty"` // Initiator line number, set for Parser type or for Script type (when script is importing module) (0-based).
}

Initiator Information about the request initiator.

type InterceptionID

type InterceptionID string

InterceptionID Unique intercepted request identifier.

type LoaderID

type LoaderID string

LoaderID Unique loader identifier.

type LoadingFailedClient

type LoadingFailedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*LoadingFailedReply, error)
	rpcc.Stream
}

LoadingFailedClient is a client for LoadingFailed events. Fired when HTTP request has failed to load.

type LoadingFailedReply

type LoadingFailedReply struct {
	RequestID     RequestID     `json:"requestId"`               // Request identifier.
	Timestamp     MonotonicTime `json:"timestamp"`               // Timestamp.
	Type          ResourceType  `json:"type"`                    // Resource type.
	ErrorText     string        `json:"errorText"`               // User friendly error message.
	Canceled      *bool         `json:"canceled,omitempty"`      // True if loading was canceled.
	BlockedReason BlockedReason `json:"blockedReason,omitempty"` // The reason why loading was blocked, if any.
}

LoadingFailedReply is the reply for LoadingFailed events.

type LoadingFinishedClient

type LoadingFinishedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*LoadingFinishedReply, error)
	rpcc.Stream
}

LoadingFinishedClient is a client for LoadingFinished events. Fired when HTTP request has finished loading.

type LoadingFinishedReply

type LoadingFinishedReply struct {
	RequestID         RequestID     `json:"requestId"`         // Request identifier.
	Timestamp         MonotonicTime `json:"timestamp"`         // Timestamp.
	EncodedDataLength float64       `json:"encodedDataLength"` // Total number of bytes received for this request.
}

LoadingFinishedReply is the reply for LoadingFinished events.

type MonotonicTime

type MonotonicTime float64

MonotonicTime Monotonically increasing time in seconds since an arbitrary point in the past.

func (MonotonicTime) MarshalJSON

func (t MonotonicTime) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. Encodes to null if t is zero.

func (MonotonicTime) String

func (t MonotonicTime) String() string

String calls (time.Time).String().

func (MonotonicTime) Time

func (t MonotonicTime) Time() time.Time

Time parses the Unix time with millisecond accuracy.

func (*MonotonicTime) UnmarshalJSON

func (t *MonotonicTime) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ReplayXHRArgs

type ReplayXHRArgs struct {
	RequestID RequestID `json:"requestId"` // Identifier of XHR to replay.
}

ReplayXHRArgs represents the arguments for ReplayXHR in the Network domain.

func NewReplayXHRArgs

func NewReplayXHRArgs(requestID RequestID) *ReplayXHRArgs

NewReplayXHRArgs initializes ReplayXHRArgs with the required arguments.

type Request

type Request struct {
	URL              string                     `json:"url"`                        // Request URL.
	Method           string                     `json:"method"`                     // HTTP request method.
	Headers          Headers                    `json:"headers"`                    // HTTP request headers.
	PostData         *string                    `json:"postData,omitempty"`         // HTTP POST request data.
	MixedContentType *security.MixedContentType `json:"mixedContentType,omitempty"` // The mixed content type of the request.
	InitialPriority  ResourcePriority           `json:"initialPriority"`            // Priority of the resource request at the time request is sent.
	ReferrerPolicy   string                     `json:"referrerPolicy"`             // The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/
	IsLinkPreload    *bool                      `json:"isLinkPreload,omitempty"`    // Whether is loaded via link preload.
}

Request HTTP request data.

type RequestID

type RequestID string

RequestID Unique request identifier.

type RequestInterceptedClient

type RequestInterceptedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*RequestInterceptedReply, error)
	rpcc.Stream
}

RequestInterceptedClient is a client for RequestIntercepted events. Details of an intercepted HTTP request, which must be either allowed, blocked, modified or mocked.

type RequestInterceptedReply

type RequestInterceptedReply struct {
	InterceptionID     InterceptionID `json:"interceptionId"`               // Each request the page makes will have a unique id, however if any redirects are encountered while processing that fetch, they will be reported with the same id as the original fetch. Likewise if HTTP authentication is needed then the same fetch id will be used.
	Request            Request        `json:"request"`                      //
	ResourceType       ResourceType   `json:"resourceType"`                 // How the requested resource will be used.
	RedirectHeaders    Headers        `json:"redirectHeaders,omitempty"`    // HTTP response headers, only sent if a redirect was intercepted.
	RedirectStatusCode *int           `json:"redirectStatusCode,omitempty"` // HTTP response code, only sent if a redirect was intercepted.
	RedirectURL        *string        `json:"redirectUrl,omitempty"`        // Redirect location, only sent if a redirect was intercepted.
	AuthChallenge      *AuthChallenge `json:"authChallenge,omitempty"`      // Details of the Authorization Challenge encountered. If this is set then continueInterceptedRequest must contain an authChallengeResponse.
}

RequestInterceptedReply is the reply for RequestIntercepted events.

type RequestServedFromCacheClient

type RequestServedFromCacheClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*RequestServedFromCacheReply, error)
	rpcc.Stream
}

RequestServedFromCacheClient is a client for RequestServedFromCache events. Fired if request ended up loading from cache.

type RequestServedFromCacheReply

type RequestServedFromCacheReply struct {
	RequestID RequestID `json:"requestId"` // Request identifier.
}

RequestServedFromCacheReply is the reply for RequestServedFromCache events.

type RequestWillBeSentClient

type RequestWillBeSentClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*RequestWillBeSentReply, error)
	rpcc.Stream
}

RequestWillBeSentClient is a client for RequestWillBeSent events. Fired when page is about to send HTTP request.

type RequestWillBeSentReply

type RequestWillBeSentReply struct {
	RequestID        RequestID      `json:"requestId"`                  // Request identifier.
	LoaderID         LoaderID       `json:"loaderId"`                   // Loader identifier. Empty string if the request is fetched form worker.
	DocumentURL      string         `json:"documentURL"`                // URL of the document this request is loaded for.
	Request          Request        `json:"request"`                    // Request data.
	Timestamp        MonotonicTime  `json:"timestamp"`                  // Timestamp.
	WallTime         TimeSinceEpoch `json:"wallTime"`                   // Timestamp.
	Initiator        Initiator      `json:"initiator"`                  // Request initiator.
	RedirectResponse *Response      `json:"redirectResponse,omitempty"` // Redirect response data.
	Type             *ResourceType  `json:"type,omitempty"`             // Type of this resource.
	FrameID          *FrameID       `json:"frameId,omitempty"`          // Frame identifier.
}

RequestWillBeSentReply is the reply for RequestWillBeSent events.

type ResourceChangedPriorityClient

type ResourceChangedPriorityClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*ResourceChangedPriorityReply, error)
	rpcc.Stream
}

ResourceChangedPriorityClient is a client for ResourceChangedPriority events. Fired when resource loading priority is changed

type ResourceChangedPriorityReply

type ResourceChangedPriorityReply struct {
	RequestID   RequestID        `json:"requestId"`   // Request identifier.
	NewPriority ResourcePriority `json:"newPriority"` // New priority
	Timestamp   MonotonicTime    `json:"timestamp"`   // Timestamp.
}

ResourceChangedPriorityReply is the reply for ResourceChangedPriority events.

type ResourcePriority

type ResourcePriority int

ResourcePriority Loading priority of a resource request.

const (
	ResourcePriorityNotSet ResourcePriority = iota
	ResourcePriorityVeryLow
	ResourcePriorityLow
	ResourcePriorityMedium
	ResourcePriorityHigh
	ResourcePriorityVeryHigh
)

ResourcePriority as enums.

func (ResourcePriority) MarshalJSON

func (e ResourcePriority) MarshalJSON() ([]byte, error)

MarshalJSON encodes enum into a string or null when not set.

func (ResourcePriority) String

func (e ResourcePriority) String() string

func (*ResourcePriority) UnmarshalJSON

func (e *ResourcePriority) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes a string value into a enum.

func (ResourcePriority) Valid

func (e ResourcePriority) Valid() bool

Valid returns true if enum is set.

type ResourceTiming

type ResourceTiming struct {
	RequestTime       float64 `json:"requestTime"`       // Timing's requestTime is a baseline in seconds, while the other numbers are ticks in milliseconds relatively to this requestTime.
	ProxyStart        float64 `json:"proxyStart"`        // Started resolving proxy.
	ProxyEnd          float64 `json:"proxyEnd"`          // Finished resolving proxy.
	DNSStart          float64 `json:"dnsStart"`          // Started DNS address resolve.
	DNSEnd            float64 `json:"dnsEnd"`            // Finished DNS address resolve.
	ConnectStart      float64 `json:"connectStart"`      // Started connecting to the remote host.
	ConnectEnd        float64 `json:"connectEnd"`        // Connected to the remote host.
	SslStart          float64 `json:"sslStart"`          // Started SSL handshake.
	SslEnd            float64 `json:"sslEnd"`            // Finished SSL handshake.
	WorkerStart       float64 `json:"workerStart"`       // Started running ServiceWorker.
	WorkerReady       float64 `json:"workerReady"`       // Finished Starting ServiceWorker.
	SendStart         float64 `json:"sendStart"`         // Started sending request.
	SendEnd           float64 `json:"sendEnd"`           // Finished sending request.
	PushStart         float64 `json:"pushStart"`         // Time the server started pushing request.
	PushEnd           float64 `json:"pushEnd"`           // Time the server finished pushing request.
	ReceiveHeadersEnd float64 `json:"receiveHeadersEnd"` // Finished receiving response headers.
}

ResourceTiming Timing information for the request.

type ResourceType deprecated

type ResourceType = internal.PageResourceType

ResourceType is an alias for page.ResourceType to avoid a circular dependency.

Deprecated: Use page.ResourceType instead.

type Response

type Response struct {
	URL                string           `json:"url"`                          // Response URL. This URL can be different from CachedResource.url in case of redirect.
	Status             float64          `json:"status"`                       // HTTP response status code.
	StatusText         string           `json:"statusText"`                   // HTTP response status text.
	Headers            Headers          `json:"headers"`                      // HTTP response headers.
	HeadersText        *string          `json:"headersText,omitempty"`        // HTTP response headers text.
	MimeType           string           `json:"mimeType"`                     // Resource mimeType as determined by the browser.
	RequestHeaders     Headers          `json:"requestHeaders,omitempty"`     // Refined HTTP request headers that were actually transmitted over the network.
	RequestHeadersText *string          `json:"requestHeadersText,omitempty"` // HTTP request headers text.
	ConnectionReused   bool             `json:"connectionReused"`             // Specifies whether physical connection was actually reused for this request.
	ConnectionID       float64          `json:"connectionId"`                 // Physical connection id that was actually used for this request.
	RemoteIPAddress    *string          `json:"remoteIPAddress,omitempty"`    // Remote IP address.
	RemotePort         *int             `json:"remotePort,omitempty"`         // Remote port.
	FromDiskCache      *bool            `json:"fromDiskCache,omitempty"`      // Specifies that the request was served from the disk cache.
	FromServiceWorker  *bool            `json:"fromServiceWorker,omitempty"`  // Specifies that the request was served from the ServiceWorker.
	EncodedDataLength  float64          `json:"encodedDataLength"`            // Total number of bytes received for this request so far.
	Timing             *ResourceTiming  `json:"timing,omitempty"`             // Timing information for the given request.
	Protocol           *string          `json:"protocol,omitempty"`           // Protocol used to fetch this request.
	SecurityState      security.State   `json:"securityState"`                // Security state of the request resource.
	SecurityDetails    *SecurityDetails `json:"securityDetails,omitempty"`    // Security details for the request.
}

Response HTTP response data.

type ResponseReceivedClient

type ResponseReceivedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*ResponseReceivedReply, error)
	rpcc.Stream
}

ResponseReceivedClient is a client for ResponseReceived events. Fired when HTTP response is available.

type ResponseReceivedReply

type ResponseReceivedReply struct {
	RequestID RequestID     `json:"requestId"`         // Request identifier.
	LoaderID  LoaderID      `json:"loaderId"`          // Loader identifier. Empty string if the request is fetched form worker.
	Timestamp MonotonicTime `json:"timestamp"`         // Timestamp.
	Type      ResourceType  `json:"type"`              // Resource type.
	Response  Response      `json:"response"`          // Response data.
	FrameID   *FrameID      `json:"frameId,omitempty"` // Frame identifier.
}

ResponseReceivedReply is the reply for ResponseReceived events.

type SecurityDetails

type SecurityDetails struct {
	Protocol                       string                       `json:"protocol"`                       // Protocol name (e.g. "TLS 1.2" or "QUIC").
	KeyExchange                    string                       `json:"keyExchange"`                    // Key Exchange used by the connection, or the empty string if not applicable.
	KeyExchangeGroup               *string                      `json:"keyExchangeGroup,omitempty"`     // (EC)DH group used by the connection, if applicable.
	Cipher                         string                       `json:"cipher"`                         // Cipher name.
	Mac                            *string                      `json:"mac,omitempty"`                  // TLS MAC. Note that AEAD ciphers do not have separate MACs.
	CertificateID                  security.CertificateID       `json:"certificateId"`                  // Certificate ID value.
	SubjectName                    string                       `json:"subjectName"`                    // Certificate subject name.
	SanList                        []string                     `json:"sanList"`                        // Subject Alternative Name (SAN) DNS names and IP addresses.
	Issuer                         string                       `json:"issuer"`                         // Name of the issuing CA.
	ValidFrom                      TimeSinceEpoch               `json:"validFrom"`                      // Certificate valid from date.
	ValidTo                        TimeSinceEpoch               `json:"validTo"`                        // Certificate valid to (expiration) date
	SignedCertificateTimestampList []SignedCertificateTimestamp `json:"signedCertificateTimestampList"` // List of signed certificate timestamps (SCTs).
}

SecurityDetails Security details about a request.

type SetBlockedURLsArgs

type SetBlockedURLsArgs struct {
	URLs []string `json:"urls"` // URL patterns to block. Wildcards ('*') are allowed.
}

SetBlockedURLsArgs represents the arguments for SetBlockedURLs in the Network domain.

func NewSetBlockedURLsArgs

func NewSetBlockedURLsArgs(urls []string) *SetBlockedURLsArgs

NewSetBlockedURLsArgs initializes SetBlockedURLsArgs with the required arguments.

type SetBypassServiceWorkerArgs

type SetBypassServiceWorkerArgs struct {
	Bypass bool `json:"bypass"` // Bypass service worker and load from network.
}

SetBypassServiceWorkerArgs represents the arguments for SetBypassServiceWorker in the Network domain.

func NewSetBypassServiceWorkerArgs

func NewSetBypassServiceWorkerArgs(bypass bool) *SetBypassServiceWorkerArgs

NewSetBypassServiceWorkerArgs initializes SetBypassServiceWorkerArgs with the required arguments.

type SetCacheDisabledArgs

type SetCacheDisabledArgs struct {
	CacheDisabled bool `json:"cacheDisabled"` // Cache disabled state.
}

SetCacheDisabledArgs represents the arguments for SetCacheDisabled in the Network domain.

func NewSetCacheDisabledArgs

func NewSetCacheDisabledArgs(cacheDisabled bool) *SetCacheDisabledArgs

NewSetCacheDisabledArgs initializes SetCacheDisabledArgs with the required arguments.

type SetCookieArgs

type SetCookieArgs struct {
	URL            string         `json:"url"`                      // The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie.
	Name           string         `json:"name"`                     // The name of the cookie.
	Value          string         `json:"value"`                    // The value of the cookie.
	Domain         *string        `json:"domain,omitempty"`         // If omitted, the cookie becomes a host-only cookie.
	Path           *string        `json:"path,omitempty"`           // Defaults to the path portion of the url parameter.
	Secure         *bool          `json:"secure,omitempty"`         // Defaults ot false.
	HTTPOnly       *bool          `json:"httpOnly,omitempty"`       // Defaults to false.
	SameSite       CookieSameSite `json:"sameSite,omitempty"`       // Defaults to browser default behavior.
	ExpirationDate TimeSinceEpoch `json:"expirationDate,omitempty"` // If omitted, the cookie becomes a session cookie.
}

SetCookieArgs represents the arguments for SetCookie in the Network domain.

func NewSetCookieArgs

func NewSetCookieArgs(url string, name string, value string) *SetCookieArgs

NewSetCookieArgs initializes SetCookieArgs with the required arguments.

func (*SetCookieArgs) SetDomain

func (a *SetCookieArgs) SetDomain(domain string) *SetCookieArgs

SetDomain sets the Domain optional argument. If omitted, the cookie becomes a host-only cookie.

func (*SetCookieArgs) SetExpirationDate

func (a *SetCookieArgs) SetExpirationDate(expirationDate TimeSinceEpoch) *SetCookieArgs

SetExpirationDate sets the ExpirationDate optional argument. If omitted, the cookie becomes a session cookie.

func (*SetCookieArgs) SetHTTPOnly

func (a *SetCookieArgs) SetHTTPOnly(httpOnly bool) *SetCookieArgs

SetHTTPOnly sets the HTTPOnly optional argument. Defaults to false.

func (*SetCookieArgs) SetPath

func (a *SetCookieArgs) SetPath(path string) *SetCookieArgs

SetPath sets the Path optional argument. Defaults to the path portion of the url parameter.

func (*SetCookieArgs) SetSameSite

func (a *SetCookieArgs) SetSameSite(sameSite CookieSameSite) *SetCookieArgs

SetSameSite sets the SameSite optional argument. Defaults to browser default behavior.

func (*SetCookieArgs) SetSecure

func (a *SetCookieArgs) SetSecure(secure bool) *SetCookieArgs

SetSecure sets the Secure optional argument. Defaults ot false.

type SetCookieReply

type SetCookieReply struct {
	Success bool `json:"success"` // True if successfully set cookie.
}

SetCookieReply represents the return values for SetCookie in the Network domain.

type SetDataSizeLimitsForTestArgs

type SetDataSizeLimitsForTestArgs struct {
	MaxTotalSize    int `json:"maxTotalSize"`    // Maximum total buffer size.
	MaxResourceSize int `json:"maxResourceSize"` // Maximum per-resource size.
}

SetDataSizeLimitsForTestArgs represents the arguments for SetDataSizeLimitsForTest in the Network domain.

func NewSetDataSizeLimitsForTestArgs

func NewSetDataSizeLimitsForTestArgs(maxTotalSize int, maxResourceSize int) *SetDataSizeLimitsForTestArgs

NewSetDataSizeLimitsForTestArgs initializes SetDataSizeLimitsForTestArgs with the required arguments.

type SetExtraHTTPHeadersArgs

type SetExtraHTTPHeadersArgs struct {
	Headers Headers `json:"headers"` // Map with extra HTTP headers.
}

SetExtraHTTPHeadersArgs represents the arguments for SetExtraHTTPHeaders in the Network domain.

func NewSetExtraHTTPHeadersArgs

func NewSetExtraHTTPHeadersArgs(headers Headers) *SetExtraHTTPHeadersArgs

NewSetExtraHTTPHeadersArgs initializes SetExtraHTTPHeadersArgs with the required arguments.

type SetRequestInterceptionEnabledArgs

type SetRequestInterceptionEnabledArgs struct {
	Enabled bool `json:"enabled"` // Whether or not HTTP requests should be intercepted and Network.requestIntercepted events sent.
}

SetRequestInterceptionEnabledArgs represents the arguments for SetRequestInterceptionEnabled in the Network domain.

func NewSetRequestInterceptionEnabledArgs

func NewSetRequestInterceptionEnabledArgs(enabled bool) *SetRequestInterceptionEnabledArgs

NewSetRequestInterceptionEnabledArgs initializes SetRequestInterceptionEnabledArgs with the required arguments.

type SetUserAgentOverrideArgs

type SetUserAgentOverrideArgs struct {
	UserAgent string `json:"userAgent"` // User agent to use.
}

SetUserAgentOverrideArgs represents the arguments for SetUserAgentOverride in the Network domain.

func NewSetUserAgentOverrideArgs

func NewSetUserAgentOverrideArgs(userAgent string) *SetUserAgentOverrideArgs

NewSetUserAgentOverrideArgs initializes SetUserAgentOverrideArgs with the required arguments.

type SignedCertificateTimestamp

type SignedCertificateTimestamp struct {
	Status             string         `json:"status"`             // Validation status.
	Origin             string         `json:"origin"`             // Origin.
	LogDescription     string         `json:"logDescription"`     // Log name / description.
	LogID              string         `json:"logId"`              // Log ID.
	Timestamp          TimeSinceEpoch `json:"timestamp"`          // Issuance date.
	HashAlgorithm      string         `json:"hashAlgorithm"`      // Hash algorithm.
	SignatureAlgorithm string         `json:"signatureAlgorithm"` // Signature algorithm.
	SignatureData      string         `json:"signatureData"`      // Signature data.
}

SignedCertificateTimestamp Details of a signed certificate timestamp (SCT).

type TimeSinceEpoch

type TimeSinceEpoch float64

TimeSinceEpoch UTC time in seconds, counted from January 1, 1970.

func (TimeSinceEpoch) MarshalJSON

func (t TimeSinceEpoch) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. Encodes to null if t is zero.

func (TimeSinceEpoch) String

func (t TimeSinceEpoch) String() string

String calls (time.Time).String().

func (TimeSinceEpoch) Time

func (t TimeSinceEpoch) Time() time.Time

Time parses the Unix time with millisecond accuracy.

func (*TimeSinceEpoch) UnmarshalJSON

func (t *TimeSinceEpoch) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type WebSocketClosedClient

type WebSocketClosedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*WebSocketClosedReply, error)
	rpcc.Stream
}

WebSocketClosedClient is a client for WebSocketClosed events. Fired when WebSocket is closed.

type WebSocketClosedReply

type WebSocketClosedReply struct {
	RequestID RequestID     `json:"requestId"` // Request identifier.
	Timestamp MonotonicTime `json:"timestamp"` // Timestamp.
}

WebSocketClosedReply is the reply for WebSocketClosed events.

type WebSocketCreatedClient

type WebSocketCreatedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*WebSocketCreatedReply, error)
	rpcc.Stream
}

WebSocketCreatedClient is a client for WebSocketCreated events. Fired upon WebSocket creation.

type WebSocketCreatedReply

type WebSocketCreatedReply struct {
	RequestID RequestID  `json:"requestId"`           // Request identifier.
	URL       string     `json:"url"`                 // WebSocket request URL.
	Initiator *Initiator `json:"initiator,omitempty"` // Request initiator.
}

WebSocketCreatedReply is the reply for WebSocketCreated events.

type WebSocketFrame

type WebSocketFrame struct {
	Opcode      float64 `json:"opcode"`      // WebSocket frame opcode.
	Mask        bool    `json:"mask"`        // WebSocke frame mask.
	PayloadData string  `json:"payloadData"` // WebSocke frame payload data.
}

WebSocketFrame WebSocket frame data.

type WebSocketFrameErrorClient

type WebSocketFrameErrorClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*WebSocketFrameErrorReply, error)
	rpcc.Stream
}

WebSocketFrameErrorClient is a client for WebSocketFrameError events. Fired when WebSocket frame error occurs.

type WebSocketFrameErrorReply

type WebSocketFrameErrorReply struct {
	RequestID    RequestID     `json:"requestId"`    // Request identifier.
	Timestamp    MonotonicTime `json:"timestamp"`    // Timestamp.
	ErrorMessage string        `json:"errorMessage"` // WebSocket frame error message.
}

WebSocketFrameErrorReply is the reply for WebSocketFrameError events.

type WebSocketFrameReceivedClient

type WebSocketFrameReceivedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*WebSocketFrameReceivedReply, error)
	rpcc.Stream
}

WebSocketFrameReceivedClient is a client for WebSocketFrameReceived events. Fired when WebSocket frame is received.

type WebSocketFrameReceivedReply

type WebSocketFrameReceivedReply struct {
	RequestID RequestID      `json:"requestId"` // Request identifier.
	Timestamp MonotonicTime  `json:"timestamp"` // Timestamp.
	Response  WebSocketFrame `json:"response"`  // WebSocket response data.
}

WebSocketFrameReceivedReply is the reply for WebSocketFrameReceived events.

type WebSocketFrameSentClient

type WebSocketFrameSentClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*WebSocketFrameSentReply, error)
	rpcc.Stream
}

WebSocketFrameSentClient is a client for WebSocketFrameSent events. Fired when WebSocket frame is sent.

type WebSocketFrameSentReply

type WebSocketFrameSentReply struct {
	RequestID RequestID      `json:"requestId"` // Request identifier.
	Timestamp MonotonicTime  `json:"timestamp"` // Timestamp.
	Response  WebSocketFrame `json:"response"`  // WebSocket response data.
}

WebSocketFrameSentReply is the reply for WebSocketFrameSent events.

type WebSocketHandshakeResponseReceivedClient

type WebSocketHandshakeResponseReceivedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*WebSocketHandshakeResponseReceivedReply, error)
	rpcc.Stream
}

WebSocketHandshakeResponseReceivedClient is a client for WebSocketHandshakeResponseReceived events. Fired when WebSocket handshake response becomes available.

type WebSocketHandshakeResponseReceivedReply

type WebSocketHandshakeResponseReceivedReply struct {
	RequestID RequestID         `json:"requestId"` // Request identifier.
	Timestamp MonotonicTime     `json:"timestamp"` // Timestamp.
	Response  WebSocketResponse `json:"response"`  // WebSocket response data.
}

WebSocketHandshakeResponseReceivedReply is the reply for WebSocketHandshakeResponseReceived events.

type WebSocketRequest

type WebSocketRequest struct {
	Headers Headers `json:"headers"` // HTTP request headers.
}

WebSocketRequest WebSocket request data.

type WebSocketResponse

type WebSocketResponse struct {
	Status             float64 `json:"status"`                       // HTTP response status code.
	StatusText         string  `json:"statusText"`                   // HTTP response status text.
	Headers            Headers `json:"headers"`                      // HTTP response headers.
	HeadersText        *string `json:"headersText,omitempty"`        // HTTP response headers text.
	RequestHeaders     Headers `json:"requestHeaders,omitempty"`     // HTTP request headers.
	RequestHeadersText *string `json:"requestHeadersText,omitempty"` // HTTP request headers text.
}

WebSocketResponse WebSocket response data.

type WebSocketWillSendHandshakeRequestClient

type WebSocketWillSendHandshakeRequestClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*WebSocketWillSendHandshakeRequestReply, error)
	rpcc.Stream
}

WebSocketWillSendHandshakeRequestClient is a client for WebSocketWillSendHandshakeRequest events. Fired when WebSocket is about to initiate handshake.

type WebSocketWillSendHandshakeRequestReply

type WebSocketWillSendHandshakeRequestReply struct {
	RequestID RequestID        `json:"requestId"` // Request identifier.
	Timestamp MonotonicTime    `json:"timestamp"` // Timestamp.
	WallTime  TimeSinceEpoch   `json:"wallTime"`  // UTC Timestamp.
	Request   WebSocketRequest `json:"request"`   // WebSocket request data.
}

WebSocketWillSendHandshakeRequestReply is the reply for WebSocketWillSendHandshakeRequest events.

Jump to

Keyboard shortcuts

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