Skip to content

Commit

Permalink
clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-X-Net committed Jul 10, 2023
1 parent c63d39f commit 3aac4a5
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 17 deletions.
9 changes: 0 additions & 9 deletions code/default/update_v4.txt

This file was deleted.

2 changes: 1 addition & 1 deletion code/default/x_tunnel/local/cloudflare_front/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, fn):
self.set_var("target_handshake_time", 500)
self.set_var("active_connect_interval", 3*60)
self.set_var("scan_ip_interval", 10)
self.set_var("max_connection_per_domain", 2)
self.set_var("max_connection_per_domain", 1)

# ip source
self.set_var("use_ipv6", "auto") # force_ipv4/force_ipv6/auto
Expand Down
5 changes: 2 additions & 3 deletions code/default/x_tunnel/local/cloudflare_front/ip_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,11 @@ def get_ip_sni_host(self):
try:
ip = socket.gethostbyname(sni)
except Exception as e:
self.logger.debug("get ip for sni:%s failed:%r", sni, e)
self.logger.warn("get ip for %s fail:%r", sni, e)
continue

info["links"] += 1

self.logger.debug("get ip:%s sni:%s", ip, sni)
info["links"] += 1
return ip, sni, top_domain

return None, None, None
Expand Down
5 changes: 2 additions & 3 deletions code/default/x_tunnel/local/tls_relay_front/check_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
from front_base.connect_creator import ConnectCreator
from front_base.check_ip import CheckIp

from x_tunnel.local.tls_relay_front import front
from x_tunnel.local.tls_relay_front.config import Config
from x_tunnel.local.tls_relay_front.host_manager import HostManager

Expand All @@ -47,6 +46,7 @@
# case 1: only ip
# case 2: ip + domain
# connect use domain
# case 3: ip domain path

wait_time = 0
ip = "127.0.0.1:60000"
Expand Down Expand Up @@ -85,9 +85,8 @@
if not res:
print("connect fail")
elif res.ok:
print(("Check success, domain:%s handshake:%d" % (res.top_domain, res.handshake_time)))
print(("Check success, domain:%s handshake:%d" % (res.host, res.handshake_time)))
else:
print("not support")

front.stop()
sys.exit(0)
1 change: 1 addition & 0 deletions code/default/x_tunnel/local/tls_relay_front/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def __init__(self, fn):
# front
self.set_var("front_continue_fail_num", 10)
self.set_var("front_continue_fail_block", 10)
self.set_var("allow_set_ips", 1)

# https_dispatcher
self.set_var("dispather_min_idle_workers", 1)
Expand Down
2 changes: 1 addition & 1 deletion code/default/x_tunnel/local/tls_relay_front/front.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def set_x_tunnel_account(self, account, password):
self.password = password

def set_ips(self, ips):
if not ips:
if not ips or not self.config.allow_set_ips:
return

host_info = {}
Expand Down

0 comments on commit 3aac4a5

Please sign in to comment.