host detect in first-run window

This commit is contained in:
Flowseal
2026-03-29 19:55:39 +03:00
parent 968827445f
commit 17e37f9ca0
3 changed files with 6 additions and 12 deletions

View File

@@ -1029,15 +1029,7 @@ async def _run(stop_event: Optional[asyncio.Event] = None):
except (OSError, AttributeError):
pass
link_host = proxy_config.host
if proxy_config.host == '0.0.0.0':
try:
with _socket.socket(_socket.AF_INET, _socket.SOCK_DGRAM) as _s:
_s.connect(('8.8.8.8', 80))
link_host = _s.getsockname()[0]
except OSError:
link_host = '127.0.0.1'
link_host = get_link_host(proxy_config.host)
tg_link = f"tg://proxy?server={link_host}&port={proxy_config.port}&secret=dd{proxy_config.secret}"
log.info("=" * 60)