Documentation
¶
Index ¶
- type Entries
- type Entry
- type Logger
- func (l *Logger) AddEntry(e Entry)
- func (l *Logger) GetEntries() map[string]*Entry
- func (l *Logger) GetEntry(id string) *Entry
- func (l *Logger) ModifyRequest(req *http.Request) error
- func (l *Logger) ModifyResponse(res *http.Response) error
- func (l *Logger) RecordRequest(id string, req *http.Request) error
- func (l *Logger) RecordResponse(id string, res *http.Response) error
- func (l *Logger) Reset()
- type Notification
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
// ID is the unique ID for the entry.
ID string `json:"_id"`
// StartedDateTime is the date and time stamp of the request start (ISO 8601).
StartedDateTime time.Time `json:"startedDateTime"`
// Time is the total elapsed time of the request in milliseconds.
Time int64 `json:"time"`
// Request contains the detailed information about the request.
Request *Request `json:"request"`
// Response contains the detailed information about the response.
Response *Response `json:"response,omitempty"`
}
Entry is a individual log entry for a request or response.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger maintains request and response log entries.
func NewLogger ¶
func NewLogger(app *tview.Application, proxychan chan Notification, sitemapchan chan Notification) *Logger
NewLogger returns a HAR logger. The returned logger logs all request post data and response bodies by default.
func (*Logger) GetEntries ¶
GetEntries - return the Entries map
func (*Logger) ModifyRequest ¶
ModifyRequest logs requests.
func (*Logger) ModifyResponse ¶
ModifyResponse logs responses.
func (*Logger) RecordRequest ¶
RecordRequest logs the HTTP request with the given ID. The ID should be unique per request/response pair.
func (*Logger) RecordResponse ¶
RecordResponse logs an HTTP response, associating it with the previously-logged HTTP request with the same ID.
type Notification ¶
Notification channel struct. Holds the element ID and an int for request or response
type Request ¶
type Request struct {
// Method is the request method (GET, POST, ...).
Method string `json:"method"`
// URL is the absolute URL of the request (fragments are not included).
URL string `json:"url"`
// HTTPVersion is the Request HTTP version (HTTP/1.1).
HTTPVersion string `json:"httpVersion"`
// BodySize is the size of the request body (POST data payload) in bytes. Set
// to -1 if the info is not available.
BodySize int64 `json:"bodySize"`
Raw []byte // the raw body
Host string
TLS bool
}
Request holds data about an individual HTTP request.
type Response ¶
type Response struct {
// Status is the response status code.
Status int `json:"status"`
// StatusText is the response status description.
StatusText string `json:"statusText"`
// HTTPVersion is the Response HTTP version (HTTP/1.1).
HTTPVersion string `json:"httpVersion"`
// RedirectURL is the target URL from the Location response header.
RedirectURL string `json:"redirectURL"`
// Headers stores the response headers
Headers http.Header `json:"headers"`
// BodySize is the size of the request body (POST data payload) in bytes. Set
// to -1 if the info is not available.
BodySize int64 `json:"bodySize"`
Raw []byte // the raw body
}
Response holds data about an individual HTTP response.