Documentation ¶
Index ¶
- Constants
- func GenerateCert(dst string) error
- func HandleNotFound(templates *template.Template) httpctx.Handler
- func LogHeader(log termlog.Logger, h http.Header)
- func WatchPaths(paths, excludePatterns []string, reloader livereload.Reloader, ...) error
- func WatchRoutes(routes RouteCollection, reloader livereload.Reloader, excludePatterns []string, ...) error
- type Credentials
- type Devd
- func (dd *Devd) AddIgnores(specs []string) error
- func (dd *Devd) AddRoutes(specs []string, notfound []string) error
- func (dd *Devd) HasLivereload() bool
- func (dd *Devd) Router(logger termlog.TermLog, templates *template.Template) (http.Handler, error)
- func (dd *Devd) Serve(address string, port int, certFile string, logger termlog.TermLog, ...) error
- func (dd *Devd) WrapHandler(log termlog.TermLog, next httpctx.Handler) http.Handler
- type ResponseLogWriter
- type Route
- type RouteCollection
Constants ¶
const (
// Version is the current version of devd
Version = "0.9"
)
Variables ¶
This section is empty.
Functions ¶
func GenerateCert ¶
GenerateCert generates a self-signed certificate bundle for devd
func HandleNotFound ¶
HandleNotFound handles pages not found. In particular, this handler is used when we have no matching route for a request. This also means it's not useful to inject the livereload paraphernalia here.
func WatchPaths ¶
func WatchPaths(paths, excludePatterns []string, reloader livereload.Reloader, log termlog.Logger) error
WatchPaths watches a set of paths, and broadcasts changes through reloader.
func WatchRoutes ¶
func WatchRoutes(routes RouteCollection, reloader livereload.Reloader, excludePatterns []string, log termlog.Logger) error
WatchRoutes watches the route collection, and broadcasts changes through reloader.
Types ¶
type Credentials ¶
type Credentials struct {
// contains filtered or unexported fields
}
Credentials is a simple username/password pair
func CredentialsFromSpec ¶
func CredentialsFromSpec(spec string) (*Credentials, error)
CredentialsFromSpec creates a set of credentials from a spec
type Devd ¶
type Devd struct { Routes RouteCollection // Shaping Latency int DownKbps uint UpKbps uint ServingScheme string // Add headers AddHeaders *http.Header // Livereload and watch static routes LivereloadRoutes bool // Livereload, but don't watch static routes Livereload bool WatchPaths []string Excludes []string // Add Access-Control-Allow-Origin header Cors bool // Logging IgnoreLogs []*regexp.Regexp // Password protection Credentials *Credentials // contains filtered or unexported fields }
Devd represents the devd server options
func (*Devd) AddIgnores ¶
AddIgnores adds log ignore patterns to the server
func (*Devd) HasLivereload ¶
HasLivereload tells us if livereload is enabled
type ResponseLogWriter ¶
type ResponseLogWriter struct { Log termlog.Logger Resp http.ResponseWriter Flusher http.Flusher Timer *timer.Timer // contains filtered or unexported fields }
ResponseLogWriter is a ResponseWriter that logs
func (*ResponseLogWriter) Flush ¶
func (rl *ResponseLogWriter) Flush()
func (*ResponseLogWriter) Header ¶
func (rl *ResponseLogWriter) Header() http.Header
Header returns the header map that will be sent by WriteHeader. Changing the header after a call to WriteHeader (or Write) has no effect.
func (*ResponseLogWriter) Write ¶
func (rl *ResponseLogWriter) Write(data []byte) (int, error)
Write writes the data to the connection as part of an HTTP reply. If WriteHeader has not yet been called, Write calls WriteHeader(http.StatusOK) before writing the data. If the Header does not contain a Content-Type line, Write adds a Content-Type set to the result of passing the initial 512 bytes of written data to DetectContentType.
func (*ResponseLogWriter) WriteHeader ¶
func (rl *ResponseLogWriter) WriteHeader(code int)
WriteHeader sends an HTTP response header with status code. If WriteHeader is not called explicitly, the first call to Write will trigger an implicit WriteHeader(http.StatusOK). Thus explicit calls to WriteHeader are mainly used to send error codes.
type Route ¶
Route is a mapping from a (host, path) tuple to an endpoint.
type RouteCollection ¶
RouteCollection is a collection of routes
func (RouteCollection) Add ¶
func (f RouteCollection) Add(value string, notfound []string) error
Add a route to the collection
func (*RouteCollection) String ¶
func (f *RouteCollection) String() string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package fileserver provides a filesystem HTTP handler, based on the built-in Go FileServer.
|
Package fileserver provides a filesystem HTTP handler, based on the built-in Go FileServer. |
Package httpctx provides a context-aware HTTP handler adaptor
|
Package httpctx provides a context-aware HTTP handler adaptor |
Package inject gives the ability to copy data and inject a payload before a specified marker.
|
Package inject gives the ability to copy data and inject a payload before a specified marker. |
Package livereload allows HTML pages to be dynamically reloaded.
|
Package livereload allows HTML pages to be dynamically reloaded. |
Package reverseproxy is a reverse proxy implementation based on the built-in httuptil.Reverseproxy.
|
Package reverseproxy is a reverse proxy implementation based on the built-in httuptil.Reverseproxy. |
Package ricetemp makes templates from a ricebox.
|
Package ricetemp makes templates from a ricebox. |
Package slowdown provides an implementation of net.Listener that limits bandwidth.
|
Package slowdown provides an implementation of net.Listener that limits bandwidth. |
Package timer adds HTTP request and response timing information to a context.
|
Package timer adds HTTP request and response timing information to a context. |