grpchttpproxy

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(l net.Listener, prefix string, target string) error

Start 服务启动

func StartWithInterceptor

func StartWithInterceptor(l net.Listener, prefix string, target string, interceptor ProxyInterceptor) error

StartWithInterceptor 有中间件功能的代理服务启动

Types

type BizResp

type BizResp struct {
	ErrCode int    `json:"errcode"` // 业务错误码
	ErrMsg  string `json:"errmsg"`  // 错误消息
}

BizResp 业务返回

type DefaultEventHandler

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

DefaultEventHandler TODO

func (*DefaultEventHandler) OnReceiveData

func (h *DefaultEventHandler) OnReceiveData(md metadata.MD, resp string, respErr error)

OnReceiveData TODO

func (*DefaultEventHandler) OnReceiveTrailers

func (h *DefaultEventHandler) OnReceiveTrailers(stat *status.Status, md metadata.MD)

OnReceiveTrailers TODO

type GrpcReq

type GrpcReq struct {
	Server  string
	Service string
	Method  string
}

GrpcReq TODO

type HttpResp

type HttpResp struct {
	RetCode int         `json:"retcode"`  // 系统错误码
	BizCode int         `json:"bizcode"`  // 业务错误码
	TraceID string      `json:"trace_id"` // 请求ID
	Message string      `json:"message"`  // 错误消息
	Payload interface{} `json:"payload"`  // 接口内容
}

HttpResp TODO

func BaseHandler

func BaseHandler(ctx context.Context, traceId string, greq *GrpcReq, body string, headers []string) *HttpResp

BaseHandler 基础请求处理

type NullStruct

type NullStruct struct {
}

NullStruct TODO

type ProxyHandler

type ProxyHandler func(ctx context.Context, traceId string, req *GrpcReq, body string, headers []string) *HttpResp

ProxyHandler TODO

type ProxyInterceptor

type ProxyInterceptor func(ctx context.Context, traceId string, r *http.Request, req *GrpcReq, body string,
	handler ProxyHandler) *HttpResp

ProxyInterceptor TODO

type RetResult

type RetResult struct {
	Body interface{} `json:"body"`
}

RetResult TODO

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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