(nextlayer: layer.NextLayer)
| 23 | |
| 24 | |
| 25 | def next_layer(nextlayer: layer.NextLayer): |
| 26 | logging.info( |
| 27 | f"{nextlayer.context=}\n" |
| 28 | f"{nextlayer.data_client()[:70]=}\n" |
| 29 | f"{nextlayer.data_server()[:70]=}\n" |
| 30 | ) |
| 31 | |
| 32 | if nextlayer.context.server.address == ("example.com", 443): |
| 33 | nextlayer.context.server.address = ("example.com", 80) |
| 34 | |
| 35 | # We are disabling ALPN negotiation as our curl client would otherwise agree on HTTP/2, |
| 36 | # which our example server here does not accept for plaintext connections. |
| 37 | nextlayer.context.client.alpn = b"" |
| 38 | |
| 39 | # We know all layers that come next: First negotiate TLS with the client, then do simple TCP passthrough. |
| 40 | # Setting only one layer here would also work, in that case next_layer would be called again after TLS establishment. |
| 41 | nextlayer.layer = layers.ClientTLSLayer(nextlayer.context) |
| 42 | nextlayer.layer.child_layer = layers.TCPLayer(nextlayer.context) |
nothing calls this directly
no test coverage detected
searching dependent graphs…