Update ProxyCat-V1.8.py

This commit is contained in:
本间白猫 2024-10-20 21:22:21 +08:00 committed by GitHub
parent 143a8917b0
commit 2933de194d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -68,7 +68,17 @@ def load_proxies(file_path: str = 'ip.txt') -> List[str]:
def is_valid_proxy(proxy: str) -> bool:
pattern = re.compile(
r'^((25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\.){3}(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d):([1-9]|[1-9]\d{1,4}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$|^([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}:( [1-9]|[1-9]\d{1,4}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$'
r'^(http|https|socks5)://'
r'('
r'(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\.'
r'(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\.'
r'(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\.'
r'(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)'
r'|'
r'([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}'
r')'
r':'
r'(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|[1-5]\d{4}|\d{1,4})$'
)
return bool(pattern.match(proxy))
@ -643,4 +653,4 @@ if __name__ == '__main__':
try:
asyncio.run(main())
except KeyboardInterrupt:
logging.info("Program interrupted by user")
logging.info("Program interrupted by user")