mirror of
https://github.com/Flowseal/tg-ws-proxy.git
synced 2026-10-31 12:51:53 +03:00
Restore win7 compatability
This commit is contained in:
+8
-1
@@ -143,13 +143,20 @@ class _PinnedHTTPSHandler(urllib.request.HTTPSHandler):
|
||||
return super().https_open(req)
|
||||
|
||||
|
||||
def set_x25519(context: ssl.SSLContext) -> None:
|
||||
try:
|
||||
context.set_ecdh_curve('X25519')
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def create_ssl_context(*, check_hostname: bool = True) -> ssl.SSLContext:
|
||||
bundle_dir = getattr(sys, '_MEIPASS', None)
|
||||
cafile = (os.path.join(bundle_dir, 'certifi', 'cacert.pem')
|
||||
if bundle_dir else certifi.where())
|
||||
context = ssl.create_default_context(cafile=cafile)
|
||||
context.load_default_certs()
|
||||
context.set_ecdh_curve('X25519')
|
||||
set_x25519(context)
|
||||
context.check_hostname = check_hostname
|
||||
return context
|
||||
|
||||
|
||||
Reference in New Issue
Block a user