server

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugPprofCmdlineHandler

func DebugPprofCmdlineHandler(w http.ResponseWriter, r *http.Request)

func DebugPprofHandler

func DebugPprofHandler(w http.ResponseWriter, r *http.Request)

func DebugPprofProfileHandler

func DebugPprofProfileHandler(w http.ResponseWriter, r *http.Request)

func DebugPprofSymbolHandler

func DebugPprofSymbolHandler(w http.ResponseWriter, r *http.Request)

func DebugPprofTraceHandler

func DebugPprofTraceHandler(w http.ResponseWriter, r *http.Request)

func Error

func Error(w http.ResponseWriter, error string, code int)

Error replies to the request with the specified error message and HTTP code. It does not otherwise end the request; the caller should ensure no further writes are done to w. The error message should be plain text.

func NotFound

func NotFound(w http.ResponseWriter, r *http.Request)

NotFound replies to the request with an HTTP 404 not found error.

Types

type ResponseWriter

type ResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

func NewResponseWriter

func NewResponseWriter(w http.ResponseWriter, writer io.Writer) *ResponseWriter

func (*ResponseWriter) Write

func (w *ResponseWriter) Write(b []byte) (int, error)

type Server

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

Server is a http server

func NewServer

func NewServer() *Server

NewServer creates the server with given configuration.

func (*Server) Close

func (s *Server) Close()

Close closes the server.

func (*Server) Handle

func (s *Server) Handle(name string, handler ServiceHttpHandler)

func (*Server) Init

func (s *Server) Init(name string, config *ServerConfig)

func (*Server) Name

func (s *Server) Name() string

func (*Server) Run

func (s *Server) Run()

Run runs the server.

func (*Server) ServeHTTP

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

type ServerConfig

type ServerConfig struct {
	Ip   string
	Port string
	// replace ip + port
	Sock      string
	Version   string
	ConnLimit int
}

type ServiceHttpHandler

type ServiceHttpHandler func(http.ResponseWriter, *http.Request)

func NotFoundHandler

func NotFoundHandler() ServiceHttpHandler

NotFoundHandler returns a simple request handler that replies to each request with a “404 page not found” reply.

type Stats

type Stats struct {
	Rangeid            uint64
	Calls              uint64
	Microseconds       uint64
	InputBytes         uint64
	InputMicroseconds  uint64
	OutputBytes        uint64
	OutputMicroseconds uint64
}

Jump to

Keyboard shortcuts

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