Example #1
0
func (v *Version) NewReqInfo(userip net.IP, secret string) portal.Message {
	msg := newMessage(portal.REQ_INFO, userip, portal.NewSerialNo(), 0)
	msg.Header.AttrNum = 2
	msg.Attrs = []T_Attr{{AttrType: byte(6), AttrLen: 0}, {AttrType: byte(7), AttrLen: 0}}
	msg.AuthBy(secret)
	return msg
}
Example #2
0
func (v *Version) NewAuth(userip net.IP, secret string, username []byte, userpwd []byte, req uint16, cha []byte) portal.Message {
	msg := newMessage(3, userip, secret, portal.NewSerialNo(), req)
	msg.Header.AttrNum = 2
	hash := md5.New()
	hash.Write([]byte{byte(req)})
	hash.Write(userpwd)
	hash.Write(cha)
	cpwd := hash.Sum(nil)
	msg.Attrs = []T_Attr{{AttrType: byte(1), AttrLen: byte(len(username)), AttrStr: username}, {AttrType: byte(4), AttrLen: byte(len(cpwd)), AttrStr: cpwd}}
	return msg
}
Example #3
0
func (v *Version) NewLogout(userip net.IP, secret string) portal.Message {
	return newMessage(portal.REQ_LOGOUT, userip, secret, portal.NewSerialNo(), 0)
}
Example #4
0
func (v *Version) NewChallenge(userip net.IP, secret string) portal.Message {
	return newMessage(portal.REQ_CHALLENGE, userip, secret, portal.NewSerialNo(), 0)
}
Example #5
0
func (v *Version) NewLogout(userip net.IP, secret string) portal.Message {
	msg := newMessage(portal.REQ_LOGOUT, userip, portal.NewSerialNo(), 0)
	msg.AuthBy(secret)
	return msg
}
Example #6
0
func (v *Version) NewChallenge(userip net.IP, secret string) portal.Message {
	msg := newMessage(portal.REQ_CHALLENGE, userip, portal.NewSerialNo(), 0)
	msg.AuthBy(secret)
	return msg
}