pub

package module
v0.0.0-...-eeeeb4e Latest Latest
Warning

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

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

README

pub

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UseProxy = true

	CookieBilibili string
)

Functions

func AesDecrypt

func AesDecrypt(crypted, key []byte, ivs ...[]byte) ([]byte, error)

func AesEncrypt

func AesEncrypt(origData, key []byte) ([]byte, error)

func AppendData

func AppendData(data []byte, prefixData []byte, suffixData []byte) []byte

func Base64ToStr

func Base64ToStr(Base64 string) string

func ByteCountIEC

func ByteCountIEC(b int64) string

以1024作为基数

func ByteCountSI

func ByteCountSI(b int64) string

以1000作为基数

func CheckDirDelete

func CheckDirDelete(dirPth, savePath string) (err error)

func CheckError

func CheckError(e error)

panic("something went wrong") 检测错误后打印

func CustomBoundary

func CustomBoundary() string

func DataToImage

func DataToImage(data []byte) []byte

func DownloadBFile

func DownloadBFile(finalURL, outputFilePath string) error

下载并合并分段数据到文件

func DownloadFileFromB

func DownloadFileFromB(url string) ([]byte, error)

func DownloadFileFromBx

func DownloadFileFromBx(url string) ([]byte, error)

func DownloadPartData

func DownloadPartData(fileUrl string, Header map[string][]string) ([]byte, error)

func FetchHTTPRequest

func FetchHTTPRequest(fetchReq FetchRequest) string

func FileSplitCount

func FileSplitCount(fileSize int64, splitSize int64) int

func FileToImage

func FileToImage(filename string, imgName string)

func FunProcessTime

func FunProcessTime(函数名字 string, start time.Time)

func FunTime

func FunTime(start time.Time, timeLimit time.Duration)

函数用时 用于检查执行时间是否超过限制,并输出警告信息。 参数:

  • tag: 标签用于标识警告的来源
  • detailed: 详细信息,描述执行的具体内容
  • start: 开始时间,表示代码开始执行的时间点
  • timeLimit: 时间限制,表示允许的最长执行时间

func GZipBytes

func GZipBytes(data []byte) []byte

压缩

func GenerateBoundary

func GenerateBoundary() string

生成boundary值

func GetBetweenStr

func GetBetweenStr(str, starting, ending string) (retStr string)

func GetByteMd5

func GetByteMd5(data []byte) string

获取数据的md5码

func GetCurrentFunctionName

func GetCurrentFunctionName() string

func GetFileMd5

func GetFileMd5(filename string) string

获取文件的md5码

func GetFileModTime

func GetFileModTime(pathname string) int64

获取文件原来的访问时间,修改时间

func GetFileSize

func GetFileSize(pathname string) int64

func GetPercent

func GetPercent(DoneCount, FileCount int) int

func GetRandomInt

func GetRandomInt(min, max int) int

func GetUserAgent

func GetUserAgent() string

func Go

func Go(x func())

func GorequestGet

func GorequestGet(Url string) []byte

func ImageToData

func ImageToData(imageData []byte) []byte

func ImageToFile

func ImageToFile(imgName string, filename string)

func InitConfig

func InitConfig(path string) map[string]string

读取key=value类型的配置文件

func IsDebugMode

func IsDebugMode() bool

func IsFile

func IsFile(f string) bool

func LoadFromGob

func LoadFromGob(filename string) ([]map[string]string, error)

从 Gob 文件中加载数据

func MakeFileSize

func MakeFileSize(fileName string, fileSize int64)

func MergeBytes

func MergeBytes(a, b []byte, index int) []byte

func MergeBytesTruncateA

func MergeBytesTruncateA(a, b []byte, index int) []byte

func NewUUID

func NewUUID() string

func PKCS5Padding

func PKCS5Padding(ciphertext []byte, blockSize int) []byte

func PKCS7UnPadding

func PKCS7UnPadding(origData []byte) []byte

func PathExists

func PathExists(path string) bool

判断文件是否存在

func PostData

func PostData(PostUrl string, Header http.Header, Data []byte) (ret string, err error)

func PostcData

func PostcData(PostUrl string, cData []byte, Header map[string][]string) string

func Println

func Println(v ...interface{})

func ProcessPostData

func ProcessPostData(Data []byte) []byte

func QrcodeFile

func QrcodeFile(text string, size int) []byte

func QrcodeGifFile

func QrcodeGifFile(text string, size int) []byte

func RandInt

func RandInt(min, max int) int

func RandStringRunes

func RandStringRunes(n int) string

func RandomFileFromZip

func RandomFileFromZip(zipPath string) ([]byte, error)

RandomFileFromZip 从ZIP文件中随机选取一个文件并返回其内容

func ReadIni

func ReadIni(iniFileName, Section, key string) *ini.Key

func ResizeImage

func ResizeImage(img image.Image, width, height int) image.Image

func ReverseBytes

func ReverseBytes(data []byte)

func SaveToGob

func SaveToGob(filename string, data []map[string]string) error

将数据保存到 Gob 文件

func StrToBase64

func StrToBase64(Str string) string

func UGZipBytes

func UGZipBytes(data []byte) []byte

解压

func UploadDataToB

func UploadDataToB(tsData []byte) string

上传数据到bilibili

func UploadFileToB

func UploadFileToB(filePath string, partSize int) (string, error)

func WriteIni

func WriteIni(iniFileName, Section, key, value string)

func WriteLog

func WriteLog(info string, fileName string, addTime bool) bool

Types

type FetchRequest

type FetchRequest struct {
	URL     string            `json:"url"`
	Method  string            `json:"method"`
	Headers map[string]string `json:"headers"`
	Body    []byte            `json:"body"`
}

func FetchToJSON

func FetchToJSON(fetchCall string) (FetchRequest, error)

func ParseRawRequest

func ParseRawRequest(rawRequest string) FetchRequest

Jump to

Keyboard shortcuts

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