Closed wheat0r closed 1 year ago
Thanks for the feature request! Do you have a specific idea of how you'd like to configure this? Or what an example interface config might look like?
Thanks for the feature request! Do you have a specific idea of how you'd like to configure this? Or what an example interface config might look like?
A proxy project named clash (closed source version) generates a TUN interface and hijacks all outbound traffic with eBPF rules.
I think caddy-dynamicdns may have a ip_source interface [interface name]
option to choose the specific interface.
Then golang's net module should get address on interface.
I'm not a programmer, so that I cannot describe the detail how it works.
Thanks, what would be the example of an interface name in your case? I'm not sure Go would magically know how to get the address from that interface, so I'd probably need to implement that logic, but I'm not familiar with TUN.
Thanks, what would be the example of an interface name in your case? I'm not sure Go would magically know how to get the address from that interface, so I'd probably need to implement that logic, but I'm not familiar with TUN.
TUN interface name is various, because it's virtual. In my case, it should get address from physical interface like: ethX/enoX, not TUN. I don't know if there was a interface name parameter in golang's net module or had to look all interfaces up, and check which is physical interface by script.
@wheat0r would you be willing to try out https://github.com/mholt/caddy-dynamicdns/pull/38? You can build from that branch with:
xcaddy build --with github.com/mholt/caddy-dynamicdns=github.com/francislavoie/caddy-dynamicdns@net-interface-source
In my case, the host running caddy has a complex network setting. And all traffic outbound will be routed to TUN interface by default, that would lead to a wrong result when simple_http or upnp. But physical interface has a dynamic address which is accessible from internet. If there would be a option to use address on specific interface directly.