Documentation ¶
Index ¶
Constants ¶
const DefaultRegister = "default"
DefaultRegister holds the name of the default register
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClipdController ¶
type ClipdController struct {
// contains filtered or unexported fields
}
ClipdController contains the handler for the "/clipd" routes
func NewClipdController ¶
func NewClipdController(l *zerolog.Logger, c *cache.Cache) *ClipdController
NewClipdController instantiates a new clipdController
func (*ClipdController) Paste ¶
func (c *ClipdController) Paste(w http.ResponseWriter, r *http.Request, p httprouter.Params)
Paste GET /clipd
func (*ClipdController) Yank ¶
func (c *ClipdController) Yank(w http.ResponseWriter, r *http.Request, p httprouter.Params)
Yank POST /clipd
type ClipdServer ¶
ClipdServer holds the clipd server
func NewClipdServer ¶
func NewClipdServer(config *Config) *ClipdServer
NewClipdServer creates a new Server from Config, and initializes the global logger
func (*ClipdServer) CleanAfterShutdown ¶
func (c *ClipdServer) CleanAfterShutdown()
CleanAfterShutdown can be called after http.Server.Shutdown
func (*ClipdServer) ListenAndServe ¶
func (c *ClipdServer) ListenAndServe() error
ListenAndServe starts the clipd server on the configured address
type LogEntry ¶
type LogEntry struct { Method string `json:"method"` Path string `json:"path"` StartTime time.Time `json:"receivedTime"` Latency int64 `json:"latencyMs"` Status int `json:"statusCode"` }
LogEntry holds the information written to the logger
type RequestLogger ¶
RequestLogger is a middleware that logs incoming requests.
func (RequestLogger) ServeHTTP ¶
func (rl RequestLogger) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ResponseStats ¶
type ResponseStats struct {
// contains filtered or unexported fields
}
ResponseStats is a wrapper around http.ResponseWriter to hold information for logging
func (*ResponseStats) Header ¶
func (r *ResponseStats) Header() http.Header
Header implements http.ResponseWriter.Header
func (*ResponseStats) Write ¶
func (r *ResponseStats) Write(b []byte) (int, error)
Write implements http.ResponseWriter.Write
func (*ResponseStats) WriteHeader ¶
func (r *ResponseStats) WriteHeader(statusCode int)
WriteHeader implements http.ResponseWriter.WriteHeader