Skip to content

Commit

Permalink
Code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya-Sood committed Dec 1, 2023
1 parent b6617ec commit 1dd2231
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion clientconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -1980,13 +1980,14 @@ func (cc *ClientConn) determineAuthority() error {
return fmt.Errorf("ClientConn's authority from transport creds %q and dial option %q don't match", authorityFromCreds, authorityFromDialOption)
}

endpoint := cc.parsedTarget.Endpoint()
if authorityFromDialOption != "" {
cc.authority = authorityFromDialOption
} else if authorityFromCreds != "" {
cc.authority = authorityFromCreds
} else if auth, ok := cc.resolverBuilder.(resolver.AuthorityOverrider); ok {
cc.authority = auth.OverrideAuthority(cc.parsedTarget)
} else if endpoint := cc.parsedTarget.Endpoint(); strings.HasPrefix(endpoint, ":") {
} else if strings.HasPrefix(endpoint, ":") {
cc.authority = "localhost" + endpoint
} else {
cc.authority = encodeAuthority(endpoint)
Expand Down
2 changes: 1 addition & 1 deletion resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ type Resolver interface {

// AuthorityOverrider is implemented by Builders that wish to override the
// default authority for the ClientConn.
// By default, the authority used is target.Endpoint()
// By default, the authority used is target.Endpoint().
type AuthorityOverrider interface {
// OverrideAuthority returns the authority to use for a ClientConn with the
// given target. It must not perform I/O or any other blocking operations.
Expand Down

0 comments on commit 1dd2231

Please sign in to comment.