Utils

package
v0.0.0-...-eedd94a Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64_decode

func Base64_decode(dec string) string

func Base64_encode

func Base64_encode(src string) string

func CheckErr

func CheckErr(err error)

func CheckNetwork

func CheckNetwork(ip, port string) (bool, error)

func CheckServerAlive

func CheckServerAlive(addr string) (bool, error)

func Compress

func Compress(file *os.File, dest string) error

压缩 使用gzip压缩成tar.gz

func DeCompress

func DeCompress(tarFile, dest string) error

解压 tar.gz

func FtpConnect

func FtpConnect(user, password, host, port, path string) (*goftp.FTP, error)

func FtpUploadFile

func FtpUploadFile(ftp *goftp.FTP, localFile string) error

func GetAttachMsg

func GetAttachMsg(body, email, toEmail, Subject, attaFile string) []byte

func GetCPUPercent

func GetCPUPercent() int

func GetClientIP

func GetClientIP(RemoteAddr string) (string, error)

func GetDNS

func GetDNS() ([]string, error)

func GetDateTimeStamp

func GetDateTimeStamp(date string) int64

func GetDiskPercent

func GetDiskPercent() int

func GetGateway

func GetGateway() (string, error)

func GetHostname

func GetHostname() string

func GetLastMonthStart

func GetLastMonthStart() int64

func GetLastYearStart

func GetLastYearStart() int64

func GetMemoryPercent

func GetMemoryPercent() int

func GetThisMonthStart

func GetThisMonthStart() int64

func GetThisYearStart

func GetThisYearStart() int64

func GetTime

func GetTime() string

func HourTimestamp

func HourTimestamp() int64

func MD5

func MD5(str string) string

func PathExists

func PathExists(path string) bool

func SSHConnect

func SSHConnect(user, password, host, port string) (*sftp.Client, error)

func SendMail

func SendMail(server, portSTR, email, pwd, toEmail, Subject, Content, file string) error

func SendMailUsingTLS

func SendMailUsingTLS(addr string, auth smtp.Auth, from string,
	to []string, msg []byte) (err error)

参考net/smtp的func SendMail() 使用net.Dial连接tls(ssl)端口时,smtp.NewClient()会卡住且不提示err len(to)>1时,to[1]开始提示是密送

func SendToMail

func SendToMail(addr string, auth smtp.Auth, from string, to []string, msg []byte) error

不使用SSL

func SetDNS

func SetDNS(newDns []string) error

func SetHostname

func SetHostname(hostname string) error

func SftpUploadFile

func SftpUploadFile(sftpClient *sftp.Client, localFile, remotePath string) error

func SmtpConnect

func SmtpConnect(addr string) (*smtp.Client, error)

return a smtp client

func TodayTimestamp

func TodayTimestamp() int64

func UpdateTime

func UpdateTime(server string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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