Add deadline option
This commit is contained in:
parent
32f9546ed5
commit
5b034ba253
@ -11,7 +11,8 @@ type Options struct {
|
||||
Addrs []string
|
||||
Secure bool
|
||||
TLSConfig *tls.Config
|
||||
|
||||
// Deadline sets the time to wait to Send/Recv
|
||||
Deadline time.Duration
|
||||
// Other options for implementations of the interface
|
||||
// can be stored in a context
|
||||
Context context.Context
|
||||
@ -45,6 +46,13 @@ func Addrs(addrs ...string) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// Deadline sets the time to wait for Send/Recv execution
|
||||
func Deadline(t time.Duration) Option {
|
||||
return func(o *Options) {
|
||||
o.Deadline = t
|
||||
}
|
||||
}
|
||||
|
||||
// Use secure communication. If TLSConfig is not specified we
|
||||
// use InsecureSkipVerify and generate a self signed cert
|
||||
func Secure(b bool) Option {
|
||||
|
Loading…
x
Reference in New Issue
Block a user