feat(gocast_nat): Add listen port option
This commit is contained in:
@@ -86,10 +86,10 @@ func deleteLoopback(addr *net.IPNet) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func natRule(op string, vip, localAddr net.IP, protocol, port string) error {
|
||||
func natRule(op string, vip, localAddr net.IP, protocol, lport, dport string) error {
|
||||
cmd := fmt.Sprintf(
|
||||
"iptables -t nat -%s PREROUTING -p %s -d %s --dport %s -j DNAT --to-destination %s:%s",
|
||||
op, protocol, vip.String(), port, localAddr.String(), port,
|
||||
op, protocol, vip.String(), lport, localAddr.String(), dport,
|
||||
)
|
||||
cmdList := getCmdList(cmd)
|
||||
_, err := exec.Command(execCmd, cmdList...).Output()
|
||||
|
||||
Reference in New Issue
Block a user