http

package
v0.0.0-...-07ef6c8 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: Artistic-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CertCheck

func CertCheck(url string, method string) (bool, int)

func CheckStatus

func CheckStatus(resp *http.Response) (gjson.Result, string, int, error)

返回Body的内容[]byte,错误的原因string,status int ,以及错误内容

func GinAuthInterceptor

func GinAuthInterceptor(tokenSecret string) gin.HandlerFunc

func SetupGinRouter

func SetupGinRouter(runMod string, version string, useAuthInterceptor bool, tokenSecret string) *gin.Engine

func UseFasthttp

func UseFasthttp(req *models.HttpRequest, resp *models.HttpResponse)

Types

type ErrCode

type ErrCode struct {
	// 错误码
	Code int
	// 错误描述
	Msg string
}
var EC_LOGIN_FAIL ErrCode = ErrCode{Code: 1001, Msg: "登录失败"}

EC_LOGIN_FAIL 登录失败

var EC_OK ErrCode = ErrCode{Code: 0, Msg: ""}

EC_OK 账号密码错误

var EC_UNAUTHORIZED ErrCode = ErrCode{Code: 1002, Msg: "未授权"}

type JsonResult

type JsonResult struct {
	// 错误码
	Code int `json:"code"`
	// 错误描述
	Msg string `json:"msg"`
	// 数据实体
	Data interface{} `json:"data"`
}

func Error

func Error(err ErrCode) JsonResult

Error 返回失败数据 @param err 错误类型 @return JsonResult

func ErrorMsg

func ErrorMsg(errMsg string) JsonResult

ErrorMsg 返回成功数据 @param errMsg 错误描述 @return JsonResult

func Success

func Success(value interface{}) JsonResult

func SuccessWithMsg

func SuccessWithMsg(msg string) JsonResult

type PrometheusServer

type PrometheusServer struct {
	Core       *gin.Engine
	ListenPort int
}

func SetPrometheusServer

func SetPrometheusServer(listenPort int) *PrometheusServer

func (*PrometheusServer) Start

func (ps *PrometheusServer) Start()

Jump to

Keyboard shortcuts

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