2021-03-12 12:33:32 +00:00
|
|
|
package client
|
|
|
|
|
|
|
|
// Client represents client for exchanging messages
|
|
|
|
// with a remote server using Protobuf RPC.
|
|
|
|
type Client struct {
|
2023-02-03 12:22:00 +00:00
|
|
|
cfg
|
2021-03-12 12:33:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// New creates, configures via options and returns new Client instance.
|
|
|
|
func New(opts ...Option) *Client {
|
2023-02-03 12:22:00 +00:00
|
|
|
var c Client
|
|
|
|
c.initDefault()
|
2021-03-12 12:33:32 +00:00
|
|
|
|
|
|
|
for _, opt := range opts {
|
2023-02-03 12:22:00 +00:00
|
|
|
opt(&c.cfg)
|
2021-03-12 12:33:32 +00:00
|
|
|
}
|
|
|
|
|
2023-02-03 12:22:00 +00:00
|
|
|
return &c
|
2021-03-12 12:33:32 +00:00
|
|
|
}
|