Documentation ¶
Index ¶
- Variables
- func ComputeHmacMd5(strMessage, strSecret string) string
- func ComputeHmacSha1(strMessage string, strSecret string) string
- func HexEncodeToString(input []byte) string
- func HttpGetRequest(strUrl string, mapParams map[string]string) (string, error)
- func HttpPostRequest(strUrl string, mapParams, headerParams map[string]string) (string, error)
- func MD5(input []byte) []byte
- func Map2UrlQuery(mapParams map[string]string) string
- func MapSortByKey(mapValue map[string]string) map[string]string
- func MapValueEncodeURI(mapValue map[string]string) map[string]string
- type SafeWebSocket
- type SafeWebSocketAliveHandler
- type SafeWebSocketMessageListener
Constants ¶
This section is empty.
Variables ¶
View Source
var SafeWebSocketDestroyError = fmt.Errorf("connection destroy by user")
Functions ¶
func ComputeHmacMd5 ¶
func ComputeHmacSha1 ¶
HMAC SHA1加密 strMessage: 需要加密的信息 strSecret: 密钥 return: BASE64编码的密文
func HexEncodeToString ¶
func HttpGetRequest ¶
Http Get请求基础函数, 通过封装Go语言Http请求, 支持火币网REST API的HTTP Get请求 strUrl: 请求的URL strParams: string类型的请求参数, user=lxz&pwd=lxz return: 请求结果
func HttpPostRequest ¶
Http POST请求基础函数, 通过封装Go语言Http请求, 支持火币网REST API的HTTP POST请求 strUrl: 请求的URL mapParams: map类型的请求参数 return: 请求结果
func Map2UrlQuery ¶
Map2UrlQuery : 将map格式的请求参数转换为字符串格式的 mapParams: map格式的参数键值对 return: 查询字符串
func MapSortByKey ¶
对Map按着ASCII码进行排序 mapValue: 需要进行排序的map return: 排序后的map
Types ¶
type SafeWebSocket ¶
type SafeWebSocket struct {
// contains filtered or unexported fields
}
SafeWebSocket 安全的WebSocket封装 保证读取和发送操作是并发安全的,支持自定义保持alive函数
func NewSafeWebSocket ¶
func NewSafeWebSocket(endpoint string) (*SafeWebSocket, error)
NewSafeWebSocket 创建安全的WebSocket实例并连接
func (*SafeWebSocket) KeepAlive ¶
func (s *SafeWebSocket) KeepAlive(v time.Duration, h SafeWebSocketAliveHandler)
KeepAlive 设置alive周期及函数
func (*SafeWebSocket) Listen ¶
func (s *SafeWebSocket) Listen(h SafeWebSocketMessageListener)
Listen 监听消息
type SafeWebSocketAliveHandler ¶
type SafeWebSocketAliveHandler = func()
type SafeWebSocketMessageListener ¶
type SafeWebSocketMessageListener = func(b []byte)
Click to show internal directories.
Click to hide internal directories.