server

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2022 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type After

type After func(stream *http.Stream) error

type Before

type Before func(stream *http.Stream) error

type Middle

type Middle func(*http2.Stream)

type RouteHandler

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

func (*RouteHandler) Delete

func (rh *RouteHandler) Delete(path ...string) *route

func (*RouteHandler) Get

func (rh *RouteHandler) Get(path ...string) *route

func (*RouteHandler) Option

func (rh *RouteHandler) Option(path ...string) *route

func (*RouteHandler) Patch

func (rh *RouteHandler) Patch(path ...string) *route

func (*RouteHandler) Post

func (rh *RouteHandler) Post(path ...string) *route

func (*RouteHandler) Put

func (rh *RouteHandler) Put(path ...string) *route

func (*RouteHandler) Remove

func (rh *RouteHandler) Remove(path ...string)

func (*RouteHandler) Route

func (rh *RouteHandler) Route(method string, path ...string) *route

type Router

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

func (*Router) GetAllRouters

func (r *Router) GetAllRouters() []*node

func (*Router) Group

func (r *Router) Group(path ...string) *group

func (*Router) Remove

func (r *Router) Remove(path ...string)

func (*Router) Route

func (r *Router) Route(method string, path ...string) *route

func (*Router) SetDefaultIndex

func (r *Router) SetDefaultIndex(index ...string)

func (*Router) SetGlobalAfter

func (r *Router) SetGlobalAfter(after ...After)

func (*Router) SetGlobalBefore

func (r *Router) SetGlobalBefore(before ...Before)

func (*Router) SetOpenDir

func (r *Router) SetOpenDir(dirIndex ...int)

func (*Router) SetStaticDirMiddle

func (r *Router) SetStaticDirMiddle(t ...string) *StaticDirMiddle

func (*Router) SetStaticDownload

func (r *Router) SetStaticDownload(flag bool)

func (*Router) SetStaticFileMiddle

func (r *Router) SetStaticFileMiddle(t ...string) *StaticFileMiddle

func (*Router) SetStaticGlobalDirMiddle

func (r *Router) SetStaticGlobalDirMiddle(fn func(w http2.ResponseWriter, r *http2.Request, f http2.File, i fs.FileInfo) error)

func (*Router) SetStaticGlobalFileMiddle

func (r *Router) SetStaticGlobalFileMiddle(fn func(w http2.ResponseWriter, r *http2.Request, f http2.File, i fs.FileInfo) error)

func (*Router) SetStaticPath

func (r *Router) SetStaticPath(prefixPath string, fixPath string, fileSystem http2.FileSystem) int

type Server

type Server struct {
	Name string
	// Host 服务Host
	Addr string
	// TLS FILE
	CertFile string
	// TLS KEY
	KeyFile string

	OnOpen    func(stream *http2.Stream)
	OnMessage func(stream *http2.Stream)
	OnClose   func(stream *http2.Stream)
	OnError   func(stream *http2.Stream, err error)
	OnSuccess func()

	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	// contains filtered or unexported fields
}

func (*Server) GetRouter

func (s *Server) GetRouter() *Router

func (*Server) LocalAddr

func (s *Server) LocalAddr() net.Addr

func (*Server) Ready

func (s *Server) Ready()

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) SetRouter

func (s *Server) SetRouter(router *Router) *Server

func (*Server) Shutdown

func (s *Server) Shutdown() error

func (*Server) Start

func (s *Server) Start()

Start Http

func (*Server) Use

func (s *Server) Use(middle ...func(next Middle) Middle)

type Static

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

type StaticDirMiddle

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

func (*StaticDirMiddle) Handler

func (s *StaticDirMiddle) Handler(fn func(w http2.ResponseWriter, r *http2.Request, f http2.File, i fs.FileInfo) error)

type StaticFileMiddle

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

func (*StaticFileMiddle) Handler

func (s *StaticFileMiddle) Handler(fn func(w http2.ResponseWriter, r *http2.Request, f http2.File, i fs.FileInfo) error)

Jump to

Keyboard shortcuts

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