events.go 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. package network
  2. // Code generated by cdproto-gen. DO NOT EDIT.
  3. import (
  4. "github.com/chromedp/cdproto/cdp"
  5. )
  6. // EventDataReceived fired when data chunk was received over the network.
  7. //
  8. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-dataReceived
  9. type EventDataReceived struct {
  10. RequestID RequestID `json:"requestId"` // Request identifier.
  11. Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
  12. DataLength int64 `json:"dataLength"` // Data chunk length.
  13. EncodedDataLength int64 `json:"encodedDataLength"` // Actual bytes received (might be less than dataLength for compressed encodings).
  14. Data string `json:"data,omitempty,omitzero"` // Data that was received.
  15. }
  16. // EventEventSourceMessageReceived fired when EventSource message is
  17. // received.
  18. //
  19. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-eventSourceMessageReceived
  20. type EventEventSourceMessageReceived struct {
  21. RequestID RequestID `json:"requestId"` // Request identifier.
  22. Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
  23. EventName string `json:"eventName"` // Message type.
  24. EventID string `json:"eventId"` // Message identifier.
  25. Data string `json:"data"` // Message content.
  26. }
  27. // EventLoadingFailed fired when HTTP request has failed to load.
  28. //
  29. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-loadingFailed
  30. type EventLoadingFailed struct {
  31. RequestID RequestID `json:"requestId"` // Request identifier.
  32. Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
  33. Type ResourceType `json:"type"` // Resource type.
  34. ErrorText string `json:"errorText"` // Error message. List of network errors: https://cs.chromium.org/chromium/src/net/base/net_error_list.h
  35. Canceled bool `json:"canceled"` // True if loading was canceled.
  36. BlockedReason BlockedReason `json:"blockedReason,omitempty,omitzero"` // The reason why loading was blocked, if any.
  37. CorsErrorStatus *CorsErrorStatus `json:"corsErrorStatus,omitempty,omitzero"` // The reason why loading was blocked by CORS, if any.
  38. }
  39. // EventLoadingFinished fired when HTTP request has finished loading.
  40. //
  41. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-loadingFinished
  42. type EventLoadingFinished struct {
  43. RequestID RequestID `json:"requestId"` // Request identifier.
  44. Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
  45. EncodedDataLength float64 `json:"encodedDataLength"` // Total number of bytes received for this request.
  46. }
  47. // EventRequestServedFromCache fired if request ended up loading from cache.
  48. //
  49. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-requestServedFromCache
  50. type EventRequestServedFromCache struct {
  51. RequestID RequestID `json:"requestId"` // Request identifier.
  52. }
  53. // EventRequestWillBeSent fired when page is about to send HTTP request.
  54. //
  55. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-requestWillBeSent
  56. type EventRequestWillBeSent struct {
  57. RequestID RequestID `json:"requestId"` // Request identifier.
  58. LoaderID cdp.LoaderID `json:"loaderId"` // Loader identifier. Empty string if the request is fetched from worker.
  59. DocumentURL string `json:"documentURL"` // URL of the document this request is loaded for.
  60. Request *Request `json:"request"` // Request data.
  61. Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
  62. WallTime *cdp.TimeSinceEpoch `json:"wallTime"` // Timestamp.
  63. Initiator *Initiator `json:"initiator"` // Request initiator.
  64. RedirectHasExtraInfo bool `json:"redirectHasExtraInfo"` // In the case that redirectResponse is populated, this flag indicates whether requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be or were emitted for the request which was just redirected.
  65. RedirectResponse *Response `json:"redirectResponse,omitempty,omitzero"` // Redirect response data.
  66. Type ResourceType `json:"type,omitempty,omitzero"` // Type of this resource.
  67. FrameID cdp.FrameID `json:"frameId,omitempty,omitzero"` // Frame identifier.
  68. HasUserGesture bool `json:"hasUserGesture"` // Whether the request is initiated by a user gesture. Defaults to false.
  69. }
  70. // EventResourceChangedPriority fired when resource loading priority is
  71. // changed.
  72. //
  73. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-resourceChangedPriority
  74. type EventResourceChangedPriority struct {
  75. RequestID RequestID `json:"requestId"` // Request identifier.
  76. NewPriority ResourcePriority `json:"newPriority"` // New priority
  77. Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
  78. }
  79. // EventSignedExchangeReceived fired when a signed exchange was received over
  80. // the network.
  81. //
  82. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-signedExchangeReceived
  83. type EventSignedExchangeReceived struct {
  84. RequestID RequestID `json:"requestId"` // Request identifier.
  85. Info *SignedExchangeInfo `json:"info"` // Information about the signed exchange response.
  86. }
  87. // EventResponseReceived fired when HTTP response is available.
  88. //
  89. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-responseReceived
  90. type EventResponseReceived struct {
  91. RequestID RequestID `json:"requestId"` // Request identifier.
  92. LoaderID cdp.LoaderID `json:"loaderId"` // Loader identifier. Empty string if the request is fetched from worker.
  93. Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
  94. Type ResourceType `json:"type"` // Resource type.
  95. Response *Response `json:"response"` // Response data.
  96. HasExtraInfo bool `json:"hasExtraInfo"` // Indicates whether requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be or were emitted for this request.
  97. FrameID cdp.FrameID `json:"frameId,omitempty,omitzero"` // Frame identifier.
  98. }
  99. // EventWebSocketClosed fired when WebSocket is closed.
  100. //
  101. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webSocketClosed
  102. type EventWebSocketClosed struct {
  103. RequestID RequestID `json:"requestId"` // Request identifier.
  104. Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
  105. }
  106. // EventWebSocketCreated fired upon WebSocket creation.
  107. //
  108. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webSocketCreated
  109. type EventWebSocketCreated struct {
  110. RequestID RequestID `json:"requestId"` // Request identifier.
  111. URL string `json:"url"` // WebSocket request URL.
  112. Initiator *Initiator `json:"initiator,omitempty,omitzero"` // Request initiator.
  113. }
  114. // EventWebSocketFrameError fired when WebSocket message error occurs.
  115. //
  116. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webSocketFrameError
  117. type EventWebSocketFrameError struct {
  118. RequestID RequestID `json:"requestId"` // Request identifier.
  119. Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
  120. ErrorMessage string `json:"errorMessage"` // WebSocket error message.
  121. }
  122. // EventWebSocketFrameReceived fired when WebSocket message is received.
  123. //
  124. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webSocketFrameReceived
  125. type EventWebSocketFrameReceived struct {
  126. RequestID RequestID `json:"requestId"` // Request identifier.
  127. Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
  128. Response *WebSocketFrame `json:"response"` // WebSocket response data.
  129. }
  130. // EventWebSocketFrameSent fired when WebSocket message is sent.
  131. //
  132. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webSocketFrameSent
  133. type EventWebSocketFrameSent struct {
  134. RequestID RequestID `json:"requestId"` // Request identifier.
  135. Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
  136. Response *WebSocketFrame `json:"response"` // WebSocket response data.
  137. }
  138. // EventWebSocketHandshakeResponseReceived fired when WebSocket handshake
  139. // response becomes available.
  140. //
  141. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webSocketHandshakeResponseReceived
  142. type EventWebSocketHandshakeResponseReceived struct {
  143. RequestID RequestID `json:"requestId"` // Request identifier.
  144. Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
  145. Response *WebSocketResponse `json:"response"` // WebSocket response data.
  146. }
  147. // EventWebSocketWillSendHandshakeRequest fired when WebSocket is about to
  148. // initiate handshake.
  149. //
  150. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webSocketWillSendHandshakeRequest
  151. type EventWebSocketWillSendHandshakeRequest struct {
  152. RequestID RequestID `json:"requestId"` // Request identifier.
  153. Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
  154. WallTime *cdp.TimeSinceEpoch `json:"wallTime"` // UTC Timestamp.
  155. Request *WebSocketRequest `json:"request"` // WebSocket request data.
  156. }
  157. // EventWebTransportCreated fired upon WebTransport creation.
  158. //
  159. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webTransportCreated
  160. type EventWebTransportCreated struct {
  161. TransportID RequestID `json:"transportId"` // WebTransport identifier.
  162. URL string `json:"url"` // WebTransport request URL.
  163. Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
  164. Initiator *Initiator `json:"initiator,omitempty,omitzero"` // Request initiator.
  165. }
  166. // EventWebTransportConnectionEstablished fired when WebTransport handshake
  167. // is finished.
  168. //
  169. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webTransportConnectionEstablished
  170. type EventWebTransportConnectionEstablished struct {
  171. TransportID RequestID `json:"transportId"` // WebTransport identifier.
  172. Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
  173. }
  174. // EventWebTransportClosed fired when WebTransport is disposed.
  175. //
  176. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-webTransportClosed
  177. type EventWebTransportClosed struct {
  178. TransportID RequestID `json:"transportId"` // WebTransport identifier.
  179. Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
  180. }
  181. // EventDirectTCPSocketCreated fired upon direct_socket.TCPSocket creation.
  182. //
  183. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-directTCPSocketCreated
  184. type EventDirectTCPSocketCreated struct {
  185. Identifier RequestID `json:"identifier"`
  186. RemoteAddr string `json:"remoteAddr"`
  187. RemotePort int64 `json:"remotePort"` // Unsigned int 16.
  188. Options *DirectTCPSocketOptions `json:"options"`
  189. Timestamp *cdp.MonotonicTime `json:"timestamp"`
  190. Initiator *Initiator `json:"initiator,omitempty,omitzero"`
  191. }
  192. // EventDirectTCPSocketOpened fired when direct_socket.TCPSocket connection
  193. // is opened.
  194. //
  195. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-directTCPSocketOpened
  196. type EventDirectTCPSocketOpened struct {
  197. Identifier RequestID `json:"identifier"`
  198. RemoteAddr string `json:"remoteAddr"`
  199. RemotePort int64 `json:"remotePort"` // Expected to be unsigned integer.
  200. Timestamp *cdp.MonotonicTime `json:"timestamp"`
  201. LocalAddr string `json:"localAddr,omitempty,omitzero"`
  202. LocalPort int64 `json:"localPort,omitempty,omitzero"` // Expected to be unsigned integer.
  203. }
  204. // EventDirectTCPSocketAborted fired when direct_socket.TCPSocket is aborted.
  205. //
  206. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-directTCPSocketAborted
  207. type EventDirectTCPSocketAborted struct {
  208. Identifier RequestID `json:"identifier"`
  209. ErrorMessage string `json:"errorMessage"`
  210. Timestamp *cdp.MonotonicTime `json:"timestamp"`
  211. }
  212. // EventDirectTCPSocketClosed fired when direct_socket.TCPSocket is closed.
  213. //
  214. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-directTCPSocketClosed
  215. type EventDirectTCPSocketClosed struct {
  216. Identifier RequestID `json:"identifier"`
  217. Timestamp *cdp.MonotonicTime `json:"timestamp"`
  218. }
  219. // EventRequestWillBeSentExtraInfo fired when additional information about a
  220. // requestWillBeSent event is available from the network stack. Not every
  221. // requestWillBeSent event will have an additional requestWillBeSentExtraInfo
  222. // fired for it, and there is no guarantee whether requestWillBeSent or
  223. // requestWillBeSentExtraInfo will be fired first for the same request.
  224. //
  225. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-requestWillBeSentExtraInfo
  226. type EventRequestWillBeSentExtraInfo struct {
  227. RequestID RequestID `json:"requestId"` // Request identifier. Used to match this information to an existing requestWillBeSent event.
  228. AssociatedCookies []*AssociatedCookie `json:"associatedCookies"` // A list of cookies potentially associated to the requested URL. This includes both cookies sent with the request and the ones not sent; the latter are distinguished by having blockedReasons field set.
  229. Headers Headers `json:"headers"` // Raw request headers as they will be sent over the wire.
  230. ConnectTiming *ConnectTiming `json:"connectTiming"` // Connection timing information for the request.
  231. ClientSecurityState *ClientSecurityState `json:"clientSecurityState,omitempty,omitzero"` // The client security state set for the request.
  232. SiteHasCookieInOtherPartition bool `json:"siteHasCookieInOtherPartition"` // Whether the site has partitioned cookies stored in a partition different than the current one.
  233. }
  234. // EventResponseReceivedExtraInfo fired when additional information about a
  235. // responseReceived event is available from the network stack. Not every
  236. // responseReceived event will have an additional responseReceivedExtraInfo for
  237. // it, and responseReceivedExtraInfo may be fired before or after
  238. // responseReceived.
  239. //
  240. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-responseReceivedExtraInfo
  241. type EventResponseReceivedExtraInfo struct {
  242. RequestID RequestID `json:"requestId"` // Request identifier. Used to match this information to another responseReceived event.
  243. BlockedCookies []*BlockedSetCookieWithReason `json:"blockedCookies"` // A list of cookies which were not stored from the response along with the corresponding reasons for blocking. The cookies here may not be valid due to syntax errors, which are represented by the invalid cookie line string instead of a proper cookie.
  244. Headers Headers `json:"headers"` // Raw response headers as they were received over the wire. Duplicate headers in the response are represented as a single key with their values concatentated using \n as the separator. See also headersText that contains verbatim text for HTTP/1.*.
  245. ResourceIPAddressSpace IPAddressSpace `json:"resourceIPAddressSpace"` // The IP address space of the resource. The address space can only be determined once the transport established the connection, so we can't send it in requestWillBeSentExtraInfo.
  246. StatusCode int64 `json:"statusCode"` // The status code of the response. This is useful in cases the request failed and no responseReceived event is triggered, which is the case for, e.g., CORS errors. This is also the correct status code for cached requests, where the status in responseReceived is a 200 and this will be 304.
  247. HeadersText string `json:"headersText,omitempty,omitzero"` // Raw response header text as it was received over the wire. The raw text may not always be available, such as in the case of HTTP/2 or QUIC.
  248. CookiePartitionKey *CookiePartitionKey `json:"cookiePartitionKey,omitempty,omitzero"` // The cookie partition key that will be used to store partitioned cookies set in this response. Only sent when partitioned cookies are enabled.
  249. CookiePartitionKeyOpaque bool `json:"cookiePartitionKeyOpaque"` // True if partitioned cookies are enabled, but the partition key is not serializable to string.
  250. ExemptedCookies []*ExemptedSetCookieWithReason `json:"exemptedCookies,omitempty,omitzero"` // A list of cookies which should have been blocked by 3PCD but are exempted and stored from the response with the corresponding reason.
  251. }
  252. // EventResponseReceivedEarlyHints fired when 103 Early Hints headers is
  253. // received in addition to the common response. Not every responseReceived event
  254. // will have an responseReceivedEarlyHints fired. Only one
  255. // responseReceivedEarlyHints may be fired for eached responseReceived event.
  256. //
  257. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-responseReceivedEarlyHints
  258. type EventResponseReceivedEarlyHints struct {
  259. RequestID RequestID `json:"requestId"` // Request identifier. Used to match this information to another responseReceived event.
  260. Headers Headers `json:"headers"` // Raw response headers as they were received over the wire. Duplicate headers in the response are represented as a single key with their values concatentated using \n as the separator. See also headersText that contains verbatim text for HTTP/1.*.
  261. }
  262. // EventTrustTokenOperationDone fired exactly once for each Trust Token
  263. // operation. Depending on the type of the operation and whether the operation
  264. // succeeded or failed, the event is fired before the corresponding request was
  265. // sent or after the response was received.
  266. //
  267. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-trustTokenOperationDone
  268. type EventTrustTokenOperationDone struct {
  269. Status TrustTokenOperationDoneStatus `json:"status"` // Detailed success or error status of the operation. 'AlreadyExists' also signifies a successful operation, as the result of the operation already exists und thus, the operation was abort preemptively (e.g. a cache hit).
  270. Type TrustTokenOperationType `json:"type"`
  271. RequestID RequestID `json:"requestId"`
  272. TopLevelOrigin string `json:"topLevelOrigin,omitempty,omitzero"` // Top level origin. The context in which the operation was attempted.
  273. IssuerOrigin string `json:"issuerOrigin,omitempty,omitzero"` // Origin of the issuer in case of a "Issuance" or "Redemption" operation.
  274. IssuedTokenCount int64 `json:"issuedTokenCount,omitempty,omitzero"` // The number of obtained Trust Tokens on a successful "Issuance" operation.
  275. }
  276. // EventPolicyUpdated fired once security policy has been updated.
  277. //
  278. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-policyUpdated
  279. type EventPolicyUpdated struct{}
  280. // EventSubresourceWebBundleMetadataReceived fired once when parsing the .wbn
  281. // file has succeeded. The event contains the information about the web bundle
  282. // contents.
  283. //
  284. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-subresourceWebBundleMetadataReceived
  285. type EventSubresourceWebBundleMetadataReceived struct {
  286. RequestID RequestID `json:"requestId"` // Request identifier. Used to match this information to another event.
  287. URLs []string `json:"urls"` // A list of URLs of resources in the subresource Web Bundle.
  288. }
  289. // EventSubresourceWebBundleMetadataError fired once when parsing the .wbn
  290. // file has failed.
  291. //
  292. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-subresourceWebBundleMetadataError
  293. type EventSubresourceWebBundleMetadataError struct {
  294. RequestID RequestID `json:"requestId"` // Request identifier. Used to match this information to another event.
  295. ErrorMessage string `json:"errorMessage"` // Error message
  296. }
  297. // EventSubresourceWebBundleInnerResponseParsed fired when handling requests
  298. // for resources within a .wbn file. Note: this will only be fired for resources
  299. // that are requested by the webpage.
  300. //
  301. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-subresourceWebBundleInnerResponseParsed
  302. type EventSubresourceWebBundleInnerResponseParsed struct {
  303. InnerRequestID RequestID `json:"innerRequestId"` // Request identifier of the subresource request
  304. InnerRequestURL string `json:"innerRequestURL"` // URL of the subresource resource.
  305. BundleRequestID RequestID `json:"bundleRequestId,omitempty,omitzero"` // Bundle request identifier. Used to match this information to another event. This made be absent in case when the instrumentation was enabled only after webbundle was parsed.
  306. }
  307. // EventSubresourceWebBundleInnerResponseError fired when request for
  308. // resources within a .wbn file failed.
  309. //
  310. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-subresourceWebBundleInnerResponseError
  311. type EventSubresourceWebBundleInnerResponseError struct {
  312. InnerRequestID RequestID `json:"innerRequestId"` // Request identifier of the subresource request
  313. InnerRequestURL string `json:"innerRequestURL"` // URL of the subresource resource.
  314. ErrorMessage string `json:"errorMessage"` // Error message
  315. BundleRequestID RequestID `json:"bundleRequestId,omitempty,omitzero"` // Bundle request identifier. Used to match this information to another event. This made be absent in case when the instrumentation was enabled only after webbundle was parsed.
  316. }
  317. // EventReportingAPIReportAdded is sent whenever a new report is added. And
  318. // after 'enableReportingApi' for all existing reports.
  319. //
  320. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-reportingApiReportAdded
  321. type EventReportingAPIReportAdded struct {
  322. Report *ReportingAPIReport `json:"report"`
  323. }
  324. // EventReportingAPIReportUpdated [no description].
  325. //
  326. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-reportingApiReportUpdated
  327. type EventReportingAPIReportUpdated struct {
  328. Report *ReportingAPIReport `json:"report"`
  329. }
  330. // EventReportingAPIEndpointsChangedForOrigin [no description].
  331. //
  332. // See: https://chromedevtools.github.io/devtools-protocol/tot/Network#event-reportingApiEndpointsChangedForOrigin
  333. type EventReportingAPIEndpointsChangedForOrigin struct {
  334. Origin string `json:"origin"` // Origin of the document(s) which configured the endpoints.
  335. Endpoints []*ReportingAPIEndpoint `json:"endpoints"`
  336. }