Call Option


When a client makes an RPC call, it adds an additional Option that takes precedence over client Option and overrides some configurations:

resp, err := client.Call(ctx, req, callopt.WithXXX....)



func WithHostPort(hostport string) Option

Specifying a specific HostPort directly during this call phase will overwrite the resolver result for direct access. More


func WithURL(url string) Option

Specifying a specified URL during this call phase to initiate the call. More


func WithTag(key, val string) Option

Set some meta information for this RPC call, add it in the form of key-value, for example, if you want to add fields such as cluster and idc to the meta information for service governance, you can write it like this:

resp, err := client.Call(ctx, req,callopt.WithTag("cluster", cluster),callopt.WithTag("idc", idc))


func WithRPCTimeout(d time.Duration) Option

Set RPC timeout. More


func WithConnectTimeout(d time.Duration) Option

Set connection timeout. More


func WithHTTPHost(host string) Option

When using HTTP connection, the Option specifies the Host address in the HTTP header.

Last modified December 2, 2022 : chore: add lark footer link (#460) (f41a884)