Skip to content

Commit 2b0c8fc

Browse files
committed
Fix a bug related to --out-host
1 parent f135d68 commit 2b0c8fc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __init__(self):
5353

5454
self.host = "127.0.0.1"
5555
self.port = 8881
56-
self.out_host = "127.0.0.1"
56+
self.out_host = None
5757
self.blacklist_file = "blacklist.txt"
5858
self.fragment_method = "random"
5959
self.domain_matching = "strict"
@@ -605,7 +605,7 @@ async def _handle_https_connection(
605605
conn_info.traffic_in += response_size
606606

607607
remote_reader, remote_writer = await asyncio.open_connection(
608-
host.decode(), port, local_addr=(self.out_host, 0)
608+
host.decode(), port, local_addr=(self.out_host, 0) if self.out_host else None
609609
)
610610

611611
writer.write(b"HTTP/1.1 200 Connection Established\r\n\r\n")
@@ -627,7 +627,7 @@ async def _handle_http_connection(
627627
"""Handle HTTP request"""
628628

629629
remote_reader, remote_writer = await asyncio.open_connection(
630-
host.decode(), port, local_addr=(self.out_host, 0)
630+
host.decode(), port, local_addr=(self.out_host, 0) if self.out_host else None
631631
)
632632

633633
remote_writer.write(http_data)
@@ -1159,7 +1159,7 @@ def parse_args():
11591159
parser.add_argument("--port", type=int,
11601160
default=8881, help="Proxy port")
11611161
parser.add_argument(
1162-
"--out-host", default="127.0.0.1", help="Outgoing proxy host"
1162+
"--out-host", help="Outgoing proxy host"
11631163
)
11641164

11651165
blacklist_group = parser.add_mutually_exclusive_group()

0 commit comments

Comments
 (0)