Documentation ¶
Index ¶
- Variables
- func WithAuthSvr(userSvr auth.UserServer, checkerSvr auth.StrategyServer) option
- func WithConfigSvr(configSvr config.ConfigCenterServer, originSvr config.ConfigCenterServer) option
- func WithConnLimitConfig(connLimitConfig *connlimit.Config) option
- func WithDiscoverSvr(discoverSvr service.DiscoverServer, originDiscoverSvr service.DiscoverServer, ...) option
- func WithNamespaceSvr(namespaceSvr namespace.NamespaceOperateServer) option
- func WithTLS(tlsInfo *secure.TLSInfo) option
- func WithVirtualStreamBaseServer(server *NacosV2Server) initVirtualStream
- func WithVirtualStreamLogger(log *commonlog.Scope) initVirtualStream
- func WithVirtualStreamMethod(method string) initVirtualStream
- func WithVirtualStreamPostProcessFunc(postprocess PostProcessFunc) initVirtualStream
- func WithVirtualStreamPreProcessFunc(preprocess PreProcessFunc) initVirtualStream
- func WithVirtualStreamServerStream(stream grpc.ServerStream) initVirtualStream
- type NacosV2Server
- func (h *NacosV2Server) AllowAccess(method string) bool
- func (h *NacosV2Server) ConvertContext(ctx context.Context) context.Context
- func (n *NacosV2Server) DescribeConnectionDetail(req *restful.Request, rsp *restful.Response)
- func (n *NacosV2Server) DescribeConnections(req *restful.Request, rsp *restful.Response)
- func (h *NacosV2Server) EnterRatelimit(ip string, method string) uint32
- func (h *NacosV2Server) GetPort() uint32
- func (h *NacosV2Server) GetProtocol() string
- func (h *NacosV2Server) Initialize(ctx context.Context, option map[string]interface{}, port uint32, ...) error
- func (n *NacosV2Server) RegistryDebugRoute()
- func (h *NacosV2Server) Request(ctx context.Context, payload *nacospb.Payload) (*nacospb.Payload, error)
- func (h *NacosV2Server) RequestBiStream(svr nacospb.BiRequestStream_RequestBiStreamServer) error
- func (h *NacosV2Server) Run(errCh chan error)
- func (h *NacosV2Server) Stop()
- func (h *NacosV2Server) UnmarshalPayload(payload *nacospb.Payload) (remote.RequestHandler, nacospb.CustomerPayload, error)
- type PostProcessFunc
- type PreProcessFunc
- type RequestHandler
- type RequestHandlerWarrper
- type VirtualStream
- func (v *VirtualStream) Context() context.Context
- func (v *VirtualStream) RecvMsg(m interface{}) error
- func (v *VirtualStream) SendHeader(md metadata.MD) error
- func (v *VirtualStream) SendMsg(m interface{}) error
- func (v *VirtualStream) SetHeader(md metadata.MD) error
- func (v *VirtualStream) SetTrailer(md metadata.MD)
Constants ¶
This section is empty.
Variables ¶
var ( ErrorNoSuchPayloadType = errors.New("not such payload type") ErrorInvalidRequestBodyType = errors.New("invalid request body type") )
Functions ¶
func WithAuthSvr ¶
func WithAuthSvr(userSvr auth.UserServer, checkerSvr auth.StrategyServer) option
WithAuthSvr 设置鉴权 Server
func WithConfigSvr ¶
func WithConfigSvr(configSvr config.ConfigCenterServer, originSvr config.ConfigCenterServer) option
func WithConnLimitConfig ¶
func WithDiscoverSvr ¶
func WithDiscoverSvr(discoverSvr service.DiscoverServer, originDiscoverSvr service.DiscoverServer, healthSvr *healthcheck.Server) option
func WithNamespaceSvr ¶
func WithNamespaceSvr(namespaceSvr namespace.NamespaceOperateServer) option
func WithVirtualStreamBaseServer ¶
func WithVirtualStreamBaseServer(server *NacosV2Server) initVirtualStream
WithVirtualStreamBaseServer 设置 BaseGrpcServer
func WithVirtualStreamLogger ¶
WithVirtualStreamLogger 设置 Logger
func WithVirtualStreamMethod ¶
func WithVirtualStreamMethod(method string) initVirtualStream
WithVirtualStreamMethod 设置 method
func WithVirtualStreamPostProcessFunc ¶
func WithVirtualStreamPostProcessFunc(postprocess PostProcessFunc) initVirtualStream
WithVirtualStreamPostProcessFunc 设置 PostProcessFunc
func WithVirtualStreamPreProcessFunc ¶
func WithVirtualStreamPreProcessFunc(preprocess PreProcessFunc) initVirtualStream
WithVirtualStreamPreProcessFunc 设置 PreProcessFunc
func WithVirtualStreamServerStream ¶
func WithVirtualStreamServerStream(stream grpc.ServerStream) initVirtualStream
WithVirtualStreamServerStream 设置 grpc.ServerStream
Types ¶
type NacosV2Server ¶
NacosV2Server gRPC API服务器
func NewNacosV2Server ¶
func NewNacosV2Server(v1Svr *v1.NacosV1Server, store *core.NacosDataStorage, options ...option) (*NacosV2Server, error)
func (*NacosV2Server) AllowAccess ¶
func (h *NacosV2Server) AllowAccess(method string) bool
AllowAccess api allow access
func (*NacosV2Server) ConvertContext ¶
func (h *NacosV2Server) ConvertContext(ctx context.Context) context.Context
ConvertContext 将GRPC上下文转换成内部上下文
func (*NacosV2Server) DescribeConnectionDetail ¶
func (n *NacosV2Server) DescribeConnectionDetail(req *restful.Request, rsp *restful.Response)
DescribeConnectionDetail 查询某一个连接ID的详细信息
func (*NacosV2Server) DescribeConnections ¶
func (n *NacosV2Server) DescribeConnections(req *restful.Request, rsp *restful.Response)
DescribeConnections 查询 V2 客户端的连接
func (*NacosV2Server) EnterRatelimit ¶
func (h *NacosV2Server) EnterRatelimit(ip string, method string) uint32
EnterRatelimit api ratelimit
func (*NacosV2Server) GetPort ¶
func (h *NacosV2Server) GetPort() uint32
GetPort get the connector listen port value
func (*NacosV2Server) GetProtocol ¶
func (h *NacosV2Server) GetProtocol() string
GetProtocol 获取Server的协议
func (*NacosV2Server) Initialize ¶
func (h *NacosV2Server) Initialize(ctx context.Context, option map[string]interface{}, port uint32, apiConf map[string]apiserver.APIConfig) error
Initialize 初始化HTTP API服务器
func (*NacosV2Server) RegistryDebugRoute ¶
func (n *NacosV2Server) RegistryDebugRoute()
func (*NacosV2Server) RequestBiStream ¶
func (h *NacosV2Server) RequestBiStream(svr nacospb.BiRequestStream_RequestBiStreamServer) error
func (*NacosV2Server) UnmarshalPayload ¶
func (h *NacosV2Server) UnmarshalPayload(payload *nacospb.Payload) (remote.RequestHandler, nacospb.CustomerPayload, error)
UnmarshalPayload .
type PostProcessFunc ¶
type PostProcessFunc func(stream *VirtualStream, m interface{})
PostProcessFunc postprocess function define
type PreProcessFunc ¶
type PreProcessFunc func(stream *VirtualStream, isPrint bool) error
PreProcessFunc preprocess function define
type RequestHandler ¶
type RequestHandler func(context.Context, nacospb.BaseRequest, nacospb.RequestMeta) (nacospb.BaseResponse, error)
RequestHandler
type RequestHandlerWarrper ¶
type RequestHandlerWarrper struct { Handler RequestHandler PayloadBuilder func() nacospb.CustomerPayload }
RequestHandlerWarrper
type VirtualStream ¶
type VirtualStream struct { Method string ClientAddress string ClientIP string UserAgent string RequestID string Code int StartTime time.Time // contains filtered or unexported fields }
VirtualStream 虚拟Stream 继承ServerStream
func (*VirtualStream) Context ¶
func (v *VirtualStream) Context() context.Context
Context returns the context for this stream.
func (*VirtualStream) RecvMsg ¶
func (v *VirtualStream) RecvMsg(m interface{}) error
RecvMsg blocks until it receives a message into m or the stream is done. It returns io.EOF when the client has performed a CloseSend. On any non-EOF error, the stream is aborted and the error contains the RPC status.
It is safe to have a goroutine calling SendMsg and another goroutine calling RecvMsg on the same stream at the same time, but it is not safe to call RecvMsg on the same stream in different goroutines.
func (*VirtualStream) SendHeader ¶
func (v *VirtualStream) SendHeader(md metadata.MD) error
SendHeader sends the header metadata. The provided md and headers set by SetHeader() will be sent. It fails if called multiple times.
func (*VirtualStream) SendMsg ¶
func (v *VirtualStream) SendMsg(m interface{}) error
SendMsg sends a message. On error, SendMsg aborts the stream and the error is returned directly.
SendMsg blocks until:
- There is sufficient flow control to schedule m with the transport, or
- The stream is done, or
- The stream breaks.
SendMsg does not wait until the message is received by the client. An untimely stream closure may result in lost messages.
It is safe to have a goroutine calling SendMsg and another goroutine calling RecvMsg on the same stream at the same time, but it is not safe to call SendMsg on the same stream in different goroutines.
func (*VirtualStream) SetHeader ¶
func (v *VirtualStream) SetHeader(md metadata.MD) error
SetHeader sets the header metadata. It may be called multiple times. When call multiple times, all the provided metadata will be merged. All the metadata will be sent out when one of the following happens:
- ServerStream.SendHeader() is called;
- The first response is sent out;
- An RPC status is sent out (error or success).
func (*VirtualStream) SetTrailer ¶
func (v *VirtualStream) SetTrailer(md metadata.MD)
SetTrailer sets the trailer metadata which will be sent with the RPC status. When called more than once, all the provided metadata will be merged.