rathole icon indicating copy to clipboard operation
rathole copied to clipboard

[Feature Request] One service forwards tcp and udp at the same time

Open chengziorange opened this issue 3 years ago • 4 comments
trafficstars

When I want to expose a port at local machine listening both tcp and udp, I have to write two services in the config file like this:

[client.services.service1_tcp]
type = "tcp"
token = "whatever"
local_addr = "127.0.0.1:1081"

[client.services.service1_udp]
type = "udp"
token = "whatever"
local_addr = "127.0.0.1:1081"

and do the same thing on the server side. I think a better way could be like this:

[client.services.service1]
type = "tcp,udp" # Possible values: ["tcp", "udp", "tcp,udp"]
token = "whatever"
local_addr = "127.0.0.1:1081"

the above two config do the same thing, but the latter is more consice

chengziorange avatar May 12 '22 15:05 chengziorange

Just wonder in which situation do you need to expose both TCP and UDP ports? UDP & TCP are fundamentally different protocols and the port numbers are not shared either. The tcp, udp type doesn't really make sense to me.

After some research I found that some protocols from the windows world use both udp and tcp in the same time😇, such as smb, rdp. Maybe we should propose a better name for this. tcp,udp is not a good name IMO.

Enter-tainer avatar May 14 '22 17:05 Enter-tainer

Yes, tcp,udp is just something that came up to me to express its meaning. Maybe both or all is a better option.

Besides I got the idea because I'm playing a game that running game server requires both tcp and udp.
Ref. https://mindustrygame.github.io/wiki/servers/#running-a-dedicated-server-at-home
It's a good game btw.😋

chengziorange avatar May 17 '22 05:05 chengziorange

Syncthing also requires TCP and UDP on the same port. https://docs.syncthing.net/users/firewall.html

dannykorpan avatar Feb 06 '23 08:02 dannykorpan

@rapiz1 Sorry for being incredibly naive here. I had a look through the code and it seems that UDP and TCP are being handled practically entirely separately. Am I right to assume that implementing this feature would be non-trivial and require major rework of the code? I'd love to have a got at implementing this myself, but as I'm a novice when it comes to Rust I don't want to start digging for solutions if I'm guaranteed to dig my own grave in the process so to speak.

scriptcoded avatar Apr 18 '23 18:04 scriptcoded