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

Class BindWebSecureSocket

tests/test_connection.py:4460–4481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4458
4459 # Adapter to turn web secure socket into a stream "connection"
4460 class BindWebSecureSocket(object):
4461 def __init__(self, hostname, port):
4462 certfile = f'{wss_proxy_certs}/client.pem'
4463 keyfile = f'{wss_proxy_certs}/client-key.pem'
4464 self.ws = websocket.WebSocket(sslopt={"cert_reqs": ssl.CERT_NONE, "ssl_version": ssl.PROTOCOL_TLS_CLIENT, "certfile": certfile, "keyfile": keyfile})
4465 self.ws.settimeout(TIMEOUT)
4466 try:
4467 self.ws.connect("wss://" + hostname + ":" + str(port))
4468 except Exception as e:
4469 raise Exception(f"WebSocket connection failed: {e}")
4470 self.recvbuf = bytes()
4471
4472 def send(self, data):
4473 self.ws.send(data, websocket.ABNF.OPCODE_BINARY)
4474
4475 def recv(self, maxlen):
4476 while len(self.recvbuf) < maxlen:
4477 self.recvbuf += self.ws.recv()
4478
4479 ret = self.recvbuf[:maxlen]
4480 self.recvbuf = self.recvbuf[maxlen:]
4481 return ret
4482
4483 # This might happen really early!
4484 l1.daemon.logsearch_start = 0

Callers 1

test_wss_proxyFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_wss_proxyFunction · 0.68