snapdrop icon indicating copy to clipboard operation
snapdrop copied to clipboard

Port the Snapdrop server to Rust

Open RobinLinus opened this issue 3 years ago • 6 comments

Is someone interested to translate the Snapdrop server to Rust?

RobinLinus avatar Oct 12 '22 23:10 RobinLinus

If it's just the one file i could give it a try this weekend.

crapStone avatar Oct 13 '22 14:10 crapStone

Looks like this is already quite close to the Snapdrop server. https://github.com/seanmonstar/warp/blob/master/examples/websockets_chat.rs

Is someone here familiar with warp and knows how to get a client's ip? I dug into it shortly but it looked complicated, so I thought I'm doing it wrong and there must be a simpler way.

RobinLinus avatar Oct 22 '22 15:10 RobinLinus

This was my start last week, but unfortunately, I didn't have much time: https://github.com/crapstones-forks/snapdrop/blob/feature/rust-server/server-rs/src/main.rs

crapStone avatar Oct 22 '22 15:10 crapStone

Thank you @crapStone ! tokio-tungstenite looks like a good alternative to warp. Looks like you can simply access the client's IP from the TcpStream object.

RobinLinus avatar Oct 22 '22 15:10 RobinLinus

That was my idea too. I hope I have to work on it again later today.

crapStone avatar Oct 22 '22 15:10 crapStone

I just opened a preliminary PR. It still takes a lot of work to be on par with the original implementation, but I wanted to track the progress and give you a chance to give feedback.

crapStone avatar Oct 25 '22 14:10 crapStone