From 0830fbad0347ead1dbea60e664556b263e44653f Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Thu, 5 Sep 2019 13:14:39 -0600 Subject: Reconcile upstream dial addresses and request host/URL information My goodness that was complicated Blessed be request.Context Sort of --- listeners.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'listeners.go') diff --git a/listeners.go b/listeners.go index 3c3a704..846059d 100644 --- a/listeners.go +++ b/listeners.go @@ -165,19 +165,19 @@ var ( listenersMu sync.Mutex ) -// ParseListenAddr parses addr, a string of the form "network/host:port" +// ParseNetworkAddress parses addr, a string of the form "network/host:port" // (with any part optional) into its component parts. Because a port can // also be a port range, there may be multiple addresses returned. -func ParseListenAddr(addr string) (network string, addrs []string, err error) { +func ParseNetworkAddress(addr string) (network string, addrs []string, err error) { var host, port string - network, host, port, err = SplitListenAddr(addr) + network, host, port, err = SplitNetworkAddress(addr) if network == "" { network = "tcp" } if err != nil { return } - if network == "unix" { + if network == "unix" || network == "unixgram" || network == "unixpacket" { addrs = []string{host} return } @@ -204,14 +204,14 @@ func ParseListenAddr(addr string) (network string, addrs []string, err error) { return } -// SplitListenAddr splits a into its network, host, and port components. +// SplitNetworkAddress splits a into its network, host, and port components. // Note that port may be a port range, or omitted for unix sockets. -func SplitListenAddr(a string) (network, host, port string, err error) { +func SplitNetworkAddress(a string) (network, host, port string, err error) { if idx := strings.Index(a, "/"); idx >= 0 { network = strings.ToLower(strings.TrimSpace(a[:idx])) a = a[idx+1:] } - if network == "unix" { + if network == "unix" || network == "unixgram" || network == "unixpacket" { host = a return } @@ -219,11 +219,11 @@ func SplitListenAddr(a string) (network, host, port string, err error) { return } -// JoinListenAddr combines network, host, and port into a single +// JoinNetworkAddress combines network, host, and port into a single // address string of the form "network/host:port". Port may be a // port range. For unix sockets, the network should be "unix" and // the path to the socket should be given in the host argument. -func JoinListenAddr(network, host, port string) string { +func JoinNetworkAddress(network, host, port string) string { var a string if network != "" { a = network + "/" -- cgit v1.2.3