From 3014acc20033cff94dfe3153336f825b2b105e21 Mon Sep 17 00:00:00 2001 From: Philipp Winter Date: Sat, 16 Nov 2024 11:00:46 -0600 Subject: [PATCH] Toggle NAT when starting. ...for some reason, the function wasn't called (anymore). --- cmd/main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmd/main.go b/cmd/main.go index 5ce793f..50b649c 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -106,6 +106,16 @@ func main() { l.Fatalf("Flag -port must be in interval [1, %d].", math.MaxUint32) } + l.Print("Enabling NAT.") + if err := proxy.ToggleNAT(proxy.On); err != nil { + l.Fatalf("Error enabling NAT: %v", err) + } + defer func() { + if err := proxy.ToggleNAT(proxy.Off); err != nil { + l.Printf("Error disabling NAT: %v", err) + } + }() + ln = listenVSOCK(uint32(port)) defer ln.Close()