mirror of
https://github.com/Flowseal/tg-ws-proxy.git
synced 2026-10-21 02:58:45 +00:00
use certifi for tls connections, fixes #1348
This commit is contained in:
1 parent
a0605c7447
commit
e519c4df4c
2 files changed
+6
-4
No files matched your search
@@ -1,5 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import ssl
|
import ssl
|
||||||
|
import certifi
|
||||||
import logging
|
import logging
|
||||||
import base64
|
import base64
|
||||||
import struct
|
import struct
|
||||||
@@ -21,8 +22,8 @@ _st_BBQ4s = struct.Struct('>BBQ4s')
|
|||||||
_st_H = struct.Struct('>H')
|
_st_H = struct.Struct('>H')
|
||||||
_st_Q = struct.Struct('>Q')
|
_st_Q = struct.Struct('>Q')
|
||||||
|
|
||||||
_ssl_ctx = ssl.create_default_context()
|
_ssl_ctx = ssl.create_default_context(cafile=certifi.where())
|
||||||
_ssl_ctx_fronting = ssl.create_default_context()
|
_ssl_ctx_fronting = ssl.create_default_context(cafile=certifi.where())
|
||||||
_ssl_ctx_fronting.check_hostname = False
|
_ssl_ctx_fronting.check_hostname = False
|
||||||
|
|
||||||
class WsHandshakeError(Exception):
|
class WsHandshakeError(Exception):
|
||||||
@@ -290,4 +291,4 @@ class RawWebSocket:
|
|||||||
payload = await self.reader.readexactly(length)
|
payload = await self.reader.readexactly(length)
|
||||||
return opcode, _xor_mask(payload, mask_key), fin
|
return opcode, _xor_mask(payload, mask_key), fin
|
||||||
payload = await self.reader.readexactly(length)
|
payload = await self.reader.readexactly(length)
|
||||||
return opcode, payload, fin
|
return opcode, payload, fin
|
||||||
+2
-1
@@ -48,9 +48,10 @@ def _run_connectivity_test(cases: list, *, secure: bool = True) -> dict:
|
|||||||
import base64
|
import base64
|
||||||
from contextlib import nullcontext
|
from contextlib import nullcontext
|
||||||
import ssl
|
import ssl
|
||||||
|
import certifi
|
||||||
import socket as _socket
|
import socket as _socket
|
||||||
|
|
||||||
ctx = ssl.create_default_context() if secure else None
|
ctx = ssl.create_default_context(cafile=certifi.where()) if secure else None
|
||||||
port = 443 if secure else 80
|
port = 443 if secure else 80
|
||||||
results = {}
|
results = {}
|
||||||
for dc, connect_host, sni_host, req_host, path in cases:
|
for dc, connect_host, sni_host, req_host, path in cases:
|
||||||
|
|||||||
Reference in new issue
Block a user