teleport/lib/proxy
rosstimothy e4e7f538ce
Make proxy routing logic reusable (#18370)
* create  package to contain proxy peering code

* Refactor proxy routing logic into a reusable object

Routing logic existed within an unexported handler of ssh subsystem
requests, which prevented it from being reused by other components
within the proxy, like the webapi server. This causes significant
latency issues for web sessions because the web apiserver is required
to dial the proxy ssh server to determine how to route to the host.
Since the web apiserver and the proxy ssh server exist in the same
process this is an entirely unnecesarry step that could be avoided
if the routing and ability to established connections were shared
throughout the proxy.

A new `proxy.Router` object is introduced which contains all the
logic that used to exist in `regular.proxySubsys` for determining
how to connect to servers and clusters. All routing within the
`regular.proxySubsys` now leverages the `proxy.Router` to dial
the target.

This is step 1 in addressing #15167. Now that the `proxy.Router`
exists `web.APIServer` will be able to make use of it to avoid
dialing the same process to establish connections.
2022-11-18 13:11:32 +00:00
..
clusterdial Make proxy routing logic reusable (#18370) 2022-11-18 13:11:32 +00:00
peer Make proxy routing logic reusable (#18370) 2022-11-18 13:11:32 +00:00
router.go Make proxy routing logic reusable (#18370) 2022-11-18 13:11:32 +00:00
router_test.go Make proxy routing logic reusable (#18370) 2022-11-18 13:11:32 +00:00