mirror of
https://github.com/speatzle/nfsense.git
synced 2025-06-28 07:19:37 +00:00
fix nat action generation
This commit is contained in:
parent
25b230e9c2
commit
f2c9a8acc4
1 changed files with 11 additions and 1 deletions
|
@ -28,12 +28,17 @@ func GenerateDestinationNatAction(conf config.Config, rule firewall.DestinationN
|
|||
panic("invalid service type")
|
||||
}
|
||||
}
|
||||
// TODO if the destination is ip v6 use ip6 instead of ip here
|
||||
if rule.Address != nil {
|
||||
return "dnat ip to " + destination
|
||||
}
|
||||
// ip or ip6 are not needed if the addresses is not changed
|
||||
return "dnat to " + destination
|
||||
}
|
||||
|
||||
func GenerateSourceNatAction(conf config.Config, rule firewall.SourceNATRule) string {
|
||||
if rule.Type == firewall.Masquerade {
|
||||
return "masqerade"
|
||||
return "masquerade"
|
||||
}
|
||||
|
||||
source := ""
|
||||
|
@ -60,5 +65,10 @@ func GenerateSourceNatAction(conf config.Config, rule firewall.SourceNATRule) st
|
|||
}
|
||||
}
|
||||
|
||||
// TODO if the destination is ip v6 use ip6 instead of ip here
|
||||
if rule.Address != nil {
|
||||
return "snat ip to " + source
|
||||
}
|
||||
// ip or ip6 are not needed if the addresses is not changed
|
||||
return "snat to " + source
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue