ing
This commit is contained in:
parent
f38e3a61af
commit
cbe7492057
7
context/context.go
Normal file
7
context/context.go
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
package context
|
||||||
|
|
||||||
|
type ContextKey string
|
||||||
|
|
||||||
|
func (c ContextKey) String() string {
|
||||||
|
return string(c)
|
||||||
|
}
|
|
@ -20,10 +20,10 @@ func IPToUint64(ip string) uint64 {
|
||||||
if !isV4 {
|
if !isV4 {
|
||||||
return ipv6ToUint64(ip)
|
return ipv6ToUint64(ip)
|
||||||
}
|
}
|
||||||
return ipv4ToUint64(ip)
|
return IPV4ToUint64(ip)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ipv4ToUint64(s string) uint64 {
|
func IPV4ToUint64(s string) uint64 {
|
||||||
bits := strings.Split(s, ".")
|
bits := strings.Split(s, ".")
|
||||||
|
|
||||||
b0, _ := strconv.Atoi(bits[0])
|
b0, _ := strconv.Atoi(bits[0])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user