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

Listen for transit protocol on the receiving side #57

Open Enrico204 opened 2 years ago

Enrico204 commented 2 years ago

Does wormhole-william supports listening on the receiving side for direct-tcp-v1 connections? By looking at the code it seems that direct-tcp-v1 are supported only when wormhole-william is sending a file

psanford commented 2 years ago

Currently wormhole-william only listens for direct connections on the sending side, and only try's to establish direct connections from the receiving side. I think this was an intentional simplification, but its also possible it was an oversight at the time.

My intuition is that most users are either on the same network, or both behind a NAT, which is why I suspect this hasn't come up until now.

Adding support for this seems reasonable.

Enrico204 commented 2 years ago

I think that your intuition is good - many IPv4 connections are NATted today, and many IPv6 connections are not accepting inbound connections to any ports, by default.

I can try to add this feature in a pull request, if you like :-)

piegamesde commented 2 years ago

I think the intuition breaks when one of the sides is behind a public IP address and the other not (for example, when sending data from/to a server). There are also other cases involving firewalls (one device has one and the other doesn't), but actually it doesn't matter that much anymore:

I have worked on some improvements of the connection finding (currently prototyped in Rust). It now does firewall hole punching and NAT traversal, reliably connecting almost any two peers across the internet. I will document it in the protocols very soon. Those changes most probably will require non-trivial refactoring. So I suggest waiting for that, because any efforts that come before this will probably be obsolete by then.

piegamesde commented 2 years ago

There you go: https://github.com/magic-wormhole/magic-wormhole-protocols/pull/16

@Enrico204 I'd be really interested in your feedback from an implementor's point of view, so please let me know if the text still leaves any questions open.