utils

package
v0.0.0-...-96491ad Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultServicePort

func GetDefaultServicePort(ctx *common.Context) int32

GetDefaultServicePort : 获取缺省的对外端口

func GetIP

func GetIP(ctx *common.Context, t IPType) string

GetIP : 根据类型获取IP

func GetIPInner

func GetIPInner(ctx *common.Context) string

GetIPInner : 获取内网 IP

func GetIPOuter

func GetIPOuter(ctx *common.Context) string

GetIPOuter : 获取外网 IP

func GetIntranetListenPort

func GetIntranetListenPort(ctx *common.Context) int32

GetIntranetListenPort : 获取服务器组内监听端口

Types

type IComponent

type IComponent interface {
	Start() bool
	Close()
}

IComponent : 组件接口

type IPType

type IPType int

IPType : IP 类型

const (
	// IPINNER : 类型 0 ,内网 IP
	IPINNER IPType = iota

	// IPOUTER : 类型 1 ,外网 IP
	IPOUTER
)

type PortType

type PortType int

PortType : PORT 类型

const (
	// PORTFORCLIENT : 端口类型(对客户端)
	PORTFORCLIENT PortType = iota

	// PORTFORINTRANET : 端口类型(对内网)
	PORTFORINTRANET
)

type Ticker

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

Ticker : 定时器帮助类

func NewTickerHelper

func NewTickerHelper(name string, ctx *common.Context, interval time.Duration, f func()) *Ticker

NewTickerHelper : 定时器帮助类的构造函数

func (*Ticker) Close

func (helper *Ticker) Close()

Close : 结束

func (*Ticker) Start

func (helper *Ticker) Start() bool

Start : 开始

Jump to

Keyboard shortcuts

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