MCPcopy Create free account
hub / github.com/ElementsProject/lightning / BindWebSecureSocket

Class BindWebSecureSocket

tests/test_connection.py:4411–4432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4409
4410 # Adapter to turn web secure socket into a stream "connection"
4411 class BindWebSecureSocket(object):
4412 def __init__(self, hostname, port):
4413 certfile = f'{wss_proxy_certs}/client.pem'
4414 keyfile = f'{wss_proxy_certs}/client-key.pem'
4415 self.ws = websocket.WebSocket(sslopt={"cert_reqs": ssl.CERT_NONE, "ssl_version": ssl.PROTOCOL_TLS_CLIENT, "certfile": certfile, "keyfile": keyfile})
4416 self.ws.settimeout(TIMEOUT)
4417 try:
4418 self.ws.connect("wss://" + hostname + ":" + str(port))
4419 except Exception as e:
4420 raise Exception(f"WebSocket connection failed: {e}")
4421 self.recvbuf = bytes()
4422
4423 def send(self, data):
4424 self.ws.send(data, websocket.ABNF.OPCODE_BINARY)
4425
4426 def recv(self, maxlen):
4427 while len(self.recvbuf) < maxlen:
4428 self.recvbuf += self.ws.recv()
4429
4430 ret = self.recvbuf[:maxlen]
4431 self.recvbuf = self.recvbuf[maxlen:]
4432 return ret
4433
4434 # This might happen really early!
4435 l1.daemon.logsearch_start = 0

Callers 1

test_wss_proxyFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_wss_proxyFunction · 0.68