Documentation ¶
Index ¶
- Constants
- func GenSignature(c *gin.Context) string
- func Get(httpClient *http.Client, url string, header map[string]string, retry int) (*http.Response, error)
- func NewHTTPClient(timeout time.Duration) *http.Client
- func Post(httpClient *http.Client, url string, body []byte, header map[string]string, ...) (*http.Response, error)
- func VerifyAuthorization(c *gin.Context) error
Constants ¶
View Source
const ( // HTTPSignatureSecret 秘钥 HTTPSignatureSecret = "abcdefghijklnmop" // HTTPSignatureSalt 盐 HTTPSignatureSalt = "abcdefghijklnmop" // SignatureField signature SignatureField = "signature" )
View Source
const (
// PublicKeyField public key
PublicKeyField = "public_key"
)
Variables ¶
This section is empty.
Functions ¶
func GenSignature ¶
GenSignature get http signature 1. get url path 2. sort request form params 3. combine params + secret + sigTime + salt 4. calculator md5 5. shuffle md5 byte
func Get ¶
func Get(httpClient *http.Client, url string, header map[string]string, retry int) (*http.Response, error)
Get http get request @httpClient required @url required @body optional @header optional @retry required
func NewHTTPClient ¶
NewHTTPClient new http.Client should open keep alive
func Post ¶
func Post(httpClient *http.Client, url string, body []byte, header map[string]string, retry int) (*http.Response, error)
Post http post request @httpClient required @url required @body optional @header optional @retry required
func VerifyAuthorization ¶
VerifyAuthorization verify authorization always return true mean verify pass, if return false mean verify failed
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.