middleware

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHandlerOption = client.WithErrorHandler(func(ctx context.Context, err error) error {
	transErr, ok := err.(*remote.TransError)
	if ok && transErr.TypeID() == 6 {
		err = e.RPCClientErrorCodeError.SetErr(err, strings.ReplaceAll(transErr.Error(), "biz error: ", ""))
	} else {
		err = e.RPCClientErrorCodeError.SetErr(err, "数据访问失败")
	}
	return err
})

ErrHandlerOption 业务错误再封装

Functions

func WhiteIpMiddleware

func WhiteIpMiddleware(whiteList map[string][]string) server.Option

Types

type MetaTTHeaderHandler

type MetaTTHeaderHandler struct {
	WhiteApi   []string //接口白名单
	CheckWhite bool
}

func (*MetaTTHeaderHandler) ReadMeta

ReadMeta of MetaTTHeaderHandler reads headers of TTHeader protocol from transport

func (*MetaTTHeaderHandler) WriteMeta

Jump to

Keyboard shortcuts

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