utils

package module
v0.0.0-...-1b1ae58 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

README

License Build Status GoDoc Coverage Status Go Report Card Repo Size Gitter

go-utils

Feature / 功能

  • ✅ 检查域名HTTPS证书有效期 / Check the validity of domain name certificate
  • ✅ 获取域名IP / Get domain IP
  • ✅ 获取Ipv4地址的Ping延迟 / Ping delay of getting IPv4 address
  • ✅ Git clone 功能 / Git clone function
  • ✅ Tar 打包、解压功能 / Tar packaging, decompression function
  • ✅ 读写文件,支持追加和覆盖两种模式 / Read and write files, support two modes of append and overlay
  • ✅ 远程SSH指令 / Remote SSH instruction
  • ✅ 按行循环读取文件每一行 / Read each line of the file in a row cycle
  • ✅ 随机生成随机字符串,包括字符和数字 / Randomly generate random strings, including characters and numbers
  • ✅ 制造多channel执行Func / Manufacturing multi channel executive func
  • ✅ 任务执行进度条 / Task execution progress bar
  • ✅ 模版文件生成 / Template file generation
  • ✅ 加解密,包括base64 / Encryption and decryption, including Base64
  • ✅ FTP文件下载,支持密码认证下载/ FTP file download, support password authentication download
  • ✅ 模拟Wget下载文件 / Simulate WGet download file
  • ✅ 将HTTP链接生成二维码 / Generate QR code from HTTP link
  • ✅ 获取指定目录或所有子目录下的所有文件,可以匹配后缀过滤 / Gets all files in the specified directory or all subdirectories to match suffix filtering

Todo / 待做

  • 支持定时任务 / Support timed tasks

Documentation

Index

Constants

View Source
const MailMess = `` /* 477-byte string literal not displayed */

Variables

This section is empty.

Functions

func AlgorithmRandomCharacter

func AlgorithmRandomCharacter(n int) string

随机一个10位数字符串,包括数字和字符 Random a 10 digit string, including numbers and characters

func AlgorithmRandomNum

func AlgorithmRandomNum(n int) int64

随机数字 Generating random numbers Within parameter range

func AuthClone

func AuthClone(GitTmpDir, GitDir, AppName, Url, gitUser, GitPasswd string) error

func Base64Decode

func Base64Decode(decodeStr []byte) string

func Base64Encode

func Base64Encode(encodeStr string) string

func CheckIp

func CheckIp(ip string) bool

func CheckPort

func CheckPort(ip net.IP, port int) error

func ChkHTTPSCert

func ChkHTTPSCert(domainName string, DetailedOutput bool) int64

检测https域名的证书有效期

func Clone

func Clone(GitTmpDir, GitDir, AppName, Url string) error

func CuttingFtpFileAddress

func CuttingFtpFileAddress(FtpFileUrl string, DetailedOutput bool) (string, string, string)

func DayEmail

func DayEmail(mailMess string)

func Decompression

func Decompression(srcFile, dsrDir string) error

func DlFile

func DlFile(SavePath, Url string, TimeOutNum time.Duration) bool

func DlFileUseWget

func DlFileUseWget(FileUrl, SavePath string) error

func DlFtpFile

func DlFtpFile(FtpPort, FtpFileUrl, SavePath string, DetailedOutput bool) error

download ftp file,support Ftp auth

func FindDirAllFile

func FindDirAllFile(dirPath, suffix string) (files []string, err error)

func FindDirAllFileNoSuffix

func FindDirAllFileNoSuffix(dirPath string) (files []string, err error)

func ForFileLines

func ForFileLines(FileName string, DetailedOutput bool) ([]string, error)

按行读取文件, 传入文件路径

func ForFileLinesExecFunc

func ForFileLinesExecFunc(FileName string, FuncName func(string2 string)) error

按行读取文件并执行函数,传入文件路径、执行函数名称

func FormShow

func FormShow()

func GenerateQrCode

func GenerateQrCode(URL, QrCodePath string, DetailedOutput bool)

func GenerateTpl

func GenerateTpl(WFilePath, TplPath string, TplStruct interface{}, DetailedOutput bool) (error, string)

func GetDomainIP

func GetDomainIP(DNSServer, Domain string) string

func GetIpv4IpICMP

func GetIpv4IpICMP(Ipv4Addr string)

func IsDir

func IsDir(path string) bool

func ListFileDir

func ListFileDir(dirPath, suffix string) (files []string, err error)

func LocalCMD

func LocalCMD(cmdStr string, Args []string) (err error, ProcessState *os.ProcessState, OutInfo string)

func MakeChannel

func MakeChannel(numSum int, Func func())

func ProgressBar

func ProgressBar(FuncName string, Count int64, Func func())

func RM

func RM(path string, onlyFileEmpty bool) error

func RMUtils

func RMUtils(path string, onlyEmpty bool) error

func ReadFile2StrMain

func ReadFile2StrMain(FileName string, DetailedOutput bool) (string, error)

func RemoteCmd

func RemoteCmd(IP, Port, User, CMD, idRsaPath string) (string, error)

func SftpDownload

func SftpDownload(isPasswd bool, username, passwd, sftpServer, PublicKeysPath, LocalDirPath, RemoteFilePath string, sftpPort int) error

func SftpUpload

func SftpUpload(isPasswd bool, username, passwd, sftpServer, PublicKeysPath, LocalFilePath, RemoteDirPath string, sftpPort int) error

func Tar

func Tar(src []string, dst string) error

func WfMain

func WfMain(FileName, contentString string, IsCover, DetailedOutput bool) bool

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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