psanford / wormhole-william

End-to-end encrypted file transfer. A magic wormhole CLI and API in Go (golang).
MIT License
1.08k stars 55 forks source link

Sending text does not run WithProgress send option #21

Closed Jacalz closed 3 years ago

Jacalz commented 3 years ago

Sending text does not seem to update WithProgress SendOption if it is provided. This leads to progress bars not updating like they should. This was initially reported https://github.com/Jacalz/wormhole-gui/issues/2 and later fixed with https://github.com/Jacalz/wormhole-gui/commit/ae4d3142028d51cfd0e987653e181c5974c32b11 by manually updating progress on my side.

I have now replicated the same issue in a test application that I wrote to make sure that the issue wasn't in my application.

psanford commented 3 years ago

SendText uses the rendezvous server's mailbox to also send the encrypted message (with the assumption that the text you are sending is small). Sending files and directories establishes a transit connection (either directly or through a relay server). When using the transit protocol we can measure the send progress based on the rate at which we are able to write the message. That doesn't work for SendText because we can't detect the progress of the receiver reading the message.

This is a limitation of the non-transit mode of the protocol. Magic Wormhole and wormhole-william don't show a progress bar for text mode because of this.

Jacalz commented 3 years ago

Thanks for the explanation. Couldn't you manually just call the send option function when the send completes and then pass a total that is as big as the sent int64? This would make the SendOption be more useful than doing nothing. Currently there seems to be no reference in the docs on pkg.go.dev that this is the behaviour.

psanford commented 3 years ago

That sounds reasonable. Reopening to track.

Jacalz commented 3 years ago

Thanks for fixing this :)