httpctx

package
v1.2.9-sp2 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REQUEST_CONTEXT_KEY_IsHttps                      = "isHttps"
	REQUEST_CONTEXT_KEY_IsDropped                    = "isRequestDropped"
	RESPONSE_CONTEXT_KEY_IsDropped                   = "isResponseDropped"
	RESPONSE_CONTEXT_NOLOG                           = "isResponseNoLog"
	REQUEST_CONTEXT_KEY_AutoFoward                   = "isRequestAutoForward"
	RESPONSE_CONTEXT_KEY_AutoFoward                  = "isResponseAutoForward"
	REQUEST_CONTEXT_KEY_Url                          = "url"
	REQUEST_CONTEXT_KEY_RequestIsModified            = "requestIsModified"
	REQUEST_CONTEXT_KEY_ResponseIsModified           = "responseIsModified"
	REQUEST_CONTEXT_KEY_RequestModifiedBy            = "requestIsModifiedBy"
	REQUEST_CONTEXT_KEY_ResponseModifiedBy           = "responseIsModifiedBy"
	REQUEST_CONTEXT_KEY_RequestIsFiltered            = "requestIsFiltered"
	RESPONSE_CONTEXT_KEY_ResponseIsFiltered          = "responseIsFiltered"
	REQUEST_CONTEXT_KEY_RequestIsViewedByUser        = "requestIsHijacked"
	REQUEST_CONTEXT_KEY_ResponseIsViewedByUser       = "responseIsHijacked"
	REQUEST_CONTEXT_KEY_RequestBareBytes             = "requestBareBytes"
	REQUEST_CONTEXT_KEY_RequestHijackedBytes         = "requestHijackedBytes"
	REQUEST_CONTEXT_KEY_RequestPlainBytes            = "requestPlainBytes"
	REQUEST_CONTEXT_KEY_ResponseBareBytes            = "responseBareBytes"
	REQUEST_CONTEXT_KEY_ResponsePlainBytes           = "responsePlainBytes"
	REQUEST_CONTEXT_KEY_ResponseHijackedBytes        = "responseHijackedBytes"
	REQUEST_CONTEXT_KEY_RequestIsStrippedGzip        = "requestIsStrippedGzip"
	RESPONSE_CONTEXT_KEY_ShouldBeHijackedFromRequest = "shouldBeHijackedFromRequest"
	REQUEST_CONTEXT_KEY_ConnectedTo                  = "connectedTo"
	REQUEST_CONTEXT_KEY_ConnectedToPort              = "connectedToPort"
	REQUEST_CONTEXT_KEY_ConnectedToHost              = "connectedToHost"
	REQUEST_CONTEXT_KEY_RemoteAddr                   = "remoteAddr"
	REQUEST_CONTEXT_KEY_ViaConnect                   = "viaConnect"
	REQUEST_CONTEXT_KEY_ResponseHeaderCallback       = "responseHeaderCallback"
	REQUEST_CONTEXT_KEY_ResponseHeaderWriter         = "responseHeaderWriter"
	REQUEST_CONTEXT_KEY_ResponseMaxContentLength     = "responseMaxContentLength"
	REQUEST_CONTEXT_KEY_ResponseTooLarge             = "responseTooLarge"
	REQUEST_CONTEXT_KEY_RequestTooLarge              = "requestTooLarge"
	REQUEST_CONTEXT_KEY_ResponseHeaderParsed         = "responseHeaderParsed"
	REQUEST_CONTEXT_KEY_ResponseContentTypeFiltered  = "ResponseContentTypeFiltered"
	REQUEST_CONTEXT_KEY_MitmFrontendReadWriter       = "mitmFrontendReadWriter"
	REQUEST_CONTEXT_KEY_MitmSkipFrontendFeedback     = "mitmSkipFrontendFeedback"
	REQUEST_CONTEXT_KEY_ResponseFinishedCallback     = "responseFinishedCallback"
	REQUEST_CONTEXT_KEY_ResponseTooLargeHeaderFile   = "ResponseTooLargeHeaderFile"
	REQUEST_CONTEXT_KEY_ResponseTooLargeBodyFile     = "ResponseTooLargeBodyFile"
	REQUEST_CONTEXT_KEY_ResponseBodySize             = "ResponseBodySize"
	REQUEST_CONTEXT_KEY_MatchedRules                 = "MatchedRules"
)
View Source
const REQUEST_CONTEXT_INFOMAP = "InfoMap"

Variables

This section is empty.

Functions

func AppendMatchedRule added in v1.2.6

func AppendMatchedRule(req *http.Request, rule ...*ypb.MITMContentReplacer)

func GetBareRequestBytes added in v1.2.6

func GetBareRequestBytes(r *http.Request) []byte

func GetBareResponseBytes added in v1.2.6

func GetBareResponseBytes(r *http.Request) []byte

func GetContextAnyFromRequest added in v1.2.6

func GetContextAnyFromRequest(r *http.Request, key string) any

func GetContextBoolInfoFromRequest

func GetContextBoolInfoFromRequest(r *http.Request, key string) bool

func GetContextInfoMap

func GetContextInfoMap(r *http.Request) *sync.Map

func GetContextIntInfoFromRequest

func GetContextIntInfoFromRequest(r *http.Request, key string) int

func GetContextStringInfoFromRequest

func GetContextStringInfoFromRequest(r *http.Request, key string) string

func GetHijackedRequestBytes added in v1.2.6

func GetHijackedRequestBytes(r *http.Request) []byte

func GetHijackedResponseBytes added in v1.2.6

func GetHijackedResponseBytes(r *http.Request) []byte

func GetMITMFrontendReadWriter added in v1.2.8

func GetMITMFrontendReadWriter(r *http.Request) io.ReadWriter

GetMITMFrontendReadWriter gets the mitm frontend read writer

func GetMITMSkipFrontendFeedback added in v1.2.8

func GetMITMSkipFrontendFeedback(r *http.Request) bool

GetMITMSkipFrontendFeedback gets the mitm frontend read writer

func GetMatchedRule added in v1.2.6

func GetMatchedRule(req *http.Request) []*ypb.MITMContentReplacer

func GetPlainRequestBytes added in v1.2.6

func GetPlainRequestBytes(r *http.Request) []byte

func GetPlainResponseBytes added in v1.2.6

func GetPlainResponseBytes(r *http.Request) []byte

func GetRemoteAddr added in v1.2.6

func GetRemoteAddr(r *http.Request) string

func GetRequestBytes

func GetRequestBytes(r *http.Request) []byte

func GetRequestHTTPS

func GetRequestHTTPS(r *http.Request) bool

func GetRequestIsModified added in v1.2.6

func GetRequestIsModified(req *http.Request) bool

func GetRequestTooLarge added in v1.2.8

func GetRequestTooLarge(req *http.Request) bool

func GetRequestURL added in v1.2.6

func GetRequestURL(req *http.Request) string

func GetRequestViaCONNECT added in v1.2.7

func GetRequestViaCONNECT(req *http.Request) bool

func GetRequestViewedByUser added in v1.2.6

func GetRequestViewedByUser(req *http.Request) bool

func GetResponseBodySize added in v1.2.8

func GetResponseBodySize(req *http.Request) int64

func GetResponseContentTypeFiltered added in v1.2.8

func GetResponseContentTypeFiltered(req *http.Request) func(contentType string) bool

func GetResponseHeaderWriter added in v1.2.8

func GetResponseHeaderWriter(req *http.Request) io.Writer

func GetResponseIsModified added in v1.2.6

func GetResponseIsModified(req *http.Request) bool

func GetResponseMaxContentLength added in v1.2.8

func GetResponseMaxContentLength(req *http.Request) int

func GetResponseTooLarge added in v1.2.8

func GetResponseTooLarge(req *http.Request) bool

func GetResponseTooLargeBodyFile added in v1.2.8

func GetResponseTooLargeBodyFile(req *http.Request) string

func GetResponseTooLargeHeaderFile added in v1.2.8

func GetResponseTooLargeHeaderFile(req *http.Request) string

func GetResponseTooLargeSize added in v1.2.8

func GetResponseTooLargeSize(req *http.Request) int64

func GetResponseViewedByUser added in v1.2.6

func GetResponseViewedByUser(req *http.Request) bool

func IsFiltered added in v1.2.8

func IsFiltered(req *http.Request) bool

IsFiltered returns true if the request is filtered out filtered request/response will not be logged into database

func IsResponseFiltered added in v1.2.8

func IsResponseFiltered(req *http.Request) bool

func SetBareRequestBytes added in v1.2.6

func SetBareRequestBytes(r *http.Request, bytes []byte)

func SetBareResponseBytes added in v1.2.6

func SetBareResponseBytes(r *http.Request, bytes []byte)

func SetBareResponseBytesForce added in v1.2.9

func SetBareResponseBytesForce(r *http.Request, bytes []byte)

func SetContextValueInfoFromRequest

func SetContextValueInfoFromRequest(r *http.Request, key string, value any)

func SetHijackedRequestBytes added in v1.2.6

func SetHijackedRequestBytes(r *http.Request, bytes []byte)

func SetHijackedResponseBytes added in v1.2.6

func SetHijackedResponseBytes(r *http.Request, bytes []byte)

func SetMITMFrontendReadWriter added in v1.2.8

func SetMITMFrontendReadWriter(r *http.Request, rw io.ReadWriter)

SetMITMFrontendReadWriter sets the mitm frontend read writer

func SetMITMSkipFrontendFeedback added in v1.2.8

func SetMITMSkipFrontendFeedback(r *http.Request, b bool)

SetMITMSkipFrontendFeedback means: the frontend should skip feedback

func SetMatchedRule added in v1.2.6

func SetMatchedRule(req *http.Request, rule []*ypb.MITMContentReplacer)

func SetPlainRequestBytes added in v1.2.6

func SetPlainRequestBytes(r *http.Request, bytes []byte)

func SetPlainResponseBytes added in v1.2.6

func SetPlainResponseBytes(r *http.Request, bytes []byte)

func SetRemoteAddr added in v1.2.6

func SetRemoteAddr(r *http.Request, addr string)

func SetRequestHTTPS

func SetRequestHTTPS(r *http.Request, b bool)

func SetRequestModified added in v1.2.6

func SetRequestModified(req *http.Request, by ...string)

func SetRequestTooLarge added in v1.2.8

func SetRequestTooLarge(req *http.Request, b bool)

func SetRequestURL added in v1.2.6

func SetRequestURL(req *http.Request, urlStr string)

func SetRequestViaCONNECT added in v1.2.7

func SetRequestViaCONNECT(req *http.Request, b bool)

func SetRequestViewedByUser added in v1.2.6

func SetRequestViewedByUser(req *http.Request)

func SetResponseBodySize added in v1.2.8

func SetResponseBodySize(req *http.Request, i int64)

func SetResponseContentTypeFiltered added in v1.2.8

func SetResponseContentTypeFiltered(req *http.Request, matcher func(contentType string) bool)

func SetResponseFinishedCallback added in v1.2.8

func SetResponseFinishedCallback(req *http.Request, h ResponseFinishedCallbackType)

func SetResponseHeaderCallback added in v1.2.8

func SetResponseHeaderCallback(req *http.Request, callback ResponseHeaderCallbackType)

func SetResponseHeaderParsed added in v1.2.8

func SetResponseHeaderParsed(r *http.Request, cb ResponseHeaderParsedCallback)

func SetResponseHeaderWriter added in v1.2.8

func SetResponseHeaderWriter(req *http.Request, w io.Writer)

func SetResponseMaxContentLength added in v1.2.8

func SetResponseMaxContentLength(req *http.Request, length int)

func SetResponseModified added in v1.2.6

func SetResponseModified(req *http.Request, by ...string)

func SetResponseTooLarge added in v1.2.8

func SetResponseTooLarge(req *http.Request, b bool)

func SetResponseTooLargeBodyFile added in v1.2.8

func SetResponseTooLargeBodyFile(req *http.Request, b string)

func SetResponseTooLargeHeaderFile added in v1.2.8

func SetResponseTooLargeHeaderFile(req *http.Request, b string)

func SetResponseTooLargeSize added in v1.2.8

func SetResponseTooLargeSize(req *http.Request, size int64)

func SetResponseViewedByUser added in v1.2.6

func SetResponseViewedByUser(req *http.Request)

Types

type ResponseFinishedCallbackType added in v1.2.8

type ResponseFinishedCallbackType func()

func GetResponseFinishedCallback added in v1.2.8

func GetResponseFinishedCallback(r *http.Request) ResponseFinishedCallbackType

type ResponseHeaderCallbackType added in v1.2.8

type ResponseHeaderCallbackType func(response *http.Response, headerBytes []byte, bodyReader io.Reader) (io.Reader, error)

func GetResponseHeaderCallback added in v1.2.8

func GetResponseHeaderCallback(req *http.Request) ResponseHeaderCallbackType

type ResponseHeaderParsedCallback added in v1.2.8

type ResponseHeaderParsedCallback func(key string, value string)

ResponseHeaderParsedCallback defines how response header is parsed for handling

func GetResponseHeaderParsed added in v1.2.8

func GetResponseHeaderParsed(r *http.Request) ResponseHeaderParsedCallback

Jump to

Keyboard shortcuts

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