Skip to content

?? ????:????? URL ???? #22

@gitfox-enter

Description

@gitfox-enter

????

? common.py ? ProxyPool ??,?? URL ????? PROXY_LIST ? proxy_pool.json ??,?????? URL ?????

??????

  • ??:common.py
  • ?:ProxyPool
  • ??:_validate_proxy_url()

??

  1. ??????: ???????????????????
  2. ?????: ????????????
  3. ????: ????? URL ???????

????

`python

??????

def _validate_proxy_url(proxy_url: str) -> bool:
try:
parsed = urlparse(proxy_url)
# 1. ???????
allowed_schemes = {"http", "https", "socks4", "socks4a", "socks5", "socks5h"}
if parsed.scheme.lower() not in allowed_schemes:
return False
# 2. ?? netloc ??
if not parsed.netloc:
return False
# 3. ???????
if not parsed.hostname:
return False
# 4. ??:??????
if parsed.port and not (1 <= parsed.port <= 65535):
return False
return True
except Exception:
return False
`

????

  • ????????(????)
  • ????????(????)
  • ????????????

????

  • ???:?
  • ????:?(?????)

?? ? issue ??????? | ???:?? ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions