(self, event: events.Event)
| 65 | class ReverseProxy(DestinationKnown): |
| 66 | @expect(events.Start) |
| 67 | def _handle_event(self, event: events.Event) -> layer.CommandGenerator[None]: |
| 68 | spec = self.context.client.proxy_mode |
| 69 | assert isinstance(spec, ReverseMode) |
| 70 | self.context.server.address = spec.address |
| 71 | |
| 72 | self.child_layer = layer.NextLayer(self.context) |
| 73 | |
| 74 | # For secure protocols, set SNI if keep_host_header is false |
| 75 | match spec.scheme: |
| 76 | case "http3" | "quic" | "https" | "tls" | "dtls": |
| 77 | if not self.context.options.keep_host_header: |
| 78 | self.context.server.sni = spec.address[0] |
| 79 | case "tcp" | "http" | "udp" | "dns": |
| 80 | pass |
| 81 | case _: # pragma: no cover |
| 82 | assert_never(spec.scheme) |
| 83 | |
| 84 | err = yield from self.finish_start() |
| 85 | if err: |
| 86 | yield commands.CloseConnection(self.context.client) |
| 87 | |
| 88 | |
| 89 | class TransparentProxy(DestinationKnown): |
nothing calls this directly
no test coverage detected