Satisfying staticcheck linter

This commit is contained in:
Cuong Manh Le
2023-08-10 00:22:57 +07:00
committed by Cuong Manh Le
parent 5dd6336953
commit d292e03d1b
8 changed files with 18 additions and 49 deletions

View File

@@ -1,6 +1,7 @@
package router
import (
"bytes"
"fmt"
"net"
"os"
@@ -116,6 +117,11 @@ func (or *osRouter) Cleanup() error {
return nil
}
func isPfsense() bool {
b, err := os.ReadFile("/etc/platform")
return err == nil && bytes.HasPrefix(b, []byte("pfSense"))
}
const bsdInitScript = `#!/bin/sh
# PROVIDE: {{.Name}}

View File

@@ -93,8 +93,7 @@ func IsOldOpenwrt() bool {
var routerPlatform atomic.Pointer[router]
type router struct {
name string
sendClientInfo bool
name string
}
// Name returns name of the router platform.
@@ -241,8 +240,3 @@ func unameU() []byte {
out, _ := exec.Command("uname", "-u").Output()
return out
}
func isPfsense() bool {
b, err := os.ReadFile("/etc/platform")
return err == nil && bytes.HasPrefix(b, []byte("pfSense"))
}