service

package
v0.0.0-...-336acd6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	XVersion           = "X-RPCX-Version"
	XMessageType       = "X-RPCX-MesssageType"
	XHeartbeat         = "X-RPCX-Heartbeat"
	XOneway            = "X-RPCX-Oneway"
	XMessageStatusType = "X-RPCX-MessageStatusType"
	XSerializeType     = "X-RPCX-SerializeType"
	XMessageID         = "X-RPCX-MessageID"
	XServicePath       = "X-RPCX-ServicePath"
	XServiceMethod     = "X-RPCX-ServiceMethod"
	XMeta              = "X-RPCX-Meta"
	XErrorMessage      = "X-RPCX-ErrorMessage"
)

Variables

This section is empty.

Functions

func CreateServiceDiscovery

func CreateServiceDiscovery(basePath, addr string) (client.ServiceDiscovery, error)

func HttpRequest2RPCRequest

func HttpRequest2RPCRequest(r *http.Request) (*protocol.Message, error)

HttpRequest2RPCRequest 协议转换

Types

type Gateway

type Gateway struct {
	FailMode   client.FailMode
	SelectMode client.SelectMode
	Option     client.Option
	// contains filtered or unexported fields
}

func NewGateway

func NewGateway(base string, srv HTTPServer, dis client.ServiceDiscovery, failMode client.FailMode, selectMode client.SelectMode, option client.Option) *Gateway

func (*Gateway) Serve

func (g *Gateway) Serve() error

type HTTPServer

type HTTPServer interface {
	RegisterHandler(base string, handler ServiceHandler)
	Serve() error
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(addr string) *Server

New 扩展其他 HTTP Server

func NewWithGin

func NewWithGin(config *config.Config, srv *gin.Engine) *Server

func (*Server) RegisterHandler

func (s *Server) RegisterHandler(base string, handler ServiceHandler)

func (*Server) Serve

func (s *Server) Serve() error

type ServiceHandler

type ServiceHandler func(*http.Request, string) (map[string]string, []byte, error)

ServiceHandler 转换处理

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL