mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-08-14 08:59:19 +02:00
Updates v2.6.1
+ Added reverse proxy TLS skip verification + Added basic auth + Edit proxy settings + Whitelist + TCP Proxy (experimental) + Info (Utilities page)
This commit is contained in:
@@ -145,7 +145,9 @@ func (c *Collector) RecordRequest(ri RequestInfo) {
|
||||
//Filter out CF forwarded requests
|
||||
if strings.Contains(ri.IpAddr, ",") {
|
||||
ips := strings.Split(strings.TrimSpace(ri.IpAddr), ",")
|
||||
if len(ips) >= 1 {
|
||||
if len(ips) >= 1 && IsValidIPAddress(strings.TrimPrefix(ips[0], "[")) {
|
||||
//Example when forwarded from CF: 158.250.160.114,109.21.249.211
|
||||
//Or IPv6 [15c4:cbb4:cc98:4291:ffc1:3a46:06a1:51a7],109.21.249.211
|
||||
ri.IpAddr = ips[0]
|
||||
}
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package statistic
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -26,3 +27,19 @@ func IsBeforeToday(dateString string) bool {
|
||||
today := time.Now().UTC().Truncate(24 * time.Hour)
|
||||
return date.Before(today) || dateString == time.Now().Format(layout)
|
||||
}
|
||||
|
||||
// Check if the IP string is a valid ip address
|
||||
func IsValidIPAddress(ip string) bool {
|
||||
// Check if the string is a valid IPv4 address
|
||||
if parsedIP := net.ParseIP(ip); parsedIP != nil && parsedIP.To4() != nil {
|
||||
return true
|
||||
}
|
||||
|
||||
// Check if the string is a valid IPv6 address
|
||||
if parsedIP := net.ParseIP(ip); parsedIP != nil && parsedIP.To16() != nil {
|
||||
return true
|
||||
}
|
||||
|
||||
// If the string is neither a valid IPv4 nor IPv6 address, return false
|
||||
return false
|
||||
}
|
||||
|
Reference in New Issue
Block a user