diff options
Diffstat (limited to 'config.go')
-rw-r--r-- | config.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/config.go b/config.go new file mode 100644 index 0000000..8a11d58 --- /dev/null +++ b/config.go @@ -0,0 +1,25 @@ +package main + +import ( + "encoding/json" + "os" +) + +type config struct { + User string + Passwd string + Link string + PrefixLen int + Records4 []int + Records6 []int +} + +func (c *config) parse(location string) error { + f, err := os.Open(location) + if err != nil { + return err + } + defer f.Close() + + return json.NewDecoder(f).Decode(c) +} |