mirror of
https://github.com/bettercap/bettercap
synced 2025-07-15 01:23:42 -07:00
more lint driven refactoring
This commit is contained in:
parent
0de6f3a76e
commit
1afab5d7be
7 changed files with 19 additions and 26 deletions
|
@ -12,11 +12,11 @@ import (
|
|||
)
|
||||
|
||||
// only matches gateway lines
|
||||
var IPv4RouteParser = regexp.MustCompile("^(default|[0-9\\.]+)\\svia\\s([0-9\\.]+)\\sdev\\s(\\w+)\\s.*$")
|
||||
var IPv4RouteParser = regexp.MustCompile(`^(default|[0-9\.]+)\svia\s([0-9\.]+)\sdev\s(\w+)\s.*$`)
|
||||
var IPv4RouteTokens = 4
|
||||
var IPv4RouteCmd = "ip"
|
||||
var IPv4RouteCmdOpts = []string{"route"}
|
||||
var WiFiFreqParser = regexp.MustCompile("^\\s+Channel.([0-9]+)\\s+:\\s+([0-9\\.]+)\\s+GHz.*$")
|
||||
var WiFiFreqParser = regexp.MustCompile(`^\s+Channel.([0-9]+)\s+:\s+([0-9\.]+)\s+GHz.*$`)
|
||||
|
||||
func IPv4RouteIsGateway(ifname string, tokens []string, f func(gateway string) (*Endpoint, error)) (*Endpoint, error) {
|
||||
ifname2 := tokens[3]
|
||||
|
@ -54,7 +54,7 @@ func GetSupportedFrequencies(iface string) ([]int, error) {
|
|||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
matches := WiFiFreqParser.FindStringSubmatch(line)
|
||||
if matches != nil && len(matches) == 3 {
|
||||
if len(matches) == 3 {
|
||||
if freq, err := strconv.ParseFloat(matches[2], 64); err == nil {
|
||||
freqs = append(freqs, int(freq*1000))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue