Open dvsekhvalnov opened 1 year ago
I could understand your situation.
PreStart, PostStart, PreExit, PostExit hooks could be done easily by wrapping sslocal
with a shell script, so it doesn't need any modification of sslocal
itself.
Just arbitrary shell commands to execute before/after establishing/terminating connection to remote ssserver.
Hmm, this would be a lot more complicated. Just a quick thought:
Drop
trait (destructor) implementation of TcpStream
and UdpSocket
, but Drop
trait doesn't support async fn
, so it can only be a blocking call.socket
is close()
d in other libraries.What would be the best way to implement hooks?
It looks very complicated. I don't know if there is any other more elegant ways.
PreStart, PostStart, PreExit, PostExit hooks could be done easily by wrapping sslocal with a shell script, so it doesn't need any modification of sslocal itself.
well, kind of easily. You typically would like to set gateway rule before sslocal start (to let it connect). Then routing all traffic to TUN after it starts (otherwise you missing TUN interface yet). So it takes some gymnastics to run sslocal in background, propagiting kill signals, e.t.c. Not a rocket science but can be simpler :)
I can't advise on how to do it best with codebase, haven't really dig it. But i think spawning shell process will be most flexible.
I also don't think you should care much whether it's blocking or not, because it's for local client only - only affects user who doing it. If you do something slow - that's fine, it affects only you, you can change it back or whatever.
mari12231
Hey guys, may i request small feature. In a vein of openvpn or wireguard, will it be possible to have:
PreStart, PostStart, PreExit, PostExit hooks (may be others) for sslocal ? Just arbitrary shell commands to execute before/after establishing/terminating connection to remote ssserver.
Will make routing tables setup so much simpler for local-tun feature.
Will greatly appreciate.