Geek7 commited on
Commit
7e4310f
·
verified ·
1 Parent(s): 7fb8b19

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -23
app.py CHANGED
@@ -14,11 +14,11 @@ app = Flask(__name__)
14
  CORS(app) # Enable CORS for all routes
15
 
16
  # Load IPv4 & IPv6 databases (Download and place in same folder)
17
- IPV4_BIN = "ipv4/IP2PROXY-LITE-PX2.BIN"
18
- IPV6_BIN = "ipv6/IP2PROXY-LITE-PX2.BIN"
19
 
20
- db_ipv4 = IP2Location.IP2Location(IPV4_BIN)
21
- db_ipv6 = IP2Location.IP2Location(IPV6_BIN)
22
 
23
  zip_folder = "ipv4" # Change this to your folder
24
  extract_to = "ipv4"
@@ -64,26 +64,26 @@ def get_ecpm():
64
 
65
  return jsonify({"ecpm": ecpm_value, "timezone": user_timezone})
66
 
67
- def check_proxy(ip):
68
- try:
69
- db = db_ipv6 if ":" in ip else db_ipv4 # Use correct database
70
- record = db.get_all(ip)
71
 
72
- proxy_type = record.proxy_type
73
- return proxy_type not in ["", "-"] # Proxy detected if type is not empty
74
- except Exception as e:
75
- print(f"Error checking IP: {e}")
76
- return False
77
-
78
- @app.route("/check-ip", methods=["GET"])
79
- def check_ip():
80
- user_ip = request.headers.get("X-Forwarded-For", request.remote_addr) # Get real IP
81
- is_proxy = check_proxy(user_ip)
82
-
83
- return jsonify({
84
- "ip": user_ip,
85
- "proxy_detected": is_proxy
86
- })
87
 
88
 
89
  for zip_file in zip_files:
 
14
  CORS(app) # Enable CORS for all routes
15
 
16
  # Load IPv4 & IPv6 databases (Download and place in same folder)
17
+ #IPV4_BIN = "ipv4/IP2PROXY-LITE-PX2.BIN"
18
+ #IPV6_BIN = "ipv6/IP2PROXY-LITE-PX2.BIN"
19
 
20
+ #db_ipv4 = IP2Location.IP2Location(IPV4_BIN)
21
+ #db_ipv6 = IP2Location.IP2Location(IPV6_BIN)
22
 
23
  zip_folder = "ipv4" # Change this to your folder
24
  extract_to = "ipv4"
 
64
 
65
  return jsonify({"ecpm": ecpm_value, "timezone": user_timezone})
66
 
67
+ #def check_proxy(ip):
68
+ # try:
69
+ # db = db_ipv6 if ":" in ip else db_ipv4 # Use correct database
70
+ # record = db.get_all(ip)
71
 
72
+ # proxy_type = record.proxy_type
73
+ # return proxy_type not in ["", "-"] # Proxy detected if type is not empty
74
+ #except Exception as e:
75
+ # print(f"Error checking IP: {e}")
76
+ # return False
77
+
78
+ #@app.route("/check-ip", methods=["GET"])
79
+ #def check_ip():
80
+ # user_ip = request.headers.get("X-Forwarded-For", request.remote_addr) # Get real IP
81
+ # is_proxy = check_proxy(user_ip)
82
+
83
+ # return jsonify({
84
+ # "ip": user_ip,
85
+ # "proxy_detected": is_proxy
86
+ #})
87
 
88
 
89
  for zip_file in zip_files: