refactor: get rid of router/utils.go
most functions end up in other files in the router package, but a few land in common.
This commit is contained in:
1 parent
7a5c910cd5
commit
8bd77c0d47
11 files changed
+114
-125
No files matched your search
@@ -112,3 +112,20 @@ func (cache *MacCache) expire() {
|
||||
}
|
||||
cache.setExpiryTimer()
|
||||
}
|
||||
|
||||
func macint(mac net.HardwareAddr) (r uint64) {
|
||||
for _, b := range mac {
|
||||
r <<= 8
|
||||
r |= uint64(b)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func intmac(key uint64) (r net.HardwareAddr) {
|
||||
r = make([]byte, 6)
|
||||
for i := 5; i >= 0; i-- {
|
||||
r[i] = byte(key)
|
||||
key >>= 8
|
||||
}
|
||||
return
|
||||
}
|
||||
Reference in new issue
Block a user