add transport codec
This commit is contained in:
@@ -4,11 +4,13 @@ import (
|
||||
"crypto/tls"
|
||||
"time"
|
||||
|
||||
"github.com/micro/go-micro/transport/codec"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
Addrs []string
|
||||
Codec codec.Codec
|
||||
Secure bool
|
||||
TLSConfig *tls.Config
|
||||
// Timeout sets the timeout for Send/Recv
|
||||
@@ -46,6 +48,14 @@ func Addrs(addrs ...string) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// Codec sets the codec used for encoding where the transport
|
||||
// does not support message headers
|
||||
func Codec(c codec.Codec) Option {
|
||||
return func(o *Options) {
|
||||
o.Codec = c
|
||||
}
|
||||
}
|
||||
|
||||
// Timeout sets the timeout for Send/Recv execution
|
||||
func Timeout(t time.Duration) Option {
|
||||
return func(o *Options) {
|
||||
|
||||
Reference in New Issue
Block a user