middleware

package
v0.0.0-...-6bbe1e0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2017 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FP_INVALID = iota
	FP_ERROR
	FP_EXPIRED
	FP_SCOPE_ACCOUNT
	FP_SCOPE_CONTAINER
)
View Source
const (
	SCOPE_INVALID = iota
	SCOPE_ACCOUNT
	SCOPE_CONTAINER
)

Variables

This section is empty.

Functions

func CleanACL

func CleanACL(name string, value string) (string, error)

Returns a cleaned ACL header value, validating that it meets the formatting requirements for standard Hummingbird ACL strings.

func NewAuthToken

func NewAuthToken(config conf.Section) (func(http.Handler) http.Handler, error)

func NewCatchError

func NewCatchError(config conf.Section) (func(http.Handler) http.Handler, error)

func NewContext

func NewContext(mc ring.MemcacheRing, log srv.LowLevelLogger, proxyDirectClient *client.ProxyDirectClient) func(http.Handler) http.Handler

func NewCopyMiddleware

func NewCopyMiddleware(config conf.Section) (func(http.Handler) http.Handler, error)

func NewFormPost

func NewFormPost(config conf.Section) (func(http.Handler) http.Handler, error)

func NewHealthcheck

func NewHealthcheck(config conf.Section) (func(http.Handler) http.Handler, error)

func NewKeystoneAuth

func NewKeystoneAuth(config conf.Section) (func(http.Handler) http.Handler, error)

func NewRatelimiter

func NewRatelimiter(config conf.Section) (func(http.Handler) http.Handler, error)

func NewRequestLogger

func NewRequestLogger(config conf.Section) (func(http.Handler) http.Handler, error)

func NewTempAuth

func NewTempAuth(config conf.Section) (func(http.Handler) http.Handler, error)

func NewTempURL

func NewTempURL(config conf.Section) (func(http.Handler) http.Handler, error)

func NewXlo

func NewXlo(config conf.Section) (func(http.Handler) http.Handler, error)

func ParseACL

func ParseACL(acl string) ([]string, []string)

Parses a standard Hummingbird ACL string into a referrers list and groups list.

func Recover

func Recover(w http.ResponseWriter, r *http.Request, msg string)

func ReferrerAllowed

func ReferrerAllowed(referrer string, referrerACL []string) bool

Returns True if the referrer should be allowed based on the referrerACL list

func RegisterInfo

func RegisterInfo(name string, data interface{})

func RemoveItemsWithPrefix

func RemoveItemsWithPrefix(header http.Header, prefix string)

Types

type AccountInfo

type AccountInfo struct {
	ContainerCount int64
	ObjectCount    int64
	ObjectBytes    int64
	Metadata       map[string]string
	SysMetadata    map[string]string
}

type AuthorizeFunc

type AuthorizeFunc func(r *http.Request) bool

type CopyWriter

type CopyWriter struct {
	http.ResponseWriter
	Logger srv.LowLevelLogger
	// contains filtered or unexported fields
}

func (*CopyWriter) WriteHeader

func (cw *CopyWriter) WriteHeader(status int)

type PipeResponseWriter

type PipeResponseWriter struct {
	Logger srv.LowLevelLogger
	// contains filtered or unexported fields
}

func NewPipeResponseWriter

func NewPipeResponseWriter(writer *io.PipeWriter, done chan bool, logger srv.LowLevelLogger) *PipeResponseWriter

func (*PipeResponseWriter) Close

func (w *PipeResponseWriter) Close()

func (*PipeResponseWriter) Header

func (w *PipeResponseWriter) Header() http.Header

func (*PipeResponseWriter) Write

func (w *PipeResponseWriter) Write(stuff []byte) (int, error)

func (*PipeResponseWriter) WriteHeader

func (w *PipeResponseWriter) WriteHeader(status int)

type ProxyContext

type ProxyContext struct {
	*ProxyContextMiddleware
	C                 client.ProxyClient
	Authorize         AuthorizeFunc
	AuthorizeOverride bool
	RemoteUser        string
	ResellerRequest   bool
	ACL               string
	Logger            srv.LowLevelLogger
	TxId              string
	// contains filtered or unexported fields
}

func GetProxyContext

func GetProxyContext(r *http.Request) *ProxyContext

func (*ProxyContext) GetAccountInfo

func (ctx *ProxyContext) GetAccountInfo(account string) *AccountInfo

func (*ProxyContext) InvalidateAccountInfo

func (ctx *ProxyContext) InvalidateAccountInfo(account string)

func (*ProxyContext) Response

func (ctx *ProxyContext) Response() (bool, int)

func (*ProxyContext) Subrequest

func (ctx *ProxyContext) Subrequest(writer http.ResponseWriter, req *http.Request, source string, skipAuth bool)

type ProxyContextMiddleware

type ProxyContextMiddleware struct {
	Cache ring.MemcacheRing
	// contains filtered or unexported fields
}

func (*ProxyContextMiddleware) ServeHTTP

func (m *ProxyContextMiddleware) ServeHTTP(writer http.ResponseWriter, request *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL