Exemple #1
0
func SendMessage(ms *util.MessageStream, msg *SimpleMessage) error {
	out, err := proto.Marshal(msg)
	if err != nil {
		return errors.New("SendRequest: Can't encode response")
	}
	send := string(out)
	_, err = ms.WriteString(send)
	if err != nil {
		return errors.New("SendResponse: Writestring error")
	}
	return nil
}
Exemple #2
0
func (conn *Conn) sendCredentials(ms util.MessageStream) {
	if conn.Authenticate && conn.delegation != nil {
		ms.WriteString("delegation")
		ms.WriteMessage(conn.delegation)
	} else if conn.Authenticate {
		ms.WriteString("key")
	} else {
		ms.WriteString("anonymous")
	}
}