router

package
v0.0.0-...-b9a86dc Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2017 License: MIT Imports: 7 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Identify

type Identify interface {
	Access(c wctx.Context, ip string) (mid int64, err error)
	Verify(c wctx.Context) (err error)
}

type Router

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

Router is http router. Statsd for stat, need set value by called.

func New

func New(m *http.ServeMux) *Router

func (*Router) Degrade

func (r *Router) Degrade(p string)

Degrade add api that can degrade other api.

func (*Router) Get

func (r *Router) Get(p string, hf xweb.HandlerFunc)

Get support http method Get, no business access and verify.

func (*Router) Group

func (r *Router) Group(p string, f func(r *Router))

Group add group paths.

eg: r.Group("/x/auth", func(cr *Router){
		cr.Get("login", handlerFunc)
})

func (*Router) GuestGet

func (r *Router) GuestGet(p string, hf xweb.HandlerFunc)

GuestGet support http method Get, identify access will be called before hf, but cann't affect hf.

func (*Router) GuestPost

func (r *Router) GuestPost(p string, hf xweb.HandlerFunc)

GuestPost support http method Post, identify access will be called before hf, but cann't affect hf.

func (*Router) Post

func (r *Router) Post(p string, hf xweb.HandlerFunc)

Post support http method Post, no business access and verify.

func (*Router) UserGet

func (r *Router) UserGet(p string, hf xweb.HandlerFunc)

UserGet support http method Get, identify access will be called before hf, and hf not be called when access failed.

func (*Router) UserPost

func (r *Router) UserPost(p string, hf xweb.HandlerFunc)

UserPost support http method Post, identify access will be called before hf, and hf not be called when access failed.

func (*Router) VerifyGet

func (r *Router) VerifyGet(p string, hf xweb.HandlerFunc)

VerifyGet support http method Get, identify verify will be called before hf, and hf not be called when verify failed.

func (*Router) VerifyPost

func (r *Router) VerifyPost(p string, hf xweb.HandlerFunc)

VerifyPost support http method Post, identify verify will be called before hf, and hf not be called when verify failed.

Jump to

Keyboard shortcuts

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