Documentation
¶
Index ¶
- Constants
- func Address(addr string) func(*Server)
- func Config(val string) func(*Server)
- func HostNotConfigured(req *http.Request) (*http.Response, error)
- func IsMediaType(contentType string, val string) bool
- func NewApacheLoggingHandler(handler http.Handler, printFunc printFn) http.Handler
- func NewChangeStream(r io.ReadCloser) io.ReadCloser
- func TLSAddress(addr string) func(*Server)
- type Action
- type ActionRequestFile
- type ActionRequestRedirect
- type ActionRequestServe
- type ActionRequester
- type ActionResponseInject
- type ActionResponseReplace
- type ActionResponserer
- type ApacheLogRecord
- type ApacheLoggingHandler
- type ChangeStream
- type Cookie
- type Document
- type Host
- type Request
- type Response
- type Server
Constants ¶
View Source
const (
ApacheFormatPattern = "%s - - [%s] %s \"%s %d %d\" %f\n"
)
View Source
const TimeFormat = "Mon, 02 Jan 2006 15:04:05 GMT"
Variables ¶
This section is empty.
Functions ¶
func IsMediaType ¶
func NewApacheLoggingHandler ¶
func NewChangeStream ¶
func NewChangeStream(r io.ReadCloser) io.ReadCloser
func TLSAddress ¶
Types ¶
type Action ¶
type Action struct { Path string `toml:"path"` Method []string `toml:"method"` RemoteAddr []string `toml:"remote_addr"` Location string `toml:"location"` Action string `toml:"action"` StatusCode int `toml:"statuscode"` ContentType string `toml:"content_type"` Body string `toml:"body"` UserAgent []string `toml:"user_agent"` Scripts []string `toml:"scripts"` Regex string `toml:"regex"` Replace string `toml:"replace"` File string `toml:"file"` }
type ActionRequestFile ¶
type ActionRequestFile struct {
*Action
}
type ActionRequestRedirect ¶
type ActionRequestRedirect struct {
*Action
}
type ActionRequestServe ¶
type ActionRequestServe struct {
*Action
}
type ActionRequester ¶
type ActionResponseInject ¶
type ActionResponseInject struct {
*Action
}
func (*ActionResponseInject) OnResponse ¶
type ActionResponseReplace ¶
type ActionResponseReplace struct {
*Action
}
func (*ActionResponseReplace) OnResponse ¶
type ActionResponserer ¶
type ApacheLogRecord ¶
type ApacheLogRecord struct { http.ResponseWriter // contains filtered or unexported fields }
func (*ApacheLogRecord) Log ¶
func (r *ApacheLogRecord) Log(printFunc printFn)
func (*ApacheLogRecord) WriteHeader ¶
func (r *ApacheLogRecord) WriteHeader(status int)
type ApacheLoggingHandler ¶
type ApacheLoggingHandler struct {
// contains filtered or unexported fields
}
func (*ApacheLoggingHandler) ServeHTTP ¶
func (h *ApacheLoggingHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)
type ChangeStream ¶
type ChangeStream struct { io.ReadCloser // contains filtered or unexported fields }
func (*ChangeStream) Close ¶
func (cs *ChangeStream) Close() error
type Cookie ¶
type Cookie struct { Name string Value string Path string // optional Domain string // optional Expires time.Time // optional RawExpires string // for reading cookies only // MaxAge=0 means no 'Max-Age' attribute specified. // MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0' // MaxAge>0 means Max-Age attribute present and given in seconds MaxAge int Secure bool HttpOnly bool Raw string Unparsed []string // Raw text of unparsed attribute-value pairs }
A Cookie represents an HTTP cookie as sent in the Set-Cookie header of an HTTP response or the Cookie header of an HTTP request.
See http://tools.ietf.org/html/rfc6265 for details.
type Request ¶
type Request struct { Method string `json:"method,omitempty"` URL string `json:"url,omitempty"` Proto string `json:"proto,omitempty"` Host string `json:"host,omitempty"` Cookies map[string]string `json:"cookies,omitempty"` ContentLength int64 `json:"content_length,omitempty"` Header map[string][]string `json:"headers,omitempty"` Body string `json:"body,omitempty"` }
type Response ¶
type Response struct { StatusCode int `json:"status_code,omitempty"` ContentLength int64 `json:"content_length,omitempty"` Proto string `json:"proto,omitempty"` Header map[string][]string `json:"headers,omitempty"` Body string `json:"body,omitempty"` Hash struct { SHA256 string `json:"sha256,omitempty"` } `json:"hashes,omitempty"` }
type Server ¶
type Server struct { Cache *cache.Cache // Director must be a function which modifies // the request into a new request to be sent // using Transport. Its response is then copied // back to the original client unmodified. Director func(*http.Request) // The transport used to perform proxy requests. // If nil, http.DefaultTransport is used. http.RoundTripper // FlushInterval specifies the flush interval // to flush to the client while copying the // response body. // If zero, no periodic flushing is done. FlushInterval time.Duration // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.