Skip to content
This repository has been archived by the owner on Dec 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #8 from Amnesic-Systems/toggle-nat
Browse files Browse the repository at this point in the history
Toggle NAT when starting.
  • Loading branch information
NullHypothesis authored Nov 16, 2024
2 parents 29f0303 + 3014acc commit a76261b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit a76261b

Please sign in to comment.