MCPcopy Index your code
hub / github.com/PatchMon/PatchMon / getLocationFromIP

Function getLocationFromIP

server-source-code/internal/handler/auth.go:1176–1186  ·  view source on GitHub ↗

getLocationFromIP returns basic location info (simplified; for local/private IPs returns "Local").

(ip string)

Source from the content-addressed store, hash-verified

1174
1175// getLocationFromIP returns basic location info (simplified; for local/private IPs returns "Local").
1176func getLocationFromIP(ip string) map[string]string {
1177 out := map[string]string{"country": "Unknown", "city": "Unknown"}
1178 if ip == "" {
1179 return out
1180 }
1181 if ip == "127.0.0.1" || ip == "::1" || strings.HasPrefix(ip, "192.168.") || strings.HasPrefix(ip, "10.") {
1182 out["country"] = "Local"
1183 out["city"] = "Local Network"
1184 }
1185 return out
1186}
1187
1188// GetSessions handles GET /auth/sessions.
1189func (h *AuthHandler) GetSessions(w http.ResponseWriter, r *http.Request) {

Callers 1

GetSessionsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected