Skip to content

Instantly share code, notes, and snippets.

Created October 5, 2020 05:58
What would you like to do?
// InitializerFunc is a go function that should be exported by a function package.
// It should be named "New".
// Your InitializerFunc should return an instance of your Listener with a reference to judas's logger for consistent logging.
type InitializerFunc func(*log.Logger) (Listener, error)
// Listener implementations will be given a stream of HTTPExchanges to let plugins capture valuable information out of request-response transactions.
type Listener interface {
Listen(<-chan *HTTPExchange)
// HTTPExchange contains the request sent by the user to us and the response received from the target server.
// Listeners can use this struct to pull information out of requests and responses.
type HTTPExchange struct {
Request *Request
Response *Response
Target *url.URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment