From 3b6279ddf21ca58b8cf9469c04a249d69ea449cb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Apr 2018 16:28:37 -0400 Subject: add comments, fiddle with function publicity --- tinc.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tinc.go') 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"] { -- cgit v1.2.3