示例#1
0
文件: action.go 项目: BobbWu/syler
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
}