cmd,pkg: fix lint warnings

Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
This commit is contained in:
Lucas Servén Marín
2022-05-05 11:16:20 +02:00
parent a8568c7399
commit 6ab3c009c7
4 changed files with 7 additions and 18 deletions

View File

@@ -61,7 +61,6 @@ type Mesh struct {
ipTables *iptables.Controller
kiloIface int
kiloIfaceName string
key []byte
local bool
port int
priv wgtypes.Key
@@ -94,6 +93,9 @@ func New(backend Backend, enc encapsulation.Encapsulator, granularity Granularit
return nil, fmt.Errorf("failed to create directory to store configuration: %v", err)
}
privateB, err := ioutil.ReadFile(privateKeyPath)
if err != nil && !os.IsNotExist(err) {
return nil, fmt.Errorf("failed to read private key file: %v", err)
}
privateB = bytes.Trim(privateB, "\n")
private, err := wgtypes.ParseKey(string(privateB))
if err != nil {

View File

@@ -16,7 +16,6 @@ package mesh
import (
"net"
"strings"
"testing"
"time"
@@ -27,10 +26,6 @@ import (
"github.com/squat/kilo/pkg/wireguard"
)
func allowedIPs(ips ...string) string {
return strings.Join(ips, ", ")
}
func mustParseCIDR(s string) (r net.IPNet) {
if _, ip, err := net.ParseCIDR(s); err != nil {
panic("failed to parse CIDR")