diff --git a/context.go b/context.go deleted file mode 100644 index 5198042..0000000 --- a/context.go +++ /dev/null @@ -1,16 +0,0 @@ -package tcp - -import ( - "context" - - "github.com/unistack-org/micro/v3/server" -) - -func setServerOption(k, v interface{}) server.Option { - return func(o *server.Options) { - if o.Context == nil { - o.Context = context.Background() - } - o.Context = context.WithValue(o.Context, k, v) - } -} diff --git a/go.mod b/go.mod index c25359f..42fc74d 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,6 @@ go 1.13 require ( github.com/unistack-org/micro-broker-memory v0.0.0-20200905101815-4594aa2807e9 github.com/unistack-org/micro-registry-memory v0.0.0-20200905064113-34be66be749f - github.com/unistack-org/micro/v3 v3.0.0-gamma.0.20200922101738-21d5ca1cddc1 + github.com/unistack-org/micro/v3 v3.0.0-gamma.0.20200922103357-4c4fa00a5d94 golang.org/x/net v0.0.0-20200904194848-62affa334b73 ) diff --git a/go.sum b/go.sum index 403bf78..fbab51e 100644 --- a/go.sum +++ b/go.sum @@ -297,6 +297,8 @@ github.com/unistack-org/micro/v3 v3.0.0-gamma.0.20200909210629-caec730248b1/go.m github.com/unistack-org/micro/v3 v3.0.0-gamma.0.20200920135754-1cbd1d2bad83/go.mod h1:HUzMG4Mcy97958VxWTg8zuazZgwQ/aoLZ8wtBVONwRE= github.com/unistack-org/micro/v3 v3.0.0-gamma.0.20200922101738-21d5ca1cddc1 h1:Ki+acK9YEn6OuqOQkZZPrGEslmeMvS9kPSObU01yn2E= github.com/unistack-org/micro/v3 v3.0.0-gamma.0.20200922101738-21d5ca1cddc1/go.mod h1:aL+8VhSXpx0SuEeXPOWUo5BgS7kyvWYobeXFay90UUM= +github.com/unistack-org/micro/v3 v3.0.0-gamma.0.20200922103357-4c4fa00a5d94 h1:1I3f/gjKIw/L61VsZesdOhzWzbvga0U867MOckvzVB0= +github.com/unistack-org/micro/v3 v3.0.0-gamma.0.20200922103357-4c4fa00a5d94/go.mod h1:aL+8VhSXpx0SuEeXPOWUo5BgS7kyvWYobeXFay90UUM= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/vultr/govultr v0.1.4/go.mod h1:9H008Uxr/C4vFNGLqKx232C206GL0PBHzOP0809bGNA= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= diff --git a/options.go b/options.go index f3728aa..8d5b3e0 100644 --- a/options.go +++ b/options.go @@ -23,20 +23,20 @@ type netListener struct{} // send. Default maximum message size is 8K // func MaxMsgSize(s int) server.Option { - return setServerOption(maxMsgSizeKey{}, s) + return server.SetOption(maxMsgSizeKey{}, s) } // AuthTLS should be used to setup a secure authentication using TLS func AuthTLS(t *tls.Config) server.Option { - return setServerOption(tlsAuth{}, t) + return server.SetOption(tlsAuth{}, t) } // MaxConn specifies maximum number of max simultaneous connections to server func MaxConn(n int) server.Option { - return setServerOption(maxConnKey{}, n) + return server.SetOption(maxConnKey{}, n) } // Listener specifies the net.Listener to use instead of the default func Listener(l net.Listener) server.Option { - return setServerOption(netListener{}, l) + return server.SetOption(netListener{}, l) }