Fix cli.py install-hysteria2
This commit is contained in:
10
core/validator.py
Normal file
10
core/validator.py
Normal file
@ -0,0 +1,10 @@
|
||||
import os
|
||||
|
||||
|
||||
def validate_port(p:int)-> bool:
|
||||
if p < 1 or p > 65535:
|
||||
return False
|
||||
# check if port is in use
|
||||
if os.system(f'lsof -i:{p}') == 0:
|
||||
return False
|
||||
return True
|
||||
Reference in New Issue
Block a user