This commit is contained in:
evilsocket 2018-02-08 05:27:36 +01:00
commit a2a7d43c80

View file

@ -54,23 +54,22 @@ func (f WindowsFirewall) EnableForwarding(enabled bool) error {
func (f WindowsFirewall) generateRule(r *Redirection, enabled bool) []string { func (f WindowsFirewall) generateRule(r *Redirection, enabled bool) []string {
rule := []string{ rule := []string{
fmt.Sprintf("listenport=%d", r.SrcPort), fmt.Sprintf("listenport=%d", r.DstPort),
} }
if enabled == true { if enabled == true {
rule = append(rule, fmt.Sprintf("protocol=%s", r.Protocol)) rule = append(rule, fmt.Sprintf("protocol=%s", r.Protocol))
rule = append(rule, fmt.Sprintf("connectport=%d", r.DstPort)) rule = append(rule, fmt.Sprintf("connectport=%d", r.SrcPort))
/*
if r.SrcAddress != "" { if r.SrcAddress != "" {
rule = append(rule, fmt.Sprintf("connectaddress=%s", r.SrcAddress)) rule = append(rule, fmt.Sprintf("connectaddress=%s", r.SrcAddress))
} else { } else {
// rule = append(rule, fmt.Sprintf("connectaddress=%s", r.DstAddress)) rule = append(rule, fmt.Sprintf("connectaddress=%s", r.SrcAddress))
}*/ }
} }
if r.DstAddress != "" { if r.DstAddress != "" {
rule = append(rule, fmt.Sprintf("connectaddress=%s", r.DstAddress)) rule = append(rule, fmt.Sprintf("listenaddress=%s", r.DstAddress))
} }
return rule return rule