0

So I've seen projects like trojan-go,v2ray-go They are making their own proxy protocols in user space level. I am trying to do the same thing but I don't know how to redirect network traffic from clients to proxy server.

Basically I don't understand how those tools (or any tool) can redirect internet traffic of the device to a certain server, so when the packets are going to the internet they go to the proxy server first instead of their destination ip address.

How can I do it in golang without dealing with netlink and Iptables? I know apps like wireguard do this by dealing with layer 3-4 stuff using netlink API but I need to know how apps do it without adding a new network interface.

danial dehvan
  • 187
  • 1
  • 15
  • 1
    "How can I do it in golang without dealing with netlink and Iptables?" You can't. You have to convince the OS to re-route some or all traffic. To do that you have to use the facilities provided by the OS. – Peter Dec 06 '22 at 17:15
  • 1
    Do note that Go packages that wrap netlink exist, though. So you can certainly write a Go problem that sets this stuff up, but it will still call kernel APIs. – Peter Dec 06 '22 at 17:17

0 Answers0