@@ -118,12 +118,26 @@ func (dcs *defaultConfigSelector) SelectConfig(rpcInfo iresolver.RPCInfo) (*ires
118
118
119
119
// NewClient creates a new gRPC "channel" for the target URI provided. No I/O
120
120
// is performed. Use of the ClientConn for RPCs will automatically cause it to
121
- // connect. Connect may be used to manually create a connection, but for most
122
- // users this is unnecessary.
121
+ // connect. The Connect method may be called to manually create a connection,
122
+ // but for most users this should be unnecessary.
123
123
//
124
124
// The target name syntax is defined in
125
- // https://github.com/grpc/grpc/blob/master/doc/naming.md. e.g. to use dns
126
- // resolver, a "dns:///" prefix should be applied to the target.
125
+ // https://github.com/grpc/grpc/blob/master/doc/naming.md. E.g. to use the dns
126
+ // name resolver, a "dns:///" prefix may be applied to the target. The default
127
+ // name resolver will be used if no scheme is detected, or if the parsed scheme
128
+ // is not a registered name resolver. The default resolver is "dns" but can be
129
+ // overridden using the resolver package's SetDefaultScheme.
130
+ //
131
+ // Examples:
132
+ //
133
+ // - "foo.googleapis.com:8080"
134
+ // - "dns:///foo.googleapis.com:8080"
135
+ // - "dns:///foo.googleapis.com"
136
+ // - "dns:///10.0.0.213:8080"
137
+ // - "dns:///%5B2001:db8:85a3:8d3:1319:8a2e:370:7348%5D:443"
138
+ // - "dns://8.8.8.8/foo.googleapis.com:8080"
139
+ // - "dns://8.8.8.8/foo.googleapis.com"
140
+ // - "zookeeper://zk.example.com:9900/example_service"
127
141
//
128
142
// The DialOptions returned by WithBlock, WithTimeout,
129
143
// WithReturnConnectionError, and FailOnNonTempDialError are ignored by this
@@ -872,7 +886,13 @@ func (cc *ClientConn) Target() string {
872
886
return cc .target
873
887
}
874
888
875
- // CanonicalTarget returns the canonical target string of the ClientConn.
889
+ // CanonicalTarget returns the canonical target string used when creating cc.
890
+ //
891
+ // This always has the form "<scheme>://[authority]/<endpoint>". For example:
892
+ //
893
+ // - "dns:///example.com:42"
894
+ // - "dns://8.8.8.8/example.com:42"
895
+ // - "unix:///path/to/socket"
876
896
func (cc * ClientConn ) CanonicalTarget () string {
877
897
return cc .parsedTarget .String ()
878
898
}
0 commit comments