File tree Expand file tree Collapse file tree 4 files changed +26
-1
lines changed Expand file tree Collapse file tree 4 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1
1
import logging
2
+ from .__version__ import __version__
2
3
3
4
# ANSI colors for console output
4
5
GREEN = "\033 [92m"
@@ -35,6 +36,6 @@ def setup_logger(verbose: bool = False) -> logging.Logger:
35
36
_logger .addHandler (console_handler )
36
37
37
38
# Log GitHub URL and version
38
- _logger .info ("https://github.com/linuztx/flaredantic" )
39
+ _logger .info (f "https://github.com/linuztx/flaredantic (v { __version__ } ) " )
39
40
40
41
return _logger
Original file line number Diff line number Diff line change 7
7
from ...base .downloader import BaseDownloader
8
8
from ...exceptions import CloudflaredError , DownloadError
9
9
from ...logging_config import setup_logger
10
+ from ...utils .termux import is_termux , install_cloudflared
10
11
11
12
class FlareDownloader (BaseDownloader ):
12
13
def __init__ (self , bin_dir : Path , verbose : bool = False ):
@@ -50,6 +51,11 @@ def download(self) -> Path:
50
51
Returns:
51
52
Path to installed cloudflared binary
52
53
"""
54
+ # Check if Termux environment first
55
+ if is_termux ():
56
+ self .logger .debug ("Termux environment detected" )
57
+ return install_cloudflared ()
58
+
53
59
system , _ = self ._platform_info
54
60
executable_name = "cloudflared.exe" if system == "windows" else "cloudflared"
55
61
install_path = self .bin_dir / executable_name
Original file line number Diff line number Diff line change 1
1
import subprocess
2
2
import threading
3
+ import os
3
4
from typing import Union , Optional
4
5
from ...base .tunnel import BaseTunnel
5
6
from ...exceptions import TunnelError
@@ -66,6 +67,8 @@ def start(self) -> str:
66
67
[
67
68
str (self .binary_path ),
68
69
"tunnel" ,
70
+ "--protocol" ,
71
+ "http2" if "TERMUX_VERSION" in os .environ else "quic" ,
69
72
"--url" ,
70
73
f"http://localhost:{ self .config .port } "
71
74
],
Original file line number Diff line number Diff line change
1
+ import os
2
+ import shutil
3
+ from pathlib import Path
4
+
5
+ def is_termux () -> bool :
6
+ """Check if running in Termux"""
7
+ return "TERMUX_VERSION" in os .environ
8
+
9
+ def install_cloudflared () -> Path :
10
+ """
11
+ Install termux official cloudflared package if not already installed
12
+ """
13
+ if shutil .which ("cloudflared" ) is None :
14
+ os .system ("pkg install cloudflared -y" )
15
+ return Path (shutil .which ("cloudflared" ))
You can’t perform that action at this time.
0 commit comments