Exemple #1
0
// 把 news 回复消息 msg 写入 writer w
func WriteNews(w io.Writer, msg *response.News) (err error) {
	if w == nil {
		return errors.New("w == nil")
	}
	if msg == nil {
		return errors.New("msg == nil")
	}
	if err = msg.CheckValid(); err != nil {
		return
	}
	return writeResponse(w, msg)
}
Exemple #2
0
// 把 news 回复消息 msg 写入 writer w
func WriteAESNews(w io.Writer, msg *response.News, timestamp int64, nonce string,
	AESKey [32]byte, random []byte, AppId, Token string) (err error) {

	if w == nil {
		return errors.New("w == nil")
	}
	if msg == nil {
		return errors.New("msg == nil")
	}
	if err = msg.CheckValid(); err != nil {
		return
	}
	return writeAESResponse(w, msg, timestamp, nonce, AESKey, random, AppId, Token)
}