add domain whois/dns support, refactor codebase

This commit is contained in:
2025-09-17 20:38:51 +02:00
parent 477bc242aa
commit 16fc344a68
29 changed files with 1396 additions and 867 deletions
+25
View File
@@ -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
}