utility

package
v0.0.0-...-f4e4f33 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 12 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMime

func AddMime(reqest *http.Request, mime string)

func ComputeEtag

func ComputeEtag(data []byte) (etag string)

func ComputeFileEtag

func ComputeFileEtag(filename string) (etag string, err error)

func CreateGetRequest

func CreateGetRequest(url string) (request *http.Request, err error)

func CreatePostRequest

func CreatePostRequest(url string) (request *http.Request, err error)

func GetUuid

func GetUuid() (uuid string)

func MakeQuery

func MakeQuery(v url.Values) string

func SetUserAgent

func SetUserAgent(ua string)

func StdEncodeString

func StdEncodeString(str string) string

func UrlSafeEncode

func UrlSafeEncode(data []byte) string

func UrlSafeEncodePair

func UrlSafeEncodePair(bucket string, key string) string

func UrlSafeEncodeString

func UrlSafeEncodeString(str string) string

Types

type Auth

type Auth struct {
	AccessKey string
	SecretKey []byte
}

func NewAuth

func NewAuth(accessKey, secretKey string) (auth *Auth)

func (*Auth) CreateUploadToken

func (this *Auth) CreateUploadToken(put_policy string) (token string)

/ <summary> / 生成上传凭证 / https://wcs.chinanetcenter.com/document/API/Token/UploadToken / https://wcs.chinanetcenter.com/document/Tools/GenerateUploadToken / </summary> / <param name="putPolicy">上传策略,JSON 字符串</param> / <returns>上传凭证</returns>

func (*Auth) Sign

func (this *Auth) Sign(data []byte) (token string)

Signature { public

func (*Auth) SignWithData

func (this *Auth) SignWithData(data []byte) (token string)

type HttpManager

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

func NewDefaultHttpManager

func NewDefaultHttpManager() (http_manager *HttpManager)

func NewHttpManager

func NewHttpManager(client *http.Client) (http_manager *HttpManager)

func (*HttpManager) Do

func (http_manager *HttpManager) Do(reqest *http.Request) (response *http.Response, err error)

func (*HttpManager) DoWithAuth

func (this *HttpManager) DoWithAuth(reqest *http.Request, auth *Auth) (response *http.Response, err error)

func (*HttpManager) DoWithToken

func (this *HttpManager) DoWithToken(reqest *http.Request, token string) (response *http.Response, err error)

func (*HttpManager) GetClient

func (http_manager *HttpManager) GetClient() (client *http.Client)

Jump to

Keyboard shortcuts

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