Versions in this module Expand all Collapse all v0 v0.11.0 Nov 16, 2018 Changes in this version + const DefaultHTTPPort + const DefaultHTTPSPort + const DefaultHost + const DefaultPort + const DefaultRoot + const MaxLogBodySize + const MitmCtxKey + const OriginalURLCtxKey + const RemoteUserCtxKey + const ReplacerCtxKey + const RequestIDCtxKey + const TLS_AES_128_CCM_8_SHA256 + const TLS_AES_128_CCM_SHA256 + const TLS_AES_128_GCM_SHA256 + const TLS_AES_256_GCM_SHA384 + const TLS_CHACHA20_POLY1305_SHA256 + const TLS_DHE_RSA_WITH_AES_128_CBC_SHA + const TLS_DHE_RSA_WITH_AES_256_CBC_SHA + const TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 + const TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 + const TLS_RSA_WITH_AES_256_CBC_SHA256 + const TLS_RSA_WITH_RC4_128_MD5 + var CaseSensitivePath = false + var EmptyNext = HandlerFunc(func(w http.ResponseWriter, r *http.Request) (int, error) { ... }) + var ErrMaxBytesExceeded = errors.New("http: request body too large") + var GracefulTimeout time.Duration + var HTTP2 bool + var HTTPPort = DefaultHTTPPort + var HTTPSPort = DefaultHTTPSPort + var Host = DefaultHost + var Port = DefaultPort + var QUIC bool + var Root = DefaultRoot + var TemplateFuncs = template.FuncMap + func ContextInclude(filename string, ctx interface{}, fs http.FileSystem) (string, error) + func DefaultErrorFunc(w http.ResponseWriter, r *http.Request, status int) + func IfMatcherKeyword(c *caddy.Controller) bool + func IndexFile(root http.FileSystem, fpath string, indexFiles []string) (string, bool) + func IsLogRollerSubdirective(subdir string) bool + func ParseRoller(l *LogRoller, what string, where ...string) error + func RegisterDevDirective(name, before string) + func SafePath(siteRoot, reqPath string) string + func SameNext(next1, next2 Handler) bool + func SetLastModifiedHeader(w http.ResponseWriter, modTime time.Time) + func WriteSiteNotFound(w http.ResponseWriter, r *http.Request) + func WriteTextResponse(w http.ResponseWriter, status int, body string) + type Address struct + Host string + Original string + Path string + Port string + Scheme string + func (a Address) Key() string + func (a Address) Normalize() Address + func (a Address) String() string + func (a Address) VHost() string + type ConfigSelector []HandlerConfig + func (c ConfigSelector) Select(r *http.Request) (config HandlerConfig) + type Context struct + Args []interface{} + Req *http.Request + Root http.FileSystem + URL *url.URL + func NewContextWithHeader(rh http.Header) Context + func (c Context) AddLink(link string) string + func (c Context) Cookie(name string) string + func (c Context) Env() map[string]string + func (c Context) Ext(pathStr string) string + func (c Context) Files(name string) ([]string, error) + func (c Context) Header(name string) string + func (c Context) Host() (string, error) + func (c Context) Hostname() string + func (c Context) IP() string + func (c Context) Include(filename string, args ...interface{}) (string, error) + func (c Context) IsMITM() bool + func (c Context) Join(a []string, sep string) string + func (c Context) Map(values ...interface{}) (map[string]interface{}, error) + func (c Context) Markdown(filename string) (string, error) + func (c Context) Method() string + func (c Context) Now(format string) string + func (c Context) NowDate() time.Time + func (c Context) PathMatches(pattern string) bool + func (c Context) Port() (string, error) + func (c Context) RandomString(minLen, maxLen int) string + func (c Context) Replace(input, find, replacement string) string + func (c Context) ServerIP() string + func (c Context) Slice(elems ...interface{}) []interface{} + func (c Context) Split(s string, sep string) []string + func (c Context) StripExt(path string) string + func (c Context) StripHTML(s string) string + func (c Context) ToLower(s string) string + func (c Context) ToUpper(s string) string + func (c Context) Truncate(input string, length int) string + func (c Context) URI() string + type HTTPInterfaces interface + type Handler interface + ServeHTTP func(http.ResponseWriter, *http.Request) (int, error) + type HandlerConfig interface + BasePath func() string + type HandlerFunc func(http.ResponseWriter, *http.Request) (int, error) + func (f HandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) + type IfMatcher struct + Enabled bool + func (m IfMatcher) And(r *http.Request) bool + func (m IfMatcher) Match(r *http.Request) bool + func (m IfMatcher) Or(r *http.Request) bool + type Limits struct + MaxRequestBodySizes []PathLimit + MaxRequestHeaderSize int64 + type ListenerMiddleware func(caddy.Listener) caddy.Listener + type LogRoller struct + Compress bool + Filename string + LocalTime bool + MaxAge int + MaxBackups int + MaxSize int + func DefaultLogRoller() *LogRoller + func (l LogRoller) GetLogWriter() io.Writer + type Logger struct + Exceptions []string + IPMaskExists bool + Output string + Roller *LogRoller + V4ipMask net.IPMask + V6ipMask net.IPMask + func NewTestLogger(buffer *bytes.Buffer) *Logger + func (l *Logger) Attach(controller *caddy.Controller) + func (l *Logger) Close() error + func (l *Logger) Start() error + func (l Logger) MaskIP(ip string) string + func (l Logger) Printf(format string, args ...interface{}) + func (l Logger) Println(args ...interface{}) + func (l Logger) ShouldLog(path string) bool + type Middleware func(Handler) Handler + type NonCloseNotifierError struct + Underlying interface{} + func (c NonCloseNotifierError) Error() string + type NonFlusherError struct + Underlying interface{} + func (f NonFlusherError) Error() string + type NonHijackerError struct + Underlying interface{} + func (h NonHijackerError) Error() string + type NonPusherError struct + Underlying interface{} + func (c NonPusherError) Error() string + type Path string + func (p Path) Matches(base string) bool + type PathLimit struct + Limit int64 + Path string + type PathMatcher string + func (p PathMatcher) Match(r *http.Request) bool + type Replacer interface + Replace func(string) string + Set func(key, value string) + func NewReplacer(r *http.Request, rr *ResponseRecorder, emptyValue string) Replacer + type RequestMatcher interface + Match func(r *http.Request) bool + func MergeRequestMatchers(matchers ...RequestMatcher) RequestMatcher + func SetupIfMatcher(controller *caddy.Controller) (RequestMatcher, error) + type ResponseBuffer struct + Buffer *bytes.Buffer + func NewResponseBuffer(buf *bytes.Buffer, rw http.ResponseWriter, ...) *ResponseBuffer + func (rb *ResponseBuffer) Buffered() bool + func (rb *ResponseBuffer) CopyHeader() + func (rb *ResponseBuffer) Header() http.Header + func (rb *ResponseBuffer) ReadFrom(src io.Reader) (int64, error) + func (rb *ResponseBuffer) StatusCodeWriter(w http.ResponseWriter) http.ResponseWriter + func (rb *ResponseBuffer) Write(buf []byte) (int, error) + func (rb *ResponseBuffer) WriteHeader(status int) + type ResponseRecorder struct + Replacer Replacer + func NewResponseRecorder(w http.ResponseWriter) *ResponseRecorder + func (r *ResponseRecorder) Size() int + func (r *ResponseRecorder) Status() int + func (r *ResponseRecorder) Write(buf []byte) (int, error) + func (r *ResponseRecorder) WriteHeader(status int) + type ResponseWriterWrapper struct + func (rww *ResponseWriterWrapper) CloseNotify() <-chan bool + func (rww *ResponseWriterWrapper) Flush() + func (rww *ResponseWriterWrapper) Hijack() (net.Conn, *bufio.ReadWriter, error) + func (rww *ResponseWriterWrapper) Push(target string, opts *http.PushOptions) error + type Server struct + Server *http.Server + func NewServer(addr string, group []*SiteConfig) (*Server, error) + func (s *Server) Address() string + func (s *Server) Listen() (net.Listener, error) + func (s *Server) ListenPacket() (net.PacketConn, error) + func (s *Server) OnStartupComplete() + func (s *Server) Serve(ln net.Listener) error + func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (s *Server) ServePacket(pc net.PacketConn) error + func (s *Server) Stop() error + type SiteConfig struct + Addr Address + FallbackSite bool + HiddenFiles []string + IndexPages []string + Limits Limits + ListenHost string + Root string + StrictHostMatching bool + TLS *caddytls.Config + Timeouts Timeouts + func GetConfig(c *caddy.Controller) *SiteConfig + func (s *SiteConfig) AddListenerMiddleware(l ListenerMiddleware) + func (s *SiteConfig) AddMiddleware(m Middleware) + func (s SiteConfig) Host() string + func (s SiteConfig) ListenerMiddleware() []ListenerMiddleware + func (s SiteConfig) Middleware() []Middleware + func (s SiteConfig) Port() string + func (s SiteConfig) TLSConfig() *caddytls.Config + type Timeouts struct + IdleTimeout time.Duration + IdleTimeoutSet bool + ReadHeaderTimeout time.Duration + ReadHeaderTimeoutSet bool + ReadTimeout time.Duration + ReadTimeoutSet bool + WriteTimeout time.Duration + WriteTimeoutSet bool