token-validator: Avoid .254 address and add tests
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
e763716802
commit
b2de685e24
3 changed files with 58 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Reference in a new issue