package pb const ( Authorization = "Authorization" //配置参数KEY ConfigAesEncryptParamKey = "aesEncryptConfig" ConfigWebAesEncryptParamKey = "webAesEncryptConfig" ConfigApiLogEnableParamKey = "apiLogEnable" //通用参数 HeaderXNlContentEncoding = "X-NL-Content-Encoding" //返回给客户端的压缩标识 HeaderXNlProductCode = "X-NL-Product-Code" //产品 HeaderXNlCryptoKey = "X-Nl-Crypto-Key" //产品 HeaderXNlCryptoValue = "J4zjl/1t7kSyktxbDvyYlw==" //产品 HeaderXNlDevIp = "X-NL-DEV-IP" //测试IP HeaderXNlDisabledEncrypt = "X-NL-DEV-DISABLED-ENCRYPT" //加密禁用 HeaderXNlRequestType = "X-NL-Request-Type" //加密禁用 HeaderXRequestTimestamp = "X-Request-Timestamp" //加密禁用 //内部参数 InnerHeaderResCompressMethod = "Res-Encrypt-CompressMethod" InnerHeaderReqEncryptKey = "Req-Encrypt-Key" InnerHeaderReqEncryptIv = "Req-Encrypt-Iv" InnerHeaderResEncryptKey = "Res-Encrypt-Key" InnerHeaderResEncryptIv = "Res-Encrypt-Iv" InnerHeaderEncryptEnable = "encryptEnable" InnerHeaderAesDirectEnable = "Aes-Direct-Enable" InnerHeaderLogEnable = "Log" InnerHeaderCompressLength = "X-NL-Compress-Length" InnerHeaderJwtEncryptSecret = "Req-Jwt-Encrypt-Secret" AesIvLength = 16 //iv 长度 ) type AesConfig struct { Enable bool `json:"enable"` AesDirect bool `json:"aesDirect"` //true 时直接用Aes加密解密,false 时用iv+(encryptData(timestamp+encryptData(content)))加密 Compress string `json:"compress"` // 空 or gzip 或者 br CompressLength int64 `json:"compressLength"` // 压缩判断长度 Request struct { Key string `json:"key"` Iv string `json:"iv"` } `json:"request"` Response struct { Key string `json:"key"` Iv string `json:"iv"` } `json:"response"` } type ( EncryptConfig struct { Key []byte `json:"key"` Iv []byte `json:"iv"` KeyStr string `json:"key_str"` IvStr string `json:"iv_str"` } ProductInfo struct { Log bool `json:"log"` EncryptEnable bool RequestEncryptConfig *EncryptConfig ResponseEncryptConfig *EncryptConfig AesDirect bool CompressMethod string CompressLength int64 // 压缩判断长度 } )