Skip to content

Commit 8f9cd12

Browse files
committed
fix: break bug in windows
1 parent b0498a5 commit 8f9cd12

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

hiddify_reality_scanner/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.0
1+
1.6.0

hiddify_reality_scanner/cli.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def main():
181181
domains = file.readlines()
182182
domains = [d.strip() for d in domains]
183183
random.shuffle(domains)
184-
184+
print(json.dumps(data, indent=4))
185185
if len(domains)>100:
186186
print("===============================================================")
187187
print("===============================================================")
@@ -191,7 +191,7 @@ def main():
191191
print("===============================================================")
192192
print("===============================================================")
193193
# Now you can use these values in your code
194-
print(json.dumps(data, indent=4))
194+
195195

196196
bin = bin_path()
197197
if not os.path.exists(f"bin/{bin}"):
@@ -211,8 +211,11 @@ def custom_sort_key2(item):
211211
if not item or not item["ping"]:
212212
return -1000000000
213213
return -item["ping"]
214-
214+
results=[r for r in results if r['ping']]
215215
results = sorted(results, key=custom_sort_key2)
216+
if not len(results):
217+
print("Nothing found! :(")
218+
216219
print("\n".join([f"{d['sni']}\t\t:{d['ping']}" for d in results]))
217220
results = sorted(
218221
results,
@@ -248,11 +251,14 @@ def run_in_parallel(data, domains, num_cpu_cores=4):
248251
return results
249252

250253
def test_domain(data, domain):
251-
loop = asyncio.new_event_loop()
252-
asyncio.set_event_loop(loop)
253-
result = loop.run_until_complete(test_domain_async(data, domain))
254-
return result
255-
254+
try:
255+
loop = asyncio.new_event_loop()
256+
asyncio.set_event_loop(loop)
257+
result = loop.run_until_complete(test_domain_async(data, domain))
258+
return result
259+
except:
260+
print('breaking...')
261+
return {"ping": None, "sni": domain}
256262

257263
async def test_domain_async(data, d):
258264
try:

0 commit comments

Comments
 (0)