httpserver

package
v1.5.21 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Verb    string               // Verb identifying the action ("GET", "POST", "WATCH", PROXY", etc).
	Path    string               // The path of the action
	Params  []*restful.Parameter // List of parameters associated with the action.
	Handler restful.RouteFunction
}

Action restful action struct.

func NewAction

func NewAction(verb, path string, params []*restful.Parameter, handler restful.RouteFunction) *Action

NewAction get a new action.

type HTTPServer

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

HTTPServer is data struct of http server

func NewHTTPServer

func NewHTTPServer(port uint, addr, sock string) *HTTPServer

NewHTTPServer get a new http server.

func (*HTTPServer) GetRouter

func (s *HTTPServer) GetRouter() *mux.Router

GetRouter return the router.

func (*HTTPServer) GetWebContainer

func (s *HTTPServer) GetWebContainer() *restful.Container

GetWebContainer return the web container.

func (*HTTPServer) ListenAndServe

func (s *HTTPServer) ListenAndServe() error

ListenAndServe start a http server

func (*HTTPServer) NewWebService

func (s *HTTPServer) NewWebService(rootPath string, filter restful.FilterFunction) *restful.WebService

NewWebService get a new web service.

func (*HTTPServer) RegisterActions

func (s *HTTPServer) RegisterActions(ws *restful.WebService, actions []*Action)

RegisterActions register a list of actions into web service.

func (*HTTPServer) RegisterWebServer

func (s *HTTPServer) RegisterWebServer(rootPath string, filter restful.FilterFunction, actions []*Action) error

RegisterWebServer register a new web server beyond rootPath and handle these actions.

func (*HTTPServer) SetInsecureServer

func (s *HTTPServer) SetInsecureServer(insecureAddr string, insecurePort uint)

SetInsecureServer set insecure(http) address and port into http server.

func (*HTTPServer) SetSSL

func (s *HTTPServer) SetSSL(cafile, certfile, keyfile, certPasswd string)

SetSSL set certs files into http server.

Jump to

Keyboard shortcuts

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