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 { if err != nil {
finish <- err finish <- err
} }
defer ln.Close() defer ln.Close();
err = netforward.Forward(Dialer { proto: proto, addr: dst }, ln) for true {
if err != nil { err = netforward.Forward(Dialer { proto: proto, addr: dst }, ln);
finish <- err log.Print(err);
} }
} }
@@ -64,6 +64,4 @@ func main() {
proto, port, dst := args[0], args[1], args[2] proto, port, dst := args[0], args[1], args[2]
go Forward(s, proto, port, dst, err_chan); go Forward(s, proto, port, dst, err_chan);
} }
err := <- err_chan
log.Fatal(err)
} }