summaryrefslogtreecommitdiff
path: root/tinc.go
diff options
context:
space:
mode:
Diffstat (limited to 'tinc.go')
-rw-r--r--tinc.go16
1 files changed, 3 insertions, 13 deletions
diff --git a/tinc.go b/tinc.go
index 76857cb..1bfefc6 100644
--- a/tinc.go
+++ b/tinc.go
@@ -3,7 +3,6 @@ package main
import (
"bufio"
"fmt"
- "net"
"os"
"strings"
)
@@ -92,8 +91,8 @@ func readConfigFile(fname string) (map[string][]string, error) {
// Returns a list of public addresses for a host-config in Go
// "net.Dial" format.
-func getAddresses(cfg map[string][]string) []string {
- var result []string
+func getAddresses(cfg map[string][]string) []struct{ Node, Port string } {
+ var result []struct{ Node, Port string }
for _, node := range cfg["address"] {
var port string
@@ -109,17 +108,8 @@ func getAddresses(cfg map[string][]string) []string {
node = node[:space]
}
- if isIPv6(node) {
- result = append(result, fmt.Sprintf("[%s]:%s", node, port))
- } else {
- result = append(result, fmt.Sprintf("%s:%s", node, port))
- }
+ result = append(result, struct{ Node, Port string }{node, port})
}
return result
}
-
-func isIPv6(node string) bool {
- ip := net.ParseIP(node)
- return ip != nil && ip.To4() == nil
-}