utils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatAddress

func FormatAddress(addr string) string

format address

func IP2Long

func IP2Long(ip string) uint64

将IP转换为整型

func IsIPv4 added in v0.0.10

func IsIPv4(ip string) bool

判断是否为IPv4

func IsIPv6 added in v0.0.10

func IsIPv6(ip string) bool

判断是否为IPv6

func LookupCNAME

func LookupCNAME(host string) (string, error)

LookupCNAME 获取CNAME

func PrintError

func PrintError(err error)

func Recover

func Recover()

func SplitNumbers

func SplitNumbers(numbers string) (result []int64)

分割数字

Types

type ServiceManager

type ServiceManager struct {
	Name        string
	Description string
	// contains filtered or unexported fields
}

服务管理器

func NewServiceManager

func NewServiceManager(name, description string) *ServiceManager

获取对象

func (*ServiceManager) Close

func (this *ServiceManager) Close() error

关闭

func (*ServiceManager) Install

func (this *ServiceManager) Install(exePath string, args []string) error

安装服务

func (*ServiceManager) Log

func (this *ServiceManager) Log(msg string)

记录普通日志

func (*ServiceManager) LogError

func (this *ServiceManager) LogError(msg string)

记录错误日志

func (*ServiceManager) PauseWindow

func (this *ServiceManager) PauseWindow()

保持命令行窗口是打开的

func (*ServiceManager) Start

func (this *ServiceManager) Start() error

启动服务

func (*ServiceManager) Uninstall

func (this *ServiceManager) Uninstall() error

删除服务

type Ticker

type Ticker struct {
	S chan bool
	C <-chan time.Time
	// contains filtered or unexported fields
}

类似于time.Ticker,但能够真正地停止

func NewTicker

func NewTicker(duration time.Duration) *Ticker

创建新Ticker

func (*Ticker) Next

func (this *Ticker) Next() bool

查找下一个Tick

func (*Ticker) Stop

func (this *Ticker) Stop()

停止

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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