From 833d67446f14e88c2888db2c3796568fd00bae7a Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Fri, 13 Sep 2019 11:24:07 -0600 Subject: [PATCH] admin: Allow listening on unix socket (closes #2749) --- admin.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/admin.go b/admin.go index b2894be9..860ed051 100644 --- a/admin.go +++ b/admin.go @@ -81,7 +81,15 @@ func StartAdmin(initialConfigJSON []byte) error { } } - ln, err := net.Listen("tcp", adminConfig.Listen) + // extract a singular listener address + netw, listenAddrs, err := ParseNetworkAddress(adminConfig.Listen) + if err != nil { + return fmt.Errorf("parsing admin listener address: %v", err) + } + if len(listenAddrs) != 1 { + return fmt.Errorf("admin endpoint must have exactly one listener; cannot listen on %v", listenAddrs) + } + ln, err := net.Listen(netw, listenAddrs[0]) if err != nil { return err }