vapor / mysql-nio

🐬 Non-blocking, event-driven Swift client for MySQL.
MIT License
90 stars 27 forks source link

Support establishing connections over existing NIO channels #76

Open gwynne opened 2 years ago

gwynne commented 2 years ago

It is useful to be able to ask MySQLNIO to initiate a connection using a preexisting NIO channel. The most obvious use case is SSH tunneling. This should mostly be a matter of simply exposing the appropriate API as public.

Joannis commented 2 years ago

If using Citadel/NIOSSH, what you get is a NIO.Channel that the library needs to add its handlers to (including optionally TLS) and then initialize a connection with that Channel. The main complication would be for drivers supporting clustering, or connection pools in general. As those would need to allow the user to create a new channel manually. In general, that change (custom Channels) is great if you want to support Network.framework as well.