pull/41/head
xSmurf 8 years ago
parent 55ee3ad83d
commit c5b8dcb660

@ -27,7 +27,7 @@ func loadConfig(win *gtk.Window, b *builder, dbus *dbusObject) {
} }
if lvl, ok := conf["log_level"].(int32); ok { if lvl, ok := conf["log_level"].(int32); ok {
if id, ok := sgfw.LevelToId[lvl]; ok { if id, ok := sgfw.LevelToID[lvl]; ok {
levelCombo.SetActiveID(id) levelCombo.SetActiveID(id)
} }
} }
@ -45,7 +45,7 @@ func loadConfig(win *gtk.Window, b *builder, dbus *dbusObject) {
} }
b.ConnectSignals(map[string]interface{}{ b.ConnectSignals(map[string]interface{}{
"on_level_combo_changed": func() { "on_level_combo_changed": func() {
if lvl, ok := sgfw.IdToLevel[levelCombo.GetActiveID()]; ok { if lvl, ok := sgfw.IDToLevel[levelCombo.GetActiveID()]; ok {
dbus.setConfig("log_level", lvl) dbus.setConfig("log_level", lvl)
} }
}, },

@ -14,7 +14,7 @@ type dnsCache struct {
done chan struct{} done chan struct{}
} }
func NewDnsCache() *dnsCache { func newDnsCache() *dnsCache {
return &dnsCache{ return &dnsCache{
ipMap: make(map[string]string), ipMap: make(map[string]string),
done: make(chan struct{}), done: make(chan struct{}),

@ -8,7 +8,8 @@ import (
"github.com/op/go-logging" "github.com/op/go-logging"
) )
var LevelToId = map[int32]string{ // Log level conversion map
var LevelToID = map[int32]string{
int32(logging.ERROR): "error", int32(logging.ERROR): "error",
int32(logging.WARNING): "warning", int32(logging.WARNING): "warning",
int32(logging.NOTICE): "notice", int32(logging.NOTICE): "notice",
@ -16,9 +17,10 @@ var LevelToId = map[int32]string{
int32(logging.DEBUG): "debug", int32(logging.DEBUG): "debug",
} }
var IdToLevel = func() map[string]int32 { // Log level string conversion
var IDToLevel = func() map[string]int32 {
m := make(map[string]int32) m := make(map[string]int32)
for k, v := range LevelToId { for k, v := range LevelToID {
m[v] = k m[v] = k
} }
return m return m

@ -130,7 +130,7 @@ func Main() {
fw := &Firewall{ fw := &Firewall{
dbus: ds, dbus: ds,
dns: NewDnsCache(), dns: newDnsCache(),
enabled: true, enabled: true,
logBackend: logBackend, logBackend: logBackend,
policyMap: make(map[string]*Policy), policyMap: make(map[string]*Policy),

Loading…
Cancel
Save