xtaci / kcptun

A Quantum-Safe Secure Tunnel based on QPP, KCP, FEC, and N:M multiplexing.
MIT License
13.81k stars 2.53k forks source link

Please add udp transparent packages such as dns udp packages #917

Open peterwillcn opened 1 year ago

peterwillcn commented 1 year ago

Default packaging TCP ->kcp (udp) ->TCP

aguegu commented 1 year ago

It would be great to have.

otherwise the walk around would look like udp -> udptunnel(tcp) -> kcp(udp) -> udptunnel(tcp) -> udp

xtaci commented 1 year ago

to bind a single UDP port on client side to external server port via server?

xtaci commented 1 year ago

It seems this feature is not useful if we can only do remote port forwarding on a SINGLE port

xtaci commented 1 year ago

An ideal solution is to create tun devices between client and server, by manipulation of iptables, all UDP packets could be carried to remote server, and then the remote server could initates connection pairs to any endpoints and then forward back packets.

aguegu commented 1 year ago

kcptun with multi-port support is quite powerful. But wireguard does not have this feature yet.

xtaci commented 1 year ago

The question is , How users will use this UDP port forward feature. All I know iss that, for me ,single port forwarding is not useful.

aguegu commented 1 year ago

wireguard does not tunnel over TCP

To build an Wireguard virtual lan, in the endpoint configuration, it is usually set to an public ip with an UDP port, on which the remote wireguard listen to.

But I notices that a static UDP port configured got to be blocked (by you know what) after a few hours. Then I would have to change the configuration. So I think it would be great if I could empower wireguard with kcptun and its port range feature.

xtaci commented 1 year ago

https://www.jianshu.com/p/55c0259d1a36

https://develop.socks-proto.cpp.al/socks/protocol/requests_and_replies/udp_associate.html

https://ph4ntonn.github.io/Socks5-UDP

A possible solution is UDP Associate

maybe ss-libev(UDP) -> client(UDP) -> KCP packets -> server(UDP) -> ss-libev(UDP) -> UDP packets is feasible.

xtaci commented 1 year ago

So, do you guys think supporting carrying packets of "single port UDP Associate" could satisfy the requirements?

xtaci commented 1 year ago

that seems solved the problem, an external UDP to TCP protocol conversion seems simple and elegant. One only have to start another kcp instance pair.

xtaci commented 1 year ago

The issue is compatibility, I have to implement a special smux stream inside kcp channel, this smux stream could be identified by kcp server easily, such as inserting a magic number of 16 Bytes at the beginning of the stream. Meanwhile, on the kcp server side, this magic stream must be identified by the program to be treated as UDP forwarding packets streams.

And the changes above is not compatible with previous versions.

xtaci commented 1 year ago

By adding an extra parameter -enableUDP is sufficient, program can bind UDP+TCP on the same port.

But the development needs some time, I can only work on this feature when I'm free.

But suggestions are appreciated.

xtaci commented 1 year ago

If someone willing to implement a Proof of Concept UDP stream, I'm willing to participate.

kokrange commented 1 year ago

that seems solved the problem, an external UDP to TCP protocol conversion seems simple and elegant. One only have to start another kcp instance pair.

Which udp to tcp conversion tool do you suggest? I have tried udp2raw and datagramTunneler, but both don't seem to work on kcptun tcp-over-udp tunneling.

omaidb commented 1 year ago

kcptun 具有多端口支持,功能相当强大。但wireguard还没有这个功能。

多端口支持,请给一个json配置文件的示例

omaidb commented 1 year ago

By adding an extra parameter -enableUDP is sufficient, program can bind UDP+TCP on the same port.

But the development needs some time, I can only work on this feature when I'm free.

But suggestions are appreciated.

期待这个功能。

omaidb commented 1 year ago

如果有人愿意实施概念验证 UDP 流,我愿意参与。

我尽可能的来参与验证这个功能

cnbatch commented 1 year ago

我用原版KCP试了下,转发UDP完全没问题,高流量时速率十分稳定,流量曲线比TCP更加平滑。 同一条KCP通道混合传输TCP与UDP做起来很麻烦(我觉得麻烦,其他人应该有简便高效的办法),分开通道效果最好。

只不过我是用C++做的,并且写得版面混乱,冗余代码一堆,对于Golang项目而言可能没什么帮助。 如果确实想看代码,可以来我的用户主页进入相应仓库。