package
0.0.0-20220418144517-db1de1c3ed5d
Repository: https://github.com/232425wxy/bft.git
Documentation: pkg.go.dev
# Functions
DefaultConfig returns a default configuration.
Listen starts a new net.Listener on the given address.
NewRPCFunc 封装了一个用于内省的函数。f 是函数,args 是用逗号分隔的参数名.
NewWebsocketManager 传入的参数 funcMap 实际上就是 /rpc/core/types.Routes.
NewWSRPCFunc 封装了一个用于内省的函数,并在websockets中使用。.
OnDisconnect sets a callback which is used upon disconnect - not Goroutine-safe.
ReadLimit sets the maximum size for reading message.
RecoverAndLogHandler wraps an HTTP handler, adding error logging.
RegisterRPCFuncs 为 funcMap 中的每个函数添加了一个路由,并为所有函数添加了通用的 jsonrpc 和 websocket 处理程序 “result” 是注册结果对象的接口,并且用每个 RPCResponse 填充.
Serve creates a http.Server and calls Serve with the given listener.
Serve creates a http.Server and calls ServeTLS with the given listener, certFile and keyFile.
WriteRPCResponseHTTP 将 res 序列化为 JSON (带缩进),并将其写入 w.
WriteRPCResponseHTTPError 将 res 封送为 JSON (带缩进)并写入 w, 只有在 res 中的 Error 字段不为 nil 的时候才会调用此方法.
# Structs
Config is a RPC server configuration.
RPCFunc 包含一个函数的内省类型信息.
WebsocketManager 为传入的连接提供了一个 WS 处理程序,并将函数映射和任何附加参数传递给新连接, 注意:websocket 路径在外部定义,例如在 node/node.go 中.