part

package
v0.28.20240721004428 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2024 License: MIT Imports: 14 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExpried = errors.New("ErrExpried")
	ErrNoFound = errors.New("ErrNoFound")
)

Functions

func IsMethod added in v0.28.1

func IsMethod(r *http.Request, method ...string) bool

func NewLimitItem added in v0.27.16

func NewLimitItem(max int) *limitItem

func WithFlush added in v0.28.1

func WithStatusCode added in v0.27.16

func WithStatusCode(w http.ResponseWriter, code int)

Types

type Cache added in v0.27.13

type Cache struct {
	// contains filtered or unexported fields
}

func (*Cache) Cache added in v0.27.15

func (t *Cache) Cache(key string, aliveDur time.Duration, w http.ResponseWriter) http.ResponseWriter

func (*Cache) IsCache added in v0.27.13

func (t *Cache) IsCache(key string) (data *[]byte, isCache bool)

type Exprier added in v0.28.20240107072530

type Exprier struct {
	// contains filtered or unexported fields
}

func NewExprier added in v0.28.20240107072530

func NewExprier(max int) *Exprier

func (*Exprier) Check added in v0.28.20240107072530

func (t *Exprier) Check(key string) (time.Time, error)

func (*Exprier) Disable added in v0.28.20240107072530

func (t *Exprier) Disable()

func (*Exprier) Drop added in v0.28.20240107072530

func (t *Exprier) Drop(key string)

func (*Exprier) Len added in v0.28.20240107072530

func (t *Exprier) Len() int

func (*Exprier) LoopCheck added in v0.28.20240107072530

func (t *Exprier) LoopCheck(ctx context.Context, key string, whenfail func(key string, e error)) (e error)

func (*Exprier) Reg added in v0.28.20240107072530

func (t *Exprier) Reg(dur time.Duration, reNewKey ...string) (string, error)

func (*Exprier) SetMax added in v0.28.20240302090836

func (t *Exprier) SetMax(max int)

type Limits added in v0.27.16

type Limits struct {
	// contains filtered or unexported fields
}

func (*Limits) AddCount added in v0.27.16

func (t *Limits) AddCount(r *http.Request) (isOverflow bool)

func (*Limits) AddLimitItem added in v0.27.16

func (t *Limits) AddLimitItem(item *limitItem)

func (*Limits) ReachMax deprecated added in v0.27.16

func (t *Limits) ReachMax(r *http.Request) (isOverflow bool)

Deprecated: 反直觉的方法

type Web

type Web struct {
	Server *http.Server
	// contains filtered or unexported fields
}

func Easy_boot

func Easy_boot() *Web

func New

func New(conf *http.Server) (o *Web)

func (*Web) Handle

func (t *Web) Handle(path_func map[string]func(http.ResponseWriter, *http.Request))

func (*Web) Shutdown added in v0.24.2

func (t *Web) Shutdown(ctx ...context.Context)

type WebPath added in v0.22.4

type WebPath struct {
	Path string `json:"path"`

	PerSame *WebPath `json:"-"`
	Per     *WebPath `json:"-"`
	Same    *WebPath `json:"same"`
	Next    *WebPath `json:"next"`
	// contains filtered or unexported fields
}

func (*WebPath) Delete added in v0.28.20240309114649

func (t *WebPath) Delete(path string) (deleteMe bool)

func (*WebPath) GetConn added in v0.28.20240107072530

func (t *WebPath) GetConn(r *http.Request) net.Conn

WebSync

func (*WebPath) Load added in v0.22.4

func (t *WebPath) Load(path string) (func(w http.ResponseWriter, r *http.Request), bool)

O /../../1 => /../../1

X /../../1 => /../../

X /../../1 => /../

func (*WebPath) LoadOnePerfix added in v0.28.20240309172046

func (t *WebPath) LoadOnePerfix(path string) (f func(w http.ResponseWriter, r *http.Request), ok bool)

O /../../1 => /../../1

O /../../1 => /../../

X /../../1 => /../

func (*WebPath) LoadPerfix added in v0.28.20231202144738

func (t *WebPath) LoadPerfix(path string) (f func(w http.ResponseWriter, r *http.Request), ok bool)

O /../../1 => /../../1

O /../../1 => /../../

O /../../1 => /../

func (*WebPath) Reset added in v0.28.20240309114649

func (t *WebPath) Reset()

WebSync

func (*WebPath) Store added in v0.22.4

func (t *WebPath) Store(path string, f func(w http.ResponseWriter, r *http.Request))

type WebSync added in v0.22.4

type WebSync struct {
	Server *http.Server
	// contains filtered or unexported fields
}

func NewSyncMap added in v0.22.1

func NewSyncMap(conf *http.Server, m *WebPath, matchFunc ...func(path string) (func(w http.ResponseWriter, r *http.Request), bool)) (o *WebSync)

func (*WebSync) Shutdown added in v0.24.2

func (t *WebSync) Shutdown(ctx ...context.Context)

Jump to

Keyboard shortcuts

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