token-validator: better calculate IP contained
This commit is contained in:
parent
6fcdc44952
commit
d28b14fa50
3 changed files with 11 additions and 2 deletions
|
@ -12,10 +12,19 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
const StdNetmask = 80
|
||||
|
||||
func StudentIP(idstd int64) net.IP {
|
||||
return net.ParseIP(fmt.Sprintf("2a01:e0a:2b:2252:%x::", idstd))
|
||||
}
|
||||
|
||||
func StudentNet(idstd int64) *net.IPNet {
|
||||
return &net.IPNet{
|
||||
IP: StudentIP(idstd),
|
||||
Mask: net.CIDRMask(StdNetmask, 128),
|
||||
}
|
||||
}
|
||||
|
||||
type WGDump struct {
|
||||
PubKey string
|
||||
PSK string
|
||||
|
|
Reference in a new issue