Compare commits

...
1 Commits
Author SHA1 Message Date
Flowseal dc2c4c03f6 Restore win7 compatability 2026-10-30 20:38:49 +03:00
2 changed files with 10 additions and 2 deletions

No files matched your search

+2 -1
View File
@@ -12,6 +12,7 @@ import logging
from typing import Dict, FrozenSet, NamedTuple, Optional, Tuple
from .stats import stats
from .utils import set_x25519
try:
from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey
@@ -272,7 +273,7 @@ async def probe_appdata_len(domain: str, port: int = 443,
writer = None
try:
ctx = ssl.create_default_context()
ctx.set_ecdh_curve('X25519')
set_x25519(ctx)
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
ctx.minimum_version = ssl.TLSVersion.TLSv1_3
+8 -1
View File
@@ -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