mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 13:33:21 -07:00
refact: refactored several strings.Trim calls to core.Trim
This commit is contained in:
parent
5189068cd3
commit
ca9f4f0945
10 changed files with 35 additions and 23 deletions
|
@ -151,13 +151,13 @@ func (f PfFirewall) EnableRedirection(r *Redirection, enabled bool) error {
|
|||
lines := ""
|
||||
scanner := bufio.NewScanner(fd)
|
||||
for scanner.Scan() {
|
||||
line := strings.Trim(scanner.Text(), "\r\n\t ")
|
||||
line := core.Trim(scanner.Text())
|
||||
if line != rule {
|
||||
lines += line + "\n"
|
||||
}
|
||||
}
|
||||
|
||||
if strings.Trim(lines, "\r\n\t ") == "" {
|
||||
if core.Trim(lines) == "" {
|
||||
os.Remove(f.filename)
|
||||
f.enable(false)
|
||||
} else {
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/evilsocket/bettercap-ng/core"
|
||||
)
|
||||
|
@ -57,7 +56,7 @@ func (f LinuxFirewall) IsForwardingEnabled() bool {
|
|||
if out, err := ioutil.ReadFile(IPV4ForwardingFile); err != nil {
|
||||
return false
|
||||
} else {
|
||||
return strings.Trim(string(out), "\r\n\t ") == "1"
|
||||
return core.Trim(string(out)) == "1"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue