Documentation ¶
Index ¶
- Constants
- func NewServer(conf config.IConfig, agentFunc network.AgentCreateFunc, ...) network.IServer
- func Request(url string, method string, requestType int, header interface{}, ...) error
- func TextParamsValue(param map[string]interface{}) []byte
- type ClientConfig
- type ConnSet
- type Server
- type ServerConfig
Constants ¶
View Source
const ( // POST method POST = "POST" // GET method GET = "GET" //DELETE method DELETE = "DELETE" //RequestTypeText text format RequestTypeText = 0x01 //RequestTypeJSON json format RequestTypeJSON = 0x02 //RequestTypePB protobuf3 byte buffer format RequestTypePB = 0x03 //RequestTypeByte byte buffer format RequestTypeByte = 0x04 //ContentTypeText request type text ContentTypeText = "application/x-www-form-urlencoded" //ContentTypeJSON request type json ContentTypeJSON = "application/json;charset=UTF-8" //ContentTypeByte request type buffer ContentTypeByte = "application/octet-stream" // "application/x-protobuf" // //ResponseTypeText response type text ResponseTypeText = 0x01 //ResponseTypeJSON response type json ResponseTypeJSON = 0x02 //ResponseTypeXML response type xml ResponseTypeXML = 0x03 //ResponseTypePB response protobuf3 type buffer ResponseTypePB = 0x04 //ResponseTypeByte response type buffer ResponseTypeByte = 0x05 //ConnTimeoutMS conn timeout ConnTimeoutMS = 5000 //ServeTimeoutMS request timeout ServeTimeoutMS = 10000 )
eHTTPRequestType
Variables ¶
This section is empty.
Functions ¶
func NewServer ¶
func NewServer(conf config.IConfig, agentFunc network.AgentCreateFunc, agentCloseFunc network.AgentCloseFunc) network.IServer
NewServer create http server
func Request ¶
func Request(url string, method string, requestType int, header interface{}, data interface{}, responseType int, results interface{}, connTimeoutMs int, serveTimeoutMs int) error
Request do http request with data
func TextParamsValue ¶
TextParamsValue get params formats
Types ¶
type ClientConfig ¶
type ClientConfig struct { Nodes []common.NodeInfo `mapstructure:"nodes"` Timeout time.Duration `mapstructure:"timeout"` QueueSize int `mapstructure:"queue_size"` }
ClientConfig http client config
func (*ClientConfig) GetQueueSize ¶
func (c *ClientConfig) GetQueueSize() int
GetQueueSize get module queue size
type Server ¶
type Server struct { Conf *ServerConfig NewAgent network.AgentCreateFunc CloseAgent network.AgentCloseFunc // contains filtered or unexported fields }
Server websocket server define
type ServerConfig ¶
type ServerConfig struct { Address string `mapstructure:"address"` QueueSize int `mapstructure:"queue_size"` }
ServerConfig http server config
func (*ServerConfig) GetQueueSize ¶
func (s *ServerConfig) GetQueueSize() int
GetQueueSize get module queue size
Click to show internal directories.
Click to hide internal directories.