1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-12 08:23:58 +02:00
go-micro/transport/context.go
Arvin 63a9b94820
support use of listen options (#2536)
* feat: support use of listen options

* style: Adjust the import order of packages.
2022-07-30 10:56:14 +01:00

21 lines
318 B
Go

package transport
import (
"net"
)
type netListener struct{}
// getNetListener Get net.Listener from ListenOptions
func getNetListener(o *ListenOptions) net.Listener {
if o.Context == nil {
return nil
}
if l, ok := o.Context.Value(netListener{}).(net.Listener); ok && l != nil {
return l
}
return nil
}