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)
| 90 | // |
| 91 | // Otherwise, returns an error. |
| 92 | func 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 | |
| 108 | func getXdsServerURI() string { |
| 109 | universeDomainMu.Lock() |