housleyjk / ws-rs

Lightweight, event-driven WebSockets for Rust.
MIT License
1.46k stars 221 forks source link

Wishlist possibility: add generic trait for handling SSL connections, allow non-OpenSSL ssl #129

Open daboross opened 7 years ago

daboross commented 7 years ago

If something similar to the changes described in https://github.com/hyperium/hyper/issues/985 could be implemented, that would be awesome.

Ideally I'm look to use ws-rs with rustls rather than rust-openssl. Even though it's less vetted than OpenSSL and not really a good default yet, it would make building a secure websocket client on Windows much easier.

What would you think of adding SslClient and Connector traits similar to hyper's SslClient and NetworkConnector - would making WebSocket generic over such a trait be acceptable / reasonable to implement?

daboross commented 7 years ago

My use case would only be for websocket clients, but I guess if this is implemented, it'd probably be best to allow for both clients and servers.

housleyjk commented 7 years ago

Using traits to allow customization is something I'm planning on doing in the upcoming refactor. So, I can't say yes to everything you are asking for, but I will do my best.

daboross commented 7 years ago

Ok, thank you!

daboross commented 7 years ago

If a generic solution doesn't end up being viable, what would you think of potentially switching to rust-native-tls?

It's an abstraction that would still be using OpenSSL on linux, and then the native counterparts on windows and mac. I don't think it would be ideal for my use case, but it would be alright - and this would definitely make compiling to windows simpler.

download13 commented 6 years ago

This is a blocking issue for me using this library. I like it's style a lot more than the main rust websocket lib, but I can't debug my program on windows as this won't compile.

dbrgn commented 6 years ago

I'd also +1 on rust-native-tls. Besides the advantages mentioned above it also seems to have a nicer API.

dbrgn commented 6 years ago

Another issue is building for iOS. It requires a static build of OpenSSL which is cumbersome.

If I read this correctly, native_tls uses security framework on iOS instead of OpenSSL.

dbrgn commented 6 years ago

Sorry for the triple-post :) I'm not sure how much work it would be and I don't have much experience with TLS, but would you be willing to accept a pull request that exchanges openssl with native_tls?

steveklabnik commented 4 years ago

native-tls support was added in https://github.com/housleyjk/ws-rs/pull/218