You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
466 B
32 lines
466 B
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io/ioutil"
|
|
)
|
|
|
|
func LoadConfig(path string) (*Configuration, error) {
|
|
data, err := ioutil.ReadFile(path)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
var c Configuration
|
|
if err := json.Unmarshal(data, &c); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &c, nil
|
|
}
|
|
|
|
type Configuration struct {
|
|
Upstream []string
|
|
Blocklists []string
|
|
Records map[string]ConfigRecord
|
|
}
|
|
|
|
type ConfigRecord struct {
|
|
Type string
|
|
Record string
|
|
}
|