mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-06-06 15:47:19 +02:00
Fixed #131
- Added LAN detection in geoip resolver - Updated UI for LAN/loopback request origin rendering
This commit is contained in:
parent
e0f5431215
commit
fc9240fbac
@ -83,6 +83,11 @@ func (s *Store) GetRequesterCountryISOCode(r *http.Request) string {
|
|||||||
if ipAddr == "" {
|
if ipAddr == "" {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if netutils.IsPrivateIP(ipAddr) {
|
||||||
|
return "LAN"
|
||||||
|
}
|
||||||
|
|
||||||
countryCode, err := s.ResolveCountryCodeFromIP(ipAddr)
|
countryCode, err := s.ResolveCountryCodeFromIP(ipAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ""
|
return ""
|
||||||
|
@ -93,6 +93,10 @@ func MatchIpCIDR(ip string, cidr string) bool {
|
|||||||
|
|
||||||
// Check if a ip is private IP range
|
// Check if a ip is private IP range
|
||||||
func IsPrivateIP(ipStr string) bool {
|
func IsPrivateIP(ipStr string) bool {
|
||||||
|
if ipStr == "127.0.0.1" || ipStr == "::1" {
|
||||||
|
//local loopback
|
||||||
|
return true
|
||||||
|
}
|
||||||
ip := net.ParseIP(ipStr)
|
ip := net.ParseIP(ipStr)
|
||||||
if ip == nil {
|
if ip == nil {
|
||||||
return false
|
return false
|
||||||
|
@ -765,8 +765,11 @@
|
|||||||
let data = Object.values(visitorData);
|
let data = Object.values(visitorData);
|
||||||
|
|
||||||
Object.keys(visitorData).forEach(function(cc){
|
Object.keys(visitorData).forEach(function(cc){
|
||||||
|
console.log(cc);
|
||||||
if (cc == ""){
|
if (cc == ""){
|
||||||
labels.push("Local / Unknown")
|
labels.push("Unknown")
|
||||||
|
}else if (cc == "lan"){
|
||||||
|
labels.push(`LAN / Loopback`);
|
||||||
}else{
|
}else{
|
||||||
labels.push(`${getCountryName(cc)} [${cc.toUpperCase()}]` );
|
labels.push(`${getCountryName(cc)} [${cc.toUpperCase()}]` );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user