This commit is contained in:
evilsocket 2018-02-11 00:51:12 +01:00
parent 8fbf32aacd
commit 9ed70d6d90

View file

@ -53,18 +53,26 @@ 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{ return []string{
"listenaddress=0.0.0.0",
fmt.Sprintf("listenport=%d", r.SrcPort), fmt.Sprintf("listenport=%d", r.SrcPort),
fmt.Sprintf("connectport=%d", r.DstPort),
fmt.Sprintf("connectaddress=%s", r.DstAddress),
fmt.Sprintf("protocol=%s", r.Protocol),
} }
/*
rule := []string{
"listenaddress=0.0.0.0",
fmt.Sprintf("listenport=%d", r.SrcPort),
}
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.DstPort))
rule = append(rule, fmt.Sprintf("connectaddress=%s", r.DstAddress)) rule = append(rule, fmt.Sprintf("connectaddress=%s", r.DstAddress))
} }
return rule return rule
*/
} }
func (f *WindowsFirewall) AllowPort(port int, address string, proto string, allow bool) error { func (f *WindowsFirewall) AllowPort(port int, address string, proto string, allow bool) error {