mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-08-09 06:37:47 +02:00
Optimized memory usage and root routing
+ Added unset subdomain custom redirection feature #46 + Optimized memory usage by space time tradeoff in geoip lookup to fix #52 + Replaced all stori/go.uuid to google/uuid for security reasons #55
This commit is contained in:
@@ -335,3 +335,20 @@ func HandleZoraxyInfo(w http.ResponseWriter, r *http.Request) {
|
||||
js, _ := json.MarshalIndent(info, "", " ")
|
||||
utils.SendJSONResponse(w, string(js))
|
||||
}
|
||||
|
||||
func HandleGeoIpLookup(w http.ResponseWriter, r *http.Request) {
|
||||
ip, err := utils.GetPara(r, "ip")
|
||||
if err != nil {
|
||||
utils.SendErrorResponse(w, "ip not given")
|
||||
return
|
||||
}
|
||||
|
||||
cc, err := geodbStore.ResolveCountryCodeFromIP(ip)
|
||||
if err != nil {
|
||||
utils.SendErrorResponse(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
js, _ := json.Marshal(cc)
|
||||
utils.SendJSONResponse(w, string(js))
|
||||
}
|
||||
|
Reference in New Issue
Block a user