token-validator: Avoid .254 address and add tests
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
nemunaire 2023-02-20 11:52:37 +01:00
commit b2de685e24
3 changed files with 58 additions and 2 deletions

View file

@ -18,9 +18,10 @@ func init() {
}
func IPSuffix(s *adlin.Student, network net.IPNet) net.IP {
ipshift := s.Id*4 + 10
ipshift := s.Id*4 + 7
myIP := network.IP
myIP := make(net.IP, len(network.IP))
copy(myIP, network.IP)
if ipshift > 254 {
myIP[len(myIP)-2] += byte(ipshift / 254)