Loop on errors, rather than failing

This commit is contained in:
bluepython508
2025-10-13 10:06:56 +01:00
parent 443123667f
commit dbb0a5d42b

10
main.go
View File

@@ -35,10 +35,10 @@ func Forward(server *tsnet.Server, proto, port, dst string, finish chan error) {
if err != nil {
finish <- err
}
defer ln.Close()
err = netforward.Forward(Dialer { proto: proto, addr: dst }, ln)
if err != nil {
finish <- err
defer ln.Close();
for true {
err = netforward.Forward(Dialer { proto: proto, addr: dst }, ln);
log.Print(err);
}
}
@@ -64,6 +64,4 @@ func main() {
proto, port, dst := args[0], args[1], args[2]
go Forward(s, proto, port, dst, err_chan);
}
err := <- err_chan
log.Fatal(err)
}