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,22 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// HealthCheck Returns a simple health check handler.
|
||||
func HealthCheck() http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
_, err := w.Write([]byte("OK"))
|
||||
if err != nil {
|
||||
slog.Warn("failed to write healthcheck response",
|
||||
"component", "healthcheck",
|
||||
"method", r.Method,
|
||||
"path", r.URL.Path,
|
||||
"error", err,
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Returns a simple health check handler
|
||||
func HealthCheck() http.Handler {
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write([]byte("OK"))
|
||||
})
|
||||
return mux
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"net"
|
||||
)
|
||||
|
||||
// Contains a list of known bogon IP ranges
|
||||
// BogonNets Contains a list of known bogon IP ranges
|
||||
var BogonNets = []*net.IPNet{
|
||||
// IPv4
|
||||
{IP: net.IPv4(0, 0, 0, 0), Mask: net.CIDRMask(8, 32)}, // "This" network
|
||||
Reference in New Issue
Block a user