simplehttp

package
v0.3.1-rc.9 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Httpserver

func Httpserver(o HttpServerOption)

func MarshalJsonAndWrite

func MarshalJsonAndWrite(w http.ResponseWriter, data interface{}) error

func MarshalProtoAndWrite

func MarshalProtoAndWrite(w http.ResponseWriter, data proto.Message, opts ...func(*protojson.MarshalOptions)) error

func UnmarshalJsonFromRequest

func UnmarshalJsonFromRequest(r *http.Request, data interface{}) error

func UnmarshalProtoFromRequest

func UnmarshalProtoFromRequest(r *http.Request, data proto.Message, opts ...func(*protojson.UnmarshalOptions)) error

Types

type Handler

type Handler map[string]map[string]func(http.ResponseWriter, *http.Request) error

func (Handler) Handle

func (h Handler) Handle(method, pattern string, handler func(http.ResponseWriter, *http.Request) error)

func (Handler) ServeHTTP

func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HttpServerOption

type HttpServerOption struct {
	Mux         *http.ServeMux
	Shunt       *shunt.Shunt
	NodeServer  gn.NodeServer
	Subscribe   gn.SubscribeServer
	Tag         gn.TagServer
	Connections gs.ConnectionsServer
	Config      gc.ConfigServiceServer
}

func (*HttpServerOption) AddNode

func (*HttpServerOption) CloseConn

func (c *HttpServerOption) CloseConn(w http.ResponseWriter, r *http.Request) error

func (*HttpServerOption) ConnWebsocket

func (cc *HttpServerOption) ConnWebsocket(w http.ResponseWriter, r *http.Request) error
func (s *HttpServerOption) DeleteLink(w http.ResponseWriter, r *http.Request) error

func (*HttpServerOption) DeleteNOde

func (n *HttpServerOption) DeleteNOde(w http.ResponseWriter, r *http.Request) error

func (*HttpServerOption) DeleteTag

func (t *HttpServerOption) DeleteTag(w http.ResponseWriter, r *http.Request) error

func (*HttpServerOption) GetConfig

func (cc *HttpServerOption) GetConfig(w http.ResponseWriter, r *http.Request) error

func (*HttpServerOption) GetGroups

func (g *HttpServerOption) GetGroups(w http.ResponseWriter, r *http.Request) error

func (*HttpServerOption) GetLatency

func (l *HttpServerOption) GetLatency(w http.ResponseWriter, r *http.Request) error
func (s *HttpServerOption) GetLinkList(w http.ResponseWriter, r *http.Request) error

func (*HttpServerOption) GetNode

func (*HttpServerOption) GroupList

func (g *HttpServerOption) GroupList(w http.ResponseWriter, r *http.Request) error

func (*HttpServerOption) NodeNow

func (s *HttpServerOption) PatchLink(w http.ResponseWriter, r *http.Request) error

func (*HttpServerOption) Routers

func (o *HttpServerOption) Routers() Handler

func (*HttpServerOption) SaveConfig

func (c *HttpServerOption) SaveConfig(w http.ResponseWriter, r *http.Request) error

func (*HttpServerOption) SaveNode

func (*HttpServerOption) SaveTag

func (*HttpServerOption) TagList

Jump to

Keyboard shortcuts

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