Working on portmaster restructure

This commit is contained in:
Daniel
2018-11-29 18:44:31 +01:00
parent be8a1d1739
commit 3990790f17
26 changed files with 351 additions and 263 deletions

View File

@@ -25,7 +25,7 @@ type Intel struct {
}
func makeIntelKey(domain string) string {
return fmt.Sprintf("intel:Intel/%s", domain)
return fmt.Sprintf("cache:intel/domain/%s", domain)
}
// GetIntelFromDB gets an Intel record from the database.

View File

@@ -26,7 +26,7 @@ type IPInfo struct {
}
func makeIPInfoKey(ip string) string {
return fmt.Sprintf("intel:IPInfo/%s", ip)
return fmt.Sprintf("cache:intel/ipInfo/%s", ip)
}
// GetIPInfo gets an IPInfo record from the database.

View File

@@ -3,26 +3,18 @@ package intel
import (
"github.com/miekg/dns"
"github.com/Safing/portbase/database"
"github.com/Safing/portbase/log"
"github.com/Safing/portbase/modules"
// module dependencies
_ "github.com/Safing/portmaster/global"
)
func init() {
modules.Register("intel", prep, start, nil, "database")
modules.Register("intel", prep, start, nil, "global")
}
func start() error {
_, err := database.Register(&database.Database{
Name: "intel",
Description: "Intelligence and DNS Data",
StorageType: "badger",
PrimaryAPI: "",
})
if err != nil {
return err
}
// load resolvers from config and environment
loadResolvers(false)

View File

@@ -30,7 +30,7 @@ type NameRecord struct {
}
func makeNameRecordKey(domain string, question string) string {
return fmt.Sprintf("intel:NameRecords/%s%s", domain, question)
return fmt.Sprintf("cache:intel/nameRecord/%s%s", domain, question)
}
// GetNameRecord gets a NameRecord from the database.