Documentation ¶
Index ¶
- Constants
- Variables
- func BuildBoltV1Request(requestID uint64) *sofarpc.BoltRequest
- func BuildBoltV1RequestWithContent(requestID uint64, data types.IoBuffer) *sofarpc.BoltRequest
- func BuildBoltV1Response(req *sofarpc.BoltRequest) *sofarpc.BoltResponse
- func BuildBoltV2Request(requestID uint64) *sofarpc.BoltRequestV2
- func BuildBoltV2Response(req *sofarpc.BoltRequestV2) *sofarpc.BoltResponseV2
- func CreateMeshToMeshConfig(clientaddr string, serveraddr string, appproto types.Protocol, ...) *config.MOSNConfig
- func CreateProxyMesh(addr string, hosts []string, proto types.Protocol) *config.MOSNConfig
- func CreateTCPProxyConfig(meshaddr string, hosts []string, isRouteEntryMode bool) *config.MOSNConfig
- func CreateTLSExtensionConfig(clientaddr string, serveraddr string, appproto types.Protocol, ...) *config.MOSNConfig
- func CreateWeightProxyMesh(addr string, proto types.Protocol, clusters []*WeightCluster) *config.MOSNConfig
- func CreateXProtocolMesh(clientaddr string, serveraddr string, subprotocol string, hosts []string) *config.MOSNConfig
- func CurrentMeshAddr() string
- func IsMapEmpty(m *sync.Map) bool
- func NewBasicCluster(name string, hosts []string) v2.Cluster
- func NewFilterChain(routerConfigName string, downstream, upstream types.Protocol, ...) v2.FilterChain
- func NewHeaderRouter(cluster string, value string) v2.Router
- func NewHeaderWeightedRouter(clusters []v2.WeightedCluster, value string) v2.Router
- func NewListener(name, addr string, chains []v2.FilterChain) v2.Listener
- func NewMOSNConfig(listeners []v2.Listener, clusterManager config.ClusterManagerConfig) *config.MOSNConfig
- func NewPathRouter(cluster string, path string) v2.Router
- func NewPrefixRouter(cluster string, prefix string) v2.Router
- func NewProxyFilter(routerfgname string, downstream, upstream types.Protocol) *v2.Proxy
- func NewWeightedCluster(name string, hosts []*WeightHost) v2.Cluster
- func NewXProtocolFilterChain(name string, subproto string, routers []v2.Router) v2.FilterChain
- func RandomDuration(min, max time.Duration) time.Duration
- func ServeSofaRPC(t *testing.T, conn net.Conn, ...)
- func WaitMapEmpty(m *sync.Map, timeout time.Duration) bool
- type ExtendVerifyConfig
- type HTTP2Server
- type HTTPHandler
- type HTTPServer
- type RPCClient
- func (c *RPCClient) Close()
- func (c *RPCClient) Connect(addr string) error
- func (c *RPCClient) ConnectTLS(addr string, cfg *v2.TLSConfig) error
- func (c *RPCClient) OnDecodeError(context context.Context, err error, headers types.HeaderMap)
- func (c *RPCClient) OnReceive(ctx context.Context, headers types.HeaderMap, data types.IoBuffer, ...)
- func (c *RPCClient) SendRequest()
- func (c *RPCClient) SendRequestWithData(in string)
- func (c *RPCClient) Stats() bool
- type RPCServer
- type ServeConn
- type UpstreamServer
- func NewHTTPServer(t *testing.T, h http.Handler) UpstreamServer
- func NewRPCServer(t *testing.T, addr string, proto string) UpstreamServer
- func NewUpstreamHTTP2(t *testing.T, addr string, h http.Handler) UpstreamServer
- func NewUpstreamServer(t *testing.T, addr string, serve ServeConn) UpstreamServer
- func NewXProtocolServer(t *testing.T, addr string, subproto string) UpstreamServer
- type WeightCluster
- type WeightHost
- type XProtocolClient
- type XProtocolServer
Constants ¶
View Source
const ( Bolt1 = "boltV1" Bolt2 = "boltV2" )
View Source
const (
XExample = "rpc-example"
)
support SubProtocol
Variables ¶
View Source
var ( MeshLogPath = "stdout" MeshLogLevel = "WARN" StartRetry = false )
can set
Functions ¶
func BuildBoltV1Request ¶
func BuildBoltV1Request(requestID uint64) *sofarpc.BoltRequest
func BuildBoltV1RequestWithContent ¶
func BuildBoltV1RequestWithContent(requestID uint64, data types.IoBuffer) *sofarpc.BoltRequest
func BuildBoltV1Response ¶
func BuildBoltV1Response(req *sofarpc.BoltRequest) *sofarpc.BoltResponse
func BuildBoltV2Request ¶
func BuildBoltV2Request(requestID uint64) *sofarpc.BoltRequestV2
func BuildBoltV2Response ¶
func BuildBoltV2Response(req *sofarpc.BoltRequestV2) *sofarpc.BoltResponseV2
func CreateMeshToMeshConfig ¶
func CreateMeshToMeshConfig(clientaddr string, serveraddr string, appproto types.Protocol, meshproto types.Protocol, hosts []string, tls bool) *config.MOSNConfig
Mesh to Mesh clientaddr and serveraddr is mesh's addr appproto is client and server (not mesh) protocol meshproto is mesh's protocol hosts is server's addresses
func CreateProxyMesh ¶
mesh as a proxy , client and servre have same protocol
func CreateTCPProxyConfig ¶
func CreateTCPProxyConfig(meshaddr string, hosts []string, isRouteEntryMode bool) *config.MOSNConfig
TCP Proxy
func CreateTLSExtensionConfig ¶
func CreateTLSExtensionConfig(clientaddr string, serveraddr string, appproto types.Protocol, meshproto types.Protocol, hosts []string, ext *ExtendVerifyConfig) *config.MOSNConfig
func CreateWeightProxyMesh ¶
func CreateWeightProxyMesh(addr string, proto types.Protocol, clusters []*WeightCluster) *config.MOSNConfig
mesh as a proxy , client and servre have same protocol
func CreateXProtocolMesh ¶
func CreateXProtocolMesh(clientaddr string, serveraddr string, subprotocol string, hosts []string) *config.MOSNConfig
XProtocol must be mesh to mesh currently, support Path/Prefix is "/" only
func CurrentMeshAddr ¶
func CurrentMeshAddr() string
func IsMapEmpty ¶
func NewFilterChain ¶
func NewHeaderWeightedRouter ¶
func NewHeaderWeightedRouter(clusters []v2.WeightedCluster, value string) v2.Router
weighted cluster case
func NewListener ¶
func NewListener(name, addr string, chains []v2.FilterChain) v2.Listener
func NewMOSNConfig ¶
func NewMOSNConfig(listeners []v2.Listener, clusterManager config.ClusterManagerConfig) *config.MOSNConfig
func NewProxyFilter ¶
Create Mesh Config
func NewWeightedCluster ¶
func NewWeightedCluster(name string, hosts []*WeightHost) v2.Cluster
func NewXProtocolFilterChain ¶
func ServeSofaRPC ¶
Types ¶
type ExtendVerifyConfig ¶
TLS Extension
type HTTP2Server ¶
type HTTPHandler ¶
type HTTPHandler struct{}
Server Implement
func (*HTTPHandler) ServeHTTP ¶
func (h *HTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HTTPServer ¶
Http Server
func (*HTTPServer) Addr ¶
func (s *HTTPServer) Addr() string
func (*HTTPServer) Close ¶
func (s *HTTPServer) Close()
func (*HTTPServer) GoServe ¶
func (s *HTTPServer) GoServe()
type RPCClient ¶
type RPCClient struct { ClientID string Protocol string //bolt1, bolt2 Codec stream.Client Waits sync.Map ExpectedStatus int16 // contains filtered or unexported fields }
func (*RPCClient) OnDecodeError ¶
func (*RPCClient) SendRequest ¶
func (c *RPCClient) SendRequest()
func (*RPCClient) SendRequestWithData ¶
type RPCServer ¶
type RPCServer struct { UpstreamServer Client *RPCClient // Statistic Name string Count uint32 }
type UpstreamServer ¶
type UpstreamServer interface { GoServe() Close() Addr() string }
func NewHTTPServer ¶
func NewHTTPServer(t *testing.T, h http.Handler) UpstreamServer
func NewRPCServer ¶
func NewRPCServer(t *testing.T, addr string, proto string) UpstreamServer
func NewUpstreamHTTP2 ¶
func NewUpstreamServer ¶
func NewUpstreamServer(t *testing.T, addr string, serve ServeConn) UpstreamServer
func NewXProtocolServer ¶
func NewXProtocolServer(t *testing.T, addr string, subproto string) UpstreamServer
type WeightCluster ¶
type WeightCluster struct { Name string Hosts []*WeightHost Weight uint32 }
type WeightHost ¶
type XProtocolClient ¶
type XProtocolClient struct { ClientID string SubProtocol xprotocol.SubProtocol Codec xprotocol.Multiplexing // contains filtered or unexported fields }
XProtocol needs subprotocol for rpc is different from other protocol (extension)
func NewXClient ¶
func NewXClient(t *testing.T, id string, subproto string) *XProtocolClient
func (*XProtocolClient) Close ¶
func (c *XProtocolClient) Close()
func (*XProtocolClient) Connect ¶
func (c *XProtocolClient) Connect(addr string) error
func (*XProtocolClient) RequestAndWaitReponse ¶
func (c *XProtocolClient) RequestAndWaitReponse() error
type XProtocolServer ¶
type XProtocolServer struct { UpstreamServer Client *XProtocolClient }
func (*XProtocolServer) ServeXExample ¶
func (s *XProtocolServer) ServeXExample(t *testing.T, conn net.Conn)
Click to show internal directories.
Click to hide internal directories.