summaryrefslogtreecommitdiff
path: root/vendor/google.golang.org/grpc/resolver/resolver.go
diff options
context:
space:
mode:
authorLibravatar Dominik Süß <dominik@suess.wtf>2025-02-06 12:14:37 +0100
committerLibravatar GitHub <noreply@github.com>2025-02-06 12:14:37 +0100
commitdd094e401282e135989f57c0ca3dee7dea3f5207 (patch)
tree74cb77830f621840273255a17565ced73b4fa997 /vendor/google.golang.org/grpc/resolver/resolver.go
parent[feature] Use `X-Robots-Tag` headers to instruct scrapers/crawlers (#3737) (diff)
downloadgotosocial-dd094e401282e135989f57c0ca3dee7dea3f5207.tar.xz
[chore] update otel libraries (#3740)
* chore: update otel dependencies * refactor: combine tracing & metrics in observability package * chore: update example tracing compose file
Diffstat (limited to 'vendor/google.golang.org/grpc/resolver/resolver.go')
-rw-r--r--vendor/google.golang.org/grpc/resolver/resolver.go22
1 files changed, 20 insertions, 2 deletions
diff --git a/vendor/google.golang.org/grpc/resolver/resolver.go b/vendor/google.golang.org/grpc/resolver/resolver.go
index 202854511..8eb1cf3bc 100644
--- a/vendor/google.golang.org/grpc/resolver/resolver.go
+++ b/vendor/google.golang.org/grpc/resolver/resolver.go
@@ -22,6 +22,7 @@ package resolver
import (
"context"
+ "errors"
"fmt"
"net"
"net/url"
@@ -237,8 +238,8 @@ type ClientConn interface {
// UpdateState can be omitted.
UpdateState(State) error
// ReportError notifies the ClientConn that the Resolver encountered an
- // error. The ClientConn will notify the load balancer and begin calling
- // ResolveNow on the Resolver with exponential backoff.
+ // error. The ClientConn then forwards this error to the load balancing
+ // policy.
ReportError(error)
// NewAddress is called by resolver to notify ClientConn a new list
// of resolved addresses.
@@ -330,3 +331,20 @@ type AuthorityOverrider interface {
// typically in line, and must keep it unchanged.
OverrideAuthority(Target) string
}
+
+// ValidateEndpoints validates endpoints from a petiole policy's perspective.
+// Petiole policies should call this before calling into their children. See
+// [gRPC A61](https://github.com/grpc/proposal/blob/master/A61-IPv4-IPv6-dualstack-backends.md)
+// for details.
+func ValidateEndpoints(endpoints []Endpoint) error {
+ if len(endpoints) == 0 {
+ return errors.New("endpoints list is empty")
+ }
+
+ for _, endpoint := range endpoints {
+ for range endpoint.Addresses {
+ return nil
+ }
+ }
+ return errors.New("endpoints list contains no addresses")
+}