mchan

package
v0.0.0-...-a9387a1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeReply

func DecodeReply(key, data []byte, obj interface{}) error

func Encode

func Encode(key []byte, r *ReplyInfo) []byte

func Reply

func Reply(key []byte, obj interface{}) []byte

func ReplyError

func ReplyError(key []byte, err error) []byte

func Send

func Send(key []byte, path string, obj interface{}) []byte

Types

type HandlerFunc

type HandlerFunc func(*Req) interface{}

type ReplyInfo

type ReplyInfo struct {
	Token   string          `json:"token"`
	Code    int             `json:"code,omitempty"`
	Path    string          `json:"path,omitempty"`
	Payload json.RawMessage `json:"payload"`
}

func Decode

func Decode(key, data []byte) (*ReplyInfo, error)

type Req

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

func (*Req) Unmarshal

func (r *Req) Unmarshal(obj interface{}) error

type Server

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

func NewServer

func NewServer(f *flow.Flow, listen string, ct *clock.Clock, key []byte, cfg *SvrConf) *Server

func (*Server) DecodeRequest

func (s *Server) DecodeRequest(w http.ResponseWriter, body []byte) error

func (*Server) HandleFunc

func (s *Server) HandleFunc(path string, f HandlerFunc)

func (*Server) Run

func (s *Server) Run() error

func (*Server) ServeHTTP

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

type SvrConf

type SvrConf struct {
	CertFile string
	KeyFile  string
}

Jump to

Keyboard shortcuts

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