mirror of
https://github.com/skidoodle/ipinfo.git
synced 2026-04-28 01:27:34 +02:00
add domain whois/dns support, refactor codebase
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"ipinfo/utils"
|
||||
)
|
||||
|
||||
// ToPtr converts a string to a pointer, returning nil for empty strings.
|
||||
func ToPtr(s string) *string {
|
||||
if s == "" {
|
||||
return nil
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
// IsBogon checks if the IP is a bogon IP.
|
||||
func IsBogon(ip net.IP) bool {
|
||||
for _, network := range utils.BogonNets {
|
||||
if network.Contains(ip) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user