proxyutil

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: GPL-3.0 Imports: 10 Imported by: 6

Documentation

Overview

Package proxyutil contains different utility methods that will be helpful to gomitmproxy users

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeLatin1

func DecodeLatin1(reader io.Reader) (string, error)

DecodeLatin1 - decodes Latin1 string from the reader This method is useful for editing response bodies when you don't want to handle different encodings

func EncodeLatin1

func EncodeLatin1(str string) ([]byte, error)

EncodeLatin1 - encodes the string as a byte array using Latin1

func NewErrorResponse

func NewErrorResponse(req *http.Request, err error) *http.Response

NewErrorResponse creates a new HTTP response with status code 502 Bad Gateway "Warning" header is populated with the error details https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Warning

func NewResponse

func NewResponse(code int, body io.Reader, req *http.Request) *http.Response

NewResponse builds a new HTTP response. If body is nil, an empty byte.Buffer will be provided to be consistent with the guarantees provided by http.Transport and http.Client.

func ReadDecompressedBody

func ReadDecompressedBody(res *http.Response) ([]byte, error)

ReadDecompressedBody reads full response body and decompresses it if necessary

Types

type NoopConn added in v0.1.2

type NoopConn struct{}

NoopConn is a struct that implements net.Conn and does nothing

func (NoopConn) Close added in v0.1.2

func (NoopConn) Close() error

Close -- does nothing, returns nil

func (NoopConn) LocalAddr added in v0.1.2

func (NoopConn) LocalAddr() net.Addr

LocalAddr - always returns 0.0.0.0:0

func (NoopConn) Read added in v0.1.2

func (NoopConn) Read(b []byte) (int, error)

Read -- does nothing, returns io.EOF

func (NoopConn) RemoteAddr added in v0.1.2

func (NoopConn) RemoteAddr() net.Addr

RemoteAddr - always returns 0.0.0.0:0

func (NoopConn) SetDeadline added in v0.1.2

func (NoopConn) SetDeadline(t time.Time) error

SetDeadline - does nothing, returns nil

func (NoopConn) SetReadDeadline added in v0.1.2

func (NoopConn) SetReadDeadline(t time.Time) error

SetReadDeadline - does nothing, returns nil

func (NoopConn) SetWriteDeadline added in v0.1.2

func (NoopConn) SetWriteDeadline(t time.Time) error

SetWriteDeadline - does nothing, returns nil

func (NoopConn) Write added in v0.1.2

func (NoopConn) Write(b []byte) (int, error)

Write -- does nothing, returns len(b)

Jump to

Keyboard shortcuts

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