pkg update

This commit is contained in:
Stephan D
2026-01-30 16:07:28 +01:00
parent 51f5b0804a
commit 809370bda8
13 changed files with 389 additions and 30 deletions

View File

@@ -1,7 +1,6 @@
package grpcimp
import (
"fmt"
"net"
"os"
"strings"
@@ -59,23 +58,7 @@ func (c *Config) DiscoveryInvokeURI() string {
return ""
}
return fmt.Sprintf("%s://%s:%s", c.discoveryScheme(), host, addrPort)
}
func (c *Config) discoveryScheme() string {
scheme := strings.TrimSpace(c.AdvertiseScheme)
if envKey := strings.TrimSpace(c.AdvertiseSchemeEnv); envKey != "" {
if value := strings.TrimSpace(os.Getenv(envKey)); value != "" {
scheme = value
}
}
if scheme != "" {
return scheme
}
if c != nil && c.TLS != nil && strings.TrimSpace(c.TLS.CertFile) != "" && strings.TrimSpace(c.TLS.KeyFile) != "" {
return "grpcs"
}
return "grpc"
return net.JoinHostPort(host, addrPort)
}
func splitHostPort(address string) (string, string) {