1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-18 08:26:38 +02:00
go-micro/transport/context.go

21 lines
319 B
Go
Raw Normal View History

package transport
import (
"net"
)
type netListener struct{}
2022-09-30 16:27:07 +02:00
// 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
}