output

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package output is responsible for writing logs and received response data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Output

type Output struct {
	// contains filtered or unexported fields
}

Output is responsible for all the output, be it logging or writing received data.

func NewOutput

func NewOutput(path string, verbose bool) (o *Output, err error)

NewOutput creates a new instance of Output. path is an optional path to the file where the tool will write the received data. If not specified, this information will be written to stdout. verbose defines whether we need to write extended information.

func (*Output) Debug

func (o *Output) Debug(format string, args ...any)

Debug writes DEBUG-level log to stderr (controlled by the verbose flag).

func (*Output) DebugRequest

func (o *Output) DebugRequest(req *http.Request)

DebugRequest writes information about the HTTP request to the output.

func (*Output) DebugResponse

func (o *Output) DebugResponse(resp *http.Response)

DebugResponse writes information about the HTTP response to the output.

func (*Output) Info

func (o *Output) Info(format string, args ...any)

Info writes INFO-level log to stderr.

func (*Output) Write

func (o *Output) Write(resp *http.Response, cfg *config.Config)

Write writes received data to the output path (or stdout if not specified).

type ResponseData

type ResponseData struct {
	StatusCode int                 `json:"status_code"`
	Status     string              `json:"status"`
	Proto      string              `json:"proto"`
	TLS        *TLSState           `json:"tls"`
	Headers    map[string][]string `json:"headers"`
	Body       string              `json:"body"`
}

ResponseData is a helper object for serializing response data to JSON.

type TLSState

type TLSState struct {
	Version     uint16 `json:"version"`
	CipherSuite uint16 `json:"cipher_suite"`
}

TLSState is a helper object for serializing response data to JSON.

Jump to

Keyboard shortcuts

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