Documentation ¶
Overview ¶
提供一些实用函数
Index ¶
- func AESDecryptMsg(encryptedMsg []byte, AppId string, AESKey [32]byte) (random, rawXMLMsg []byte, err error)
- func AESEncryptMsg(random, rawXMLMsg []byte, AppId string, AESKey [32]byte) (encryptedMsg []byte)
- func AESKeyDecode(encodedAESKey string) (AESKey []byte, err error)
- func Bool(v bool) *bool
- func Download(url, filepath string, httpClient *http.Client) (err error)
- func DownloadToWriter(url string, w io.Writer, httpClient *http.Client) (err error)
- func Float32(v float32) *float32
- func Float64(v float64) *float64
- func HttpResponseWriter(w io.Writer) http.ResponseWriter
- func Int(v int) *int
- func Int32(v int32) *int32
- func Int64(v int64) *int64
- func MsgSign(token, timestamp, nonce, encryptedMsg string) (signature string)
- func Sign(token, timestamp, nonce string) (signature string)
- func String(v string) *string
- func Uint32(v uint32) *uint32
- func Uint64(v uint64) *uint64
- func WXVersion(userAgent string) (x, y, z int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AESDecryptMsg ¶
func AESDecryptMsg(encryptedMsg []byte, AppId string, AESKey [32]byte) (random, rawXMLMsg []byte, err error)
encryptedMsg = AES_Encrypt[random(16B) + msg_len(4B) + rawXMLMsg + AppId]
func AESEncryptMsg ¶
encryptedMsg = AES_Encrypt[random(16B) + msg_len(4B) + rawXMLMsg + AppId]
func AESKeyDecode ¶
把长度为 43 的字符串 base64 decode 到 32 字节的 []byte
encodedAESKey 由 a-z,A-Z,0-9 组成, 一般在微信管理后台随机生成
func Bool ¶
Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.
func DownloadToWriter ¶
func Float32 ¶
Float32 is a helper routine that allocates a new float32 value to store v and returns a pointer to it.
func Float64 ¶
Float64 is a helper routine that allocates a new float64 value to store v and returns a pointer to it.
func HttpResponseWriter ¶
func HttpResponseWriter(w io.Writer) http.ResponseWriter
将 io.Writer 从语义上实现 http.ResponseWriter.
func Int ¶
Int is a helper routine that allocates a new int value to store v and returns a pointer to it.
func Int32 ¶
Int32 is a helper routine that allocates a new int32 value to store v and returns a pointer to it.
func Int64 ¶
Int64 is a helper routine that allocates a new int64 value to store v and returns a pointer to it.
func String ¶
String is a helper routine that allocates a new string value to store v and returns a pointer to it.
func Uint32 ¶
Uint32 is a helper routine that allocates a new uint32 value to store v and returns a pointer to it.
Types ¶
This section is empty.