Move options over

This commit is contained in:
Asim
2016-01-17 00:28:57 +00:00
parent ae2ab911ed
commit 48798027d0
2 changed files with 34 additions and 29 deletions

34
transport/options.go Normal file
View File

@@ -0,0 +1,34 @@
package transport
import (
"time"
"golang.org/x/net/context"
)
type Options struct {
// Other options for implementations of the interface
// can be stored in a context
Context context.Context
}
type DialOptions struct {
Stream bool
Timeout time.Duration
// Other options for implementations of the interface
// can be stored in a context
Context context.Context
}
func WithStream() DialOption {
return func(o *DialOptions) {
o.Stream = true
}
}
func WithTimeout(d time.Duration) DialOption {
return func(o *DialOptions) {
o.Timeout = d
}
}