Documentation ¶
Index ¶
Constants ¶
View Source
const KDefBuild = "/"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { // Addr is the server address on which a connection will be established. Addr string // ServerName is the name of this address. // If non-empty, the ServerName is used as the transport certification authority for // the address, instead of the hostname from the Dial target string. In most cases, // this should not be set. // // If Method is GRPCLB, ServerName should be the name of the remote load // balancer, not the name of the backend. // // WARNING: ServerName must only be populated with trusted values. It // is insecure to populate it with data from untrusted inputs since untrusted // values could be used to bypass the authority checks performed by TLS. ServerName string // Attributes contains arbitrary data about this address intended for // consumption by the load balancing policy. Attributes *attributes.Attributes // Weight sort max in front Weight int64 }
Address Notice: This type is EXPERIMENTAL and may be changed or removed in a later release.
type Builder ¶
type Builder interface { // Build creates a new resolver for the given target. // // gRPC dial calls Build synchronously, and fails if the returned error is // not nil. Build(target Target, cc Connector) (Resolver, error) // Scheme returns the scheme supported by this resolver. Scheme() string Type() string }
Builder creates a resolver that will be used to watch name resolution updates.
type Connector ¶
type Connector interface { // UpdateState updates the state of the ClientConn appropriately. UpdateState(State) // 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. ReportError(error) }
type Resolver ¶
type Resolver interface { // ResolveNow will be called by gRPC to try to resolve the target name // again. It's just a hint, resolver can ignore this if it's not necessary. // // It could be called multiple times concurrently. ResolveNow() // Close closes the resolver. Close() }
Resolver watches for the updates on the specified target. Updates include address updates and service config updates.
type State ¶
type State struct { // Addresses is the latest set of resolved addresses for the target. Addresses Addresses // Attributes contains arbitrary data about the resolver intended for // consumption by the load balancing policy. Attributes *attributes.Attributes }
State contains the current Resolver state relevant to the ClientConn.
type Target ¶
type Target struct { // "grpc", "thrift", "local"... Type string `json:"type"` Scheme string `json:"scheme"` Authority string `json:"authority"` Endpoint string `json:"endpoint"` }
Target
- "dns://some_authority/foo.bar" Target{Scheme: "dns", Authority: "some_authority", Endpoint: "foo.bar"}
func ParseTarget ¶
ParseTarget splits target into a resolver.Target struct containing scheme, authority and endpoint.
If target is not a valid scheme://authority/endpoint, it returns {Endpoint: target}.
func TargetWith ¶
func TargetWithGrpc ¶
func TargetWithLocal ¶
func TargetWithThrift ¶
func (*Target) SchemeWith ¶
Click to show internal directories.
Click to hide internal directories.