Documentation
¶
Index ¶
Constants ¶
View Source
const (
APP_NAME = "jsonrpc"
)
Variables ¶
This section is empty.
Functions ¶
func RootRouter ¶
func RootRouter() *restful.Container
Types ¶
type JsonRpc ¶
type JsonRpc struct {
ioc.ObjectImpl
// 是否开启HTTP Server, 默认会根据是否有注册得有API对象来自动开启
Enable *bool `json:"enable" yaml:"enable" toml:"enable" env:"ENABLE"`
// HTTP服务Host
Host string `json:"host" yaml:"host" toml:"host" env:"HOST"`
// HTTP服务端口
Port int `json:"port" yaml:"port" toml:"port" env:"PORT"`
// API接口前缀
PathPrefix string `json:"path_prefix" yaml:"path_prefix" toml:"path_prefix" env:"PATH_PREFIX"`
// 开启Trace
Trace bool `toml:"trace" json:"trace" yaml:"trace" env:"TRACE"`
// 访问日志
AccessLog bool `toml:"access_log" json:"access_log" yaml:"access_log" env:"ACCESS_LOG"`
EnableSSL bool `json:"enable_ssl" yaml:"enable_ssl" toml:"enable_ssl" env:"ENABLE_SSL"`
CertFile string `json:"cert_file" yaml:"cert_file" toml:"cert_file" env:"CERT_FILE"`
KeyFile string `json:"key_file" yaml:"key_file" toml:"key_file" env:"KEY_FILE"`
Container *restful.Container
// contains filtered or unexported fields
}
func (*JsonRpc) HTTPPrefix ¶
type RPCReadWriteCloser ¶
type RPCReadWriteCloser struct {
io.Writer
io.ReadCloser
}
func NewRPCReadWriteCloserFromHTTP ¶
func NewRPCReadWriteCloserFromHTTP(w http.ResponseWriter, r *http.Request) *RPCReadWriteCloser
type Request ¶
type Request[T any] struct { Method string `json:"method"` Params [1]T `json:"params"` Id uint64 `json:"id"` }
func NewRequest ¶
Click to show internal directories.
Click to hide internal directories.