fix: gracefully handling corrupted or not compatible alias databases (fixes #391)

This commit is contained in:
evilsocket 2018-11-22 13:06:29 +01:00
commit 85c2d0b4fa
No known key found for this signature in database
GPG key ID: 1564D7F30393A456

View file

@ -2,6 +2,7 @@ package network
import ( import (
"encoding/json" "encoding/json"
"fmt"
"net" "net"
"strings" "strings"
"sync" "sync"
@ -36,7 +37,7 @@ type lanJSON struct {
func NewLAN(iface, gateway *Endpoint, newcb EndpointNewCallback, lostcb EndpointLostCallback) *LAN { func NewLAN(iface, gateway *Endpoint, newcb EndpointNewCallback, lostcb EndpointLostCallback) *LAN {
aliases, err := data.NewUnsortedKV(aliasesFileName, data.FlushOnEdit) aliases, err := data.NewUnsortedKV(aliasesFileName, data.FlushOnEdit)
if err != nil { if err != nil {
panic(err) fmt.Printf("error loading %s: %s", aliasesFileName, err)
} }
return &LAN{ return &LAN{