Documentation ¶
Index ¶
- Constants
- Variables
- func CreateGRPCServerFilterFactory(conf map[string]interface{}) (api.NetworkFilterChainFactory, error)
- func NewGrpcFilter(_ context.Context, ln *Listener) *grpcFilter
- func ParseGRPC(conf map[string]interface{}) (*v2.GRPC, error)
- func RegisterServerHandler(name string, f NewRegisteredServer) bool
- type Connection
- func (c *Connection) Close() error
- func (c *Connection) LocalAddr() net.Addr
- func (c *Connection) OnEvent(event api.ConnectionEvent)
- func (c *Connection) Read(b []byte) (n int, err error)
- func (c *Connection) RemoteAddr() net.Addr
- func (c *Connection) Send(buf buffer.IoBuffer)
- func (c *Connection) SetDeadline(t time.Time) error
- func (c *Connection) SetReadDeadline(t time.Time) error
- func (c *Connection) SetWriteDeadline(t time.Time) error
- func (c *Connection) Write(b []byte) (n int, err error)
- type Handler
- type Listener
- type NewRegisteredServer
- type RegisteredServer
Constants ¶
const ( VarGrpcRequestResult = "requestResult" VarGrpcServiceName = grpcName + "_" + grpcServiceName )
Variables ¶
var ( ErrUnknownServer = errors.New("cannot found the grpc server") ErrInvalidConfig = errors.New("invalid config for grpc listener") )
Functions ¶
func CreateGRPCServerFilterFactory ¶
func CreateGRPCServerFilterFactory(conf map[string]interface{}) (api.NetworkFilterChainFactory, error)
CreateGRPCServerFilterFactory returns a grpc network filter factory. The conf contains more than v2.GRPC becasue some config is not ready yet. @nejisama
func NewGrpcFilter ¶
TODO: maybe we needs the context in the future
func RegisterServerHandler ¶
func RegisterServerHandler(name string, f NewRegisteredServer) bool
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConn ¶
func NewConn(c api.Connection) *Connection
func (*Connection) Close ¶
func (c *Connection) Close() error
Close maybe called two ways: 1. mosn connection closed, the grpc connections should be closed too. 2. grpc connection closed, the mosn connections should be close too. The closed flag is used to avoid calling the Close cyclically.
func (*Connection) LocalAddr ¶
func (c *Connection) LocalAddr() net.Addr
func (*Connection) OnEvent ¶
func (c *Connection) OnEvent(event api.ConnectionEvent)
func (*Connection) RemoteAddr ¶
func (c *Connection) RemoteAddr() net.Addr
func (*Connection) Send ¶
func (c *Connection) Send(buf buffer.IoBuffer)
Send awakes connection Read, and will wait Read finished.
func (*Connection) SetDeadline ¶
func (c *Connection) SetDeadline(t time.Time) error
The real connection timeout is managed by MOSN. This connection's timeout takes no effect on real connection. If the real connection reads timeout, no data send to this connection
func (*Connection) SetReadDeadline ¶
func (c *Connection) SetReadDeadline(t time.Time) error
func (*Connection) SetWriteDeadline ¶
func (c *Connection) SetWriteDeadline(t time.Time) error
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is a wrapper to call NewRegisteredServer
func (*Handler) New ¶ added in v0.25.0
func (s *Handler) New(addr string, conf json.RawMessage, options ...grpc.ServerOption) (*registerServerWrapper, error)
New a grpc server with address. Same address returns same server, which can be start only once.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener is an implementation of net.Listener
func NewListener ¶
type NewRegisteredServer ¶
type NewRegisteredServer func(config json.RawMessage, options ...grpc.ServerOption) (RegisteredServer, error)
NewRegisteredServer returns a grpc server that has completed protobuf registration. The grpc server Serve function should be called in MOSN. NOTICE: some grpc options is not supported, for example, secure options, which are managed by MOSN too.
type RegisteredServer ¶
type RegisteredServer interface { Serve(net.Listener) error // GracefulStop graceful stop grpc server GracefulStop() // Stop ungraceful stop grpc server Stop() }
RegisteredServer is a wrapper of *(google.golang.org/grpc).Server