summaryrefslogtreecommitdiff
path: root/listeners.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-12-06 12:00:04 -0700
committerMatthew Holt <mholt@users.noreply.github.com>2019-12-06 12:00:04 -0700
commitb07f6958aca4e275ff1d1aebabd0eef0e0e4b330 (patch)
tree318798300360e95655f76b8fd8839aa52916075f /listeners.go
parent33a318d17341fcaa95551710620540e00b0bb4b0 (diff)
Use "IsUnixNetwork" function instead of repeating the logic
Diffstat (limited to 'listeners.go')
-rw-r--r--listeners.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/listeners.go b/listeners.go
index e52561d..f20d56c 100644
--- a/listeners.go
+++ b/listeners.go
@@ -360,7 +360,7 @@ func SplitNetworkAddress(a string) (network, host, port string, err error) {
network = strings.ToLower(strings.TrimSpace(a[:idx]))
a = a[idx+1:]
}
- if network == "unix" || network == "unixgram" || network == "unixpacket" {
+ if isUnixNetwork(network) {
host = a
return
}
@@ -369,8 +369,9 @@ func SplitNetworkAddress(a string) (network, host, port string, err error) {
}
// JoinNetworkAddress combines network, host, and port into a single
-// address string of the form accepted by ParseNetworkAddress(). For unix sockets, the network
-// should be "unix" and the path to the socket should be given as the
+// address string of the form accepted by ParseNetworkAddress(). For
+// unix sockets, the network should be "unix" (or "unixgram" or
+// "unixpacket") and the path to the socket should be given as the
// host parameter.
func JoinNetworkAddress(network, host, port string) string {
var a string