irisext

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: May 13, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authorization

func Authorization(req *http.Request, author string, body []byte) error

Authorization 向http请求中添加授权数据

func CheckAuthorization

func CheckAuthorization(ctx iris.Context) error

CheckAuthorization 检查请求中的授权数据 服务器通用的相互调用授权机制,在授权中指定授权者名称,时间戳和签名 如果被调用的服务有配置授权者的公钥,并且验签通过,则允许此次调用 签名方法为把时间戳拼接至请求正文最后,然后签名 如果时间戳超过服务器当前事件24小时以上,则调用失败

func E

func E(ctx iris.Context, status int, data interface{})

E Echo -- 通用 http json 接口应答

func Echo

func Echo(ctx iris.Context, status int, data interface{}, msg string)

Echo 通用HTTP RESTFUL接口的Json应答

func New

func New() iris.Handler

New returns a new recover middleware, it recovers from panics and logs the panic message to the application's logger "Warn" level.

func Succ

func Succ(ctx iris.Context, data interface{})

Succ 成功应答

Types

type AccessLogger

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

AccessLogger 访问日志工具

func NewLogger

func NewLogger(file string) *AccessLogger

NewLogger creates and returns a new access logger

func (*AccessLogger) ServeHTTP

func (l *AccessLogger) ServeHTTP(ctx iris.Context)

Serve serves the middleware

func (*AccessLogger) WithRequest

func (l *AccessLogger) WithRequest(with bool)

WithRequest 访问日志是否包含请求正文

func (*AccessLogger) WithResponse

func (l *AccessLogger) WithResponse(with bool)

WithResponse 访问日志是否包含应答正文

type Response

type Response struct {
	Status  int         `json:"status"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

Response 接口的应答消息基础格式

type SignatureHandler

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

SignatureHandler ...

func NewSignaturehandler

func NewSignaturehandler(key string) *SignatureHandler

NewSignaturehandler ...

func (*SignatureHandler) ServeHTTP

func (h *SignatureHandler) ServeHTTP(ctx iris.Context)

Jump to

Keyboard shortcuts

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