package martianhttp

import "github.com/google/martian/v3/martianhttp"

Package martianhttp provides HTTP handlers for managing the state of a martian.Proxy.

Index

Functions

func NewAuthorityHandler

func NewAuthorityHandler(ca *x509.Certificate) http.Handler

NewAuthorityHandler returns an http.Handler that will present the client with the CA certificate to use in browser.

Types

type Modifier

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

Modifier is a locking modifier that is configured via http.Handler.

func NewModifier

func NewModifier() *Modifier

NewModifier returns a new martianhttp.Modifier.

func (*Modifier) ModifyRequest

func (m *Modifier) ModifyRequest(req *http.Request) error

ModifyRequest runs reqmod.

func (*Modifier) ModifyResponse

func (m *Modifier) ModifyResponse(res *http.Response) error

ModifyResponse runs resmod.

func (*Modifier) ResetRequestVerifications

func (m *Modifier) ResetRequestVerifications()

ResetRequestVerifications resets verifications on reqmod, iff reqmod is a RequestVerifier.

func (*Modifier) ResetResponseVerifications

func (m *Modifier) ResetResponseVerifications()

ResetResponseVerifications resets verifications on resmod, iff resmod is a ResponseVerifier.

func (*Modifier) ServeHTTP

func (m *Modifier) ServeHTTP(rw http.ResponseWriter, req *http.Request)

ServeHTTP sets or retrieves the JSON-encoded modifier configuration depending on request method. POST requests are expected to provide a JSON modifier message in the body which will be used to update the contained request and response modifiers. GET requests will return the JSON (pretty-printed) for the most recent configuration.

func (*Modifier) SetRequestModifier

func (m *Modifier) SetRequestModifier(reqmod martian.RequestModifier)

SetRequestModifier sets the request modifier.

func (*Modifier) SetResponseModifier

func (m *Modifier) SetResponseModifier(resmod martian.ResponseModifier)

SetResponseModifier sets the response modifier.

func (*Modifier) VerifyRequests

func (m *Modifier) VerifyRequests() error

VerifyRequests verifies reqmod, iff reqmod is a RequestVerifier.

func (*Modifier) VerifyResponses

func (m *Modifier) VerifyResponses() error

VerifyResponses verifies resmod, iff resmod is a ResponseVerifier.

Source Files

authority_handler.go martianhttp.go

Version
v3.0.0
Published
Jul 9, 2019
Platform
windows/amd64
Imports
11 packages
Last checked
4 hours ago

Tools for package owners.