Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default OS / self signed certificate without create it #1073

Closed
thewh1teagle opened this issue Oct 20, 2023 · 1 comment
Closed

Default OS / self signed certificate without create it #1073

thewh1teagle opened this issue Oct 20, 2023 · 1 comment
Labels
feature New feature or request

Comments

@thewh1teagle
Copy link

thewh1teagle commented Oct 20, 2023

I would like to spawn a ws server easily with wss support without generate myself the certificate.
does it possible?

My code:

use futures::StreamExt;
use futures::FutureExt;
use warp::Filter;

#[tokio::main]
async fn main() {
let echo = warp::path("echo")
        .and(warp::ws())
        .map(|ws: warp::ws::Ws| {
            ws.on_upgrade(|websocket| {
                let (tx, rx) = websocket.split();
                rx.forward(tx).map(|result| {
                    if let Err(e) = result {
                        eprintln!("websocket error: {:?}", e);
                    }
                })
            })
        });
    
    let current_dir = std::env::current_dir().expect("failed to read current directory");
    let routes = warp::get().and(echo.or(warp::fs::dir(current_dir)));
    warp::serve(routes)
            .tls()
            // .cert_path("cert.pem") // <--- I want to avoide this line
            // .key_path("key.rsa") // <--- I want to avoide this line
            .run(([0, 0, 0, 0], 9231)).await;
}
@thewh1teagle thewh1teagle added the feature New feature or request label Oct 20, 2023
@seanmonstar
Copy link
Owner

warp does not have support built-in. You might be able to find something prebuilt. I wouldn't want to add it to warp.

@seanmonstar seanmonstar closed this as not planned Won't fix, can't repro, duplicate, stale Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants