Пример #1
0
func (v *Version) IsResponse(mesg portal.Message) bool {
	switch mesg.Type() {
	case 2, 4, 6, 10:
		return true
	}
	return false
}
Пример #2
0
func Auth(userip net.IP, basip net.IP, timeout uint32, username, userpwd []byte) (err error) {
	var res portal.Message
	if res, err = Challenge(userip, basip); err == nil {
		if cres, ok := res.(portal.ChallengeRes); ok {
			res, err = portal.ChapAuth(userip, *config.HuaweiSecret, basip, *config.HuaweiNasPort, username, userpwd, res.ReqId(), cres.GetChallenge())
			if err == nil {
				res, err = portal.AffAckAuth(userip, *config.HuaweiSecret, basip, *config.HuaweiNasPort, res.SerialId(), res.ReqId())
			}
		}
	}
	return
}