MCPcopy
hub / github.com/grpc/grpc-go / SetUniverseDomain

Function SetUniverseDomain

xds/googledirectpath/googlec2p.go:92–106  ·  view source on GitHub ↗

SetUniverseDomain informs the gRPC library of the universe domain in which the process is running (for example, "googleapis.com"). It is the caller's responsibility to ensure that the domain is correct. This setting is used by the "google-c2p" resolver (the resolver used for URIs with the "google-c

(domain string)

Source from the content-addressed store, hash-verified

90//
91// Otherwise, returns an error.
92func SetUniverseDomain(domain string) error {
93 universeDomainMu.Lock()
94 defer universeDomainMu.Unlock()
95 if domain == "" {
96 return fmt.Errorf("universe domain cannot be empty")
97 }
98 if universeDomain == "" {
99 universeDomain = domain
100 return nil
101 }
102 if universeDomain != domain {
103 return fmt.Errorf("universe domain cannot be set to %s, already set to different value: %s", domain, universeDomain)
104 }
105 return nil
106}
107
108func getXdsServerURI() string {
109 universeDomainMu.Lock()

Callers 4

mainFunction · 0.92

Calls 3

ErrorfMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45