func acceptAll(req, res *goradius.RadiusPacket) error { ctr += 1 if ctr%2000 == 0 { log.Printf("%v processed requests", ctr) } res.Code = goradius.AccessAccept return nil }
func addAttributes(req, res *goradius.RadiusPacket) error { if res.Code == goradius.AccessAccept { res.AddAttribute("NAS-Identifier", []byte("rem7")) res.AddAttribute("Idle-Timeout", uint32(600)) res.AddAttribute("Session-Timeout", uint32(10800)) } return nil }
func passwordCheck(req, res *goradius.RadiusPacket) error { username := req.GetAttribute("User-Name") usernameData, _ := username.([]byte) password := req.GetAttribute("User-Password") passwordData, _ := password.([]byte) log.Printf("[radius request] username: [%v] password: [%v]", string(usernameData), string(passwordData)) if bytes.Equal(passwordData, []byte("testing")) && bytes.Equal(usernameData, []byte("steve")) { res.Code = goradius.AccessAccept } else { res.Code = goradius.AccessReject } return nil }