add support unix socket for GRPC (#5943)

This commit is contained in:
junhwong
2023-05-26 20:35:34 +08:00
committed by GitHub
parent 31ff926ea1
commit 917489e71c
7 changed files with 91 additions and 1 deletions

View File

@@ -33,6 +33,14 @@ func HostPortOrFile(s ...string) ([]string, error) {
var servers []string
for _, h := range s {
trans, host := Transport(h)
if len(host) == 0 {
return servers, fmt.Errorf("invalid address: %q", h)
}
if trans == transport.UNIX {
servers = append(servers, trans+"://"+host)
continue
}
addr, _, err := net.SplitHostPort(host)