Documentation ¶
Index ¶
- func CopyRequestHeaders(r *http.Request, dst *http.Request)
- func CopyResponseHeaders(w http.ResponseWriter, src *http.Response)
- func CustomErrorResponse(w http.ResponseWriter, statusCode int, vars map[string]string)
- func DumpGoroutinesStackTrace(pid int)
- func ErrorResponse(w http.ResponseWriter, err error)
- func GetVars(r *http.Request) map[string]string
- func LogPanics(logger LowLevelLogger, msg string)
- func LogRequest(logger LowLevelLogger, next http.Handler) http.Handler
- func LogRequestLine(logger *zap.Logger, request *http.Request, start time.Time, ...)
- func NewCustomWriter(w http.ResponseWriter, f func(w http.ResponseWriter, status int) int) http.ResponseWriter
- func NewRouter() *router
- func RetryListen(ip string, port int) (net.Listener, error)
- func RunServers(...)
- func SetLogger(r *http.Request, l LowLevelLogger) *http.Request
- func SetVars(r *http.Request, v map[string]string) *http.Request
- func SimpleErrorResponse(w http.ResponseWriter, statusCode int, body string)
- func Split2(path string, sep string) (string, string)
- func StandardResponse(w http.ResponseWriter, statusCode int)
- func ValidateRequest(w http.ResponseWriter, r *http.Request) bool
- type ConfigLoader
- type CountingReadCloser
- type DefaultConfigLoader
- func (d DefaultConfigLoader) GetHashPrefixAndSuffix() (string, string, error)
- func (d DefaultConfigLoader) GetPolicies() (conf.PolicyList, error)
- func (d DefaultConfigLoader) GetRing(ringType, prefix, suffix string, policy int) (ring.Ring, error)
- func (d DefaultConfigLoader) GetSyncRealms() (conf.SyncRealmList, error)
- type HummingbirdServer
- type IpPort
- type KeyType
- type LowLevelLogger
- type Server
- type TestConfigLoader
- func (t *TestConfigLoader) GetHashPrefixAndSuffix() (string, string, error)
- func (t *TestConfigLoader) GetPolicies() (conf.PolicyList, error)
- func (t *TestConfigLoader) GetRing(ringType, prefix, suffix string, policy int) (ring.Ring, error)
- func (t *TestConfigLoader) GetSyncRealms() (conf.SyncRealmList, error)
- type WebWriter
- type WebWriterInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyResponseHeaders ¶
func CopyResponseHeaders(w http.ResponseWriter, src *http.Response)
func CustomErrorResponse ¶
func CustomErrorResponse(w http.ResponseWriter, statusCode int, vars map[string]string)
func DumpGoroutinesStackTrace ¶
func DumpGoroutinesStackTrace(pid int)
func ErrorResponse ¶ added in v1.6.0
func ErrorResponse(w http.ResponseWriter, err error)
func LogPanics ¶
func LogPanics(logger LowLevelLogger, msg string)
func LogRequest ¶ added in v0.0.2
func LogRequest(logger LowLevelLogger, next http.Handler) http.Handler
LogRequest is a middleware that logs requests and also sets up a logger in the request context.
func LogRequestLine ¶ added in v0.0.2
func NewCustomWriter ¶
func NewCustomWriter(w http.ResponseWriter, f func(w http.ResponseWriter, status int) int) http.ResponseWriter
NewCustomWriter creates an http.ResponseWriter wrapper that calls your function on WriteHeader.
func RunServers ¶
func SimpleErrorResponse ¶
func SimpleErrorResponse(w http.ResponseWriter, statusCode int, body string)
func Split2 ¶
Split a string in twain on sep. Doing it this way over strings.Split*() saves allocating a slice.
func StandardResponse ¶
func StandardResponse(w http.ResponseWriter, statusCode int)
func ValidateRequest ¶
func ValidateRequest(w http.ResponseWriter, r *http.Request) bool
Types ¶
type ConfigLoader ¶ added in v0.0.2
type CountingReadCloser ¶ added in v0.0.2
type CountingReadCloser struct { io.ReadCloser ByteCount int }
type DefaultConfigLoader ¶ added in v0.0.2
type DefaultConfigLoader struct{}
func (DefaultConfigLoader) GetHashPrefixAndSuffix ¶ added in v0.0.2
func (d DefaultConfigLoader) GetHashPrefixAndSuffix() (string, string, error)
func (DefaultConfigLoader) GetPolicies ¶ added in v0.0.2
func (d DefaultConfigLoader) GetPolicies() (conf.PolicyList, error)
func (DefaultConfigLoader) GetSyncRealms ¶ added in v0.0.2
func (d DefaultConfigLoader) GetSyncRealms() (conf.SyncRealmList, error)
type HummingbirdServer ¶
type LowLevelLogger ¶
type LowLevelLogger interface { Error(msg string, fields ...zapcore.Field) Info(msg string, fields ...zapcore.Field) Debug(msg string, fields ...zapcore.Field) With(fields ...zapcore.Field) *zap.Logger Sugar() *zap.SugaredLogger }
func GetLogger ¶
func GetLogger(r *http.Request) LowLevelLogger
func SetupLogger ¶
func SetupLogger(prefix string, atomicLevel *zap.AtomicLevel, flags *flag.FlagSet) (LowLevelLogger, error)
SetupLogger configures structured logging using uber's zap library.
type TestConfigLoader ¶ added in v0.0.2
type TestConfigLoader struct { DefaultConfigLoader GetHashPrefixAndSuffixFunc func() (string, string, error) GetPoliciesFunc func() (conf.PolicyList, error) GetSyncRealmsFunc func() (conf.SyncRealmList, error) GetRingFunc func(ringType, prefix, suffix string, policy int) (ring.Ring, error) }
func NewTestConfigLoader ¶ added in v0.0.2
func NewTestConfigLoader(testRing ring.Ring) *TestConfigLoader
func (*TestConfigLoader) GetHashPrefixAndSuffix ¶ added in v0.0.2
func (t *TestConfigLoader) GetHashPrefixAndSuffix() (string, string, error)
func (*TestConfigLoader) GetPolicies ¶ added in v0.0.2
func (t *TestConfigLoader) GetPolicies() (conf.PolicyList, error)
func (*TestConfigLoader) GetSyncRealms ¶ added in v0.0.2
func (t *TestConfigLoader) GetSyncRealms() (conf.SyncRealmList, error)
type WebWriter ¶
func (*WebWriter) WriteHeader ¶
type WebWriterInterface ¶
type WebWriterInterface interface { http.ResponseWriter Response() (time.Time, int) }
Click to show internal directories.
Click to hide internal directories.