Add configurable codecs for broker/transport

This commit is contained in:
Asim Aslam
2016-12-06 18:37:35 +00:00
parent e10259940b
commit bd3c798fd9
6 changed files with 100 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ import (
type Options struct {
Addrs []string
Secure bool
Codec Codec
TLSConfig *tls.Config
// Other options for implementations of the interface
@@ -96,6 +97,14 @@ func Secure(b bool) Option {
}
}
// Codec sets the codec used for encoding/decoding used where
// a broker does not support headers
func SetCodec(c Codec) Option {
return func(o *Options) {
o.Codec = c
}
}
// Specify TLS Config
func TLSConfig(t *tls.Config) Option {
return func(o *Options) {