Documentation ¶
Overview ¶
Package tracer implements types and methods to trace http requests
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChromeRemoteDebuggerInterface ¶
type ChromeRemoteDebuggerInterface interface { EnableRequestInterception(enabled bool) error CallbackEvent(method string, cb godet.EventCallback) NewTab(url string) (*godet.Tab, error) CloseTab(tab *godet.Tab) error NetworkEvents(enable bool) error ActivateTab(tab *godet.Tab) error AllEvents(enable bool) error SetDeviceMetricsOverride(width int, height int, deviceScaleFactor float64, mobile bool, fitWindow bool) error SetVisibleSize(width, height int) error SaveScreenshot(filename string, perm os.FileMode, quality int, fromSurface bool) error SetUserAgent(userAgent string) error }
ChromeRemoteDebuggerInterface implements API to work with browser debugger
type ChromeTracer ¶
type ChromeTracer struct {
// contains filtered or unexported fields
}
ChromeTracer represent tracer based on google chrome debugging tools
func NewChromeTracer ¶
func NewChromeTracer(chrome *godet.RemoteDebugger, size *ScreenSize, screenshotsStoragePath string) *ChromeTracer
NewChromeTracer create new chrome tracer instance
func (*ChromeTracer) Screenshot ¶
func (ct *ChromeTracer) Screenshot(url *url.URL, size *ScreenSize, fileName string) error
Screenshot function makes a final page screen capture
type JSONCookie ¶
type JSONCookie struct { Name string `json:"name"` Value string `json:"value"` Path string `json:"path"` // optional Domain string `json:"domain"` // optional Expires time.Time `json:"expires"` // optional RawExpires string `json:"raw_expires"` // for reading cookies only // MaxAge=0 means no 'Max-Age' attribute specified. // MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0' // MaxA ge>0 means Max-Age attribute present and given in seconds MaxAge int `json:"max_age"` Secure bool `json:"secure"` HTTPOnly bool `json:"http_only"` Raw string `json:"raw"` Unparsed []string `json:"unparsed"` // Raw text of unparsed attribute-value pairs }
JSONCookie transform http.Cookie into json string
func NewJSONCookie ¶
func NewJSONCookie(cookie *http.Cookie) *JSONCookie
NewJSONCookie function is used to transform `http.Cookie` instance to a `JSONCookie`, which contains custom json marshal rules
func NewJSONCookies ¶
func NewJSONCookies(cookies []*http.Cookie) []*JSONCookie
NewJSONCookies convert slice of `http.Cookies` to the slice of `jsonCookies` type using NewJSONCookie function
type JSONRedirect ¶
type JSONRedirect struct { From string `json:"from"` To string `json:"to"` RequestHeaders map[string]string `json:"request_headers"` ResponseHeaders map[string]string `json:"response_headers"` Cookies []*JSONCookie `json:"cookies"` Status int `json:"status"` Initiator string `json:"initiator"` OtherInfo map[string]interface{} `json:"other_info"` ScreenshotFileName string `json:"screenshot,omitempty"` }
JSONRedirect used to transform Redirect type into json string
func NewJSONRedirect ¶
func NewJSONRedirect(r *Redirect) *JSONRedirect
NewJSONRedirect function process `Redirect` to create `jsonRedirect` instance which can be marshaled to json
func NewJSONRedirects ¶
func NewJSONRedirects(redirects []*Redirect) []*JSONRedirect
NewJSONRedirects transform slice of `Redirect`s to slice of `jsonRedirect`s using NewJSONRedirect function
type Redirect ¶
type Redirect struct { From *url.URL `json:"from"` To *url.URL `json:"to"` RequestHeaders *http.Header `json:"request_headers"` ResponseHeaders *http.Header `json:"response_headers"` Cookies []*http.Cookie `json:"cookies"` Status int `json:"status"` Initiator string `json:"initiator"` OtherInfo map[string]interface{} `json:"other_info"` ScreenshotFileName string `json:"screenshot,omitempty"` }
Redirect type represent http redirect
type ScreenSize ¶
ScreenSize type describe common screen size to capture correct size screenshot
func NewScreenSize ¶
func NewScreenSize(width, height int) *ScreenSize
NewScreenSize convert width and height value to ScreenSize type