protocol

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package protocol

@author: xwc1125

Package protocol

@author: xwc1125

Package protocol

@author: xwc1125

Index

Constants

View Source
const (
	KEY_REQUEST_OBJ = "KEY_REQUEST_OBJ"
)

Variables

View Source
var (
	DefaultProtocol = ProtocolConfig{
		IsProtocol:     true,
		FilterSignList: []string{"rsa", "sign"},
		WhiteApiList:   []string{},
		Limit: LimitConfig{
			AntiBrushFlag: false,
			InterTime:     10,
		},
	}

	DefaultPrivateKey = `` /* 925-byte string literal not displayed */

)

Functions

func ApiAuthProtocol

func ApiAuthProtocol(ctx contextx.Context, protocolConfig ProtocolConfig, next func(obj *RequestDataObj))

ApiAuthProtocol 解析协议

func ApiNormalProtocol

func ApiNormalProtocol(ctx contextx.Context, protocolConfig ProtocolConfig, next func(obj *RequestDataObj))

func AuthBySign

func AuthBySign(protocolConfig ProtocolConfig, requestMap *hashmap.HashMap, _key string) bool

func GetAppInfo

func GetAppInfo(protocolConfig ProtocolConfig, aseKey, enStr string) *pmodel.AppInfo

func GetClientInfo

func GetClientInfo(protocolConfig ProtocolConfig, aseKey, enStr string) *pmodel.ClientInfo

func GetCoreDataInfo

func GetCoreDataInfo(protocolConfig ProtocolConfig, aseKey, enStr string) *pmodel.CoreDataInfo

func GetDeviceInfo

func GetDeviceInfo(protocolConfig ProtocolConfig, aseKey, enStr string) *pmodel.DeviceInfo

func GetRequestMap

func GetRequestMap(request *http.Request) *hashmap.HashMap

GetRequestMap 获取请求中的参数

func GetSdkInfo

func GetSdkInfo(protocolConfig ProtocolConfig, aseKey, enStr string) *pmodel.SdkInfo

Types

type LimitConfig

type LimitConfig struct {
	AntiBrushFlag bool `json:"anti_brush_flag" mapstructure:"anti_brush_flag"`
	InterTime     int  `json:"inter_time" mapstructure:"inter_time"`
}

type ProtocolConfig

type ProtocolConfig struct {
	IsProtocol     bool        `json:"is_protocol" mapstructure:"is_protocol"`
	FilterSignList []string    `json:"filter_sign_list" mapstructure:"filter_sign_list"`
	WhiteApiList   []string    `json:"white_api_list" mapstructure:"white_api_list"`
	Limit          LimitConfig `json:"limit" mapstructure:"limit"`
	PrivateKey     string      `json:"private_key" mapstructure:"private_key"`
}

type RequestDataObj

type RequestDataObj struct {
	TcpInfo *tcputil.TcpInfo
	App     *pmodel.AppInfo
	Sdk     *pmodel.SdkInfo
	Phone   *pmodel.PhoneInfo
	Device  *pmodel.DeviceInfo
	Client  *pmodel.ClientInfo
	Data    *pmodel.CoreDataInfo
	Map     *hashmap.HashMap
	OsType  pmodel.ClientOsType
	AesKey  string
}

func (RequestDataObj) String

func (data RequestDataObj) String() string

Directories

Path Synopsis
Package contextx
Package contextx
Package pmodel
Package pmodel

Jump to

Keyboard shortcuts

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