summaryrefslogtreecommitdiff
path: root/tinc.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-04-18 16:28:37 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2018-04-18 16:28:37 -0400
commit3b6279ddf21ca58b8cf9469c04a249d69ea449cb (patch)
treedbbe3febfc4d4aa889fee787d4d934b9f4720d07 /tinc.go
parent45717808e4c8861e022e838aacb8215c81dcd327 (diff)
add comments, fiddle with function publicity
Diffstat (limited to 'tinc.go')
-rw-r--r--tinc.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/tinc.go b/tinc.go
index 1bfefc6..d06a6d2 100644
--- a/tinc.go
+++ b/tinc.go
@@ -7,6 +7,7 @@ import (
"strings"
)
+// Error is a parse error recording the filename and line number.
type Error struct {
File string
Line int
@@ -38,7 +39,10 @@ func parseConfigLine(line string) (key, val string) {
return variable, value
}
-func readConfigFile(fname string) (map[string][]string, error) {
+// ReadConfigFile opens and reads a Tinc configuration file, returning
+// a map of settings. Since Tinc setting names are case-insensitive,
+// the keys in the map are all lower-case.
+func ReadConfigFile(fname string) (map[string][]string, error) {
config_tree := make(map[string][]string)
fp, err := os.Open(fname)
@@ -89,9 +93,9 @@ func readConfigFile(fname string) (map[string][]string, error) {
return config_tree, nil
}
-// Returns a list of public addresses for a host-config in Go
-// "net.Dial" format.
-func getAddresses(cfg map[string][]string) []struct{ Node, Port string } {
+// GetAddresses inspects a tinc host-confing settings object and
+// returns a list of public addresses in it.
+func GetAddresses(cfg map[string][]string) []struct{ Node, Port string } {
var result []struct{ Node, Port string }
for _, node := range cfg["address"] {