utils

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const RetryTimes = 10

Variables

This section is empty.

Functions

func FileNameStrip

func FileNameStrip(fullName string) string

func FileSha1

func FileSha1(filePath string) (hexDigest string, err error)

func Get

func Get(urlGet string, headers map[string]string, data map[string]string) ([]byte, error)

func GetWithResponse

func GetWithResponse(urlGet string, headers map[string]string, data map[string]string) ([]byte, *http.Response, error)

func NewClient

func NewClient() *http.Client

不要反复创建Client,它应该全局唯一

func PostForm

func PostForm(urlPost string, headers map[string]string, data map[string]string) ([]byte, error)

func PostFormWithResponse

func PostFormWithResponse(urlPost string, headers map[string]string,
	data map[string]string) ([]byte, *http.Response, error)

func ReadCookieFile

func ReadCookieFile() (string, error)

一定要在main中的init函数之后运行

func Request

func Request(method, url string, body io.Reader, headers map[string]string) (*http.Response, error)

func ReverseStrings

func ReverseStrings(s []string)

func Sha1

func Sha1(content []byte) string

Types

type Cipher

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

Cipher 加密解密信息

func NewCipher

func NewCipher() (*Cipher, error)

NewCipher 新建Cipher

func (*Cipher) Decrypt

func (c *Cipher) Decrypt(cipherText []byte) ([]byte, error)

Decrypt 解密,一次加密对应一次解密

func (*Cipher) Encrypt

func (c *Cipher) Encrypt(plainText []byte) ([]byte, error)

Encrypt 加密,一次加密对应一次解密

type WaitGroupPool

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

func NewWaitGroupPool

func NewWaitGroupPool(size int) *WaitGroupPool

func (*WaitGroupPool) Add

func (p *WaitGroupPool) Add()

func (*WaitGroupPool) Done

func (p *WaitGroupPool) Done()

func (*WaitGroupPool) Size

func (p *WaitGroupPool) Size() int

func (*WaitGroupPool) Wait

func (p *WaitGroupPool) Wait()

Jump to

Keyboard shortcuts

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