cmd

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_PADDING_SIZE = 2
	DEFAULT_PADDING      = "  "

	DEFAULT_HOST_PADDING_SIZE = 15
)

Variables

View Source
var Commit string
View Source
var CommitDate string
View Source
var Version string

Functions

func Psize

func Psize(displayRawValue bool, s int64) string

Psize takes a float and returns a human readable string.

func ScanPort added in v1.0.3

func ScanPort(protocol string, hostname string, port int) bool

Types

type API added in v1.0.3

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

func NewAPI added in v1.0.3

func NewAPI() *API

func (*API) Route added in v1.0.3

func (a *API) Route(uids []string) (map[string]string, error)

func (*API) SetBaseURL added in v1.0.3

func (a *API) SetBaseURL(baseURL string)

func (*API) Varz added in v1.0.3

func (a *API) Varz() (*Varz, error)

type CMD

type CMD interface {
	CMD() *cobra.Command
}

type ConnInfo

type ConnInfo struct {
	ID           int64     `json:"id"`            // 连接ID
	UID          string    `json:"uid"`           // 用户uid
	IP           string    `json:"ip"`            // 客户端IP
	Port         int       `json:"port"`          // 客户端端口
	LastActivity time.Time `json:"last_activity"` // 最后一次活动时间
	Uptime       string    `json:"uptime"`        // 启动时间
	Idle         string    `json:"idle"`          // 客户端闲置时间
	PendingBytes int       `json:"pending_bytes"` // 等待发送的字节数
	InMsgs       int64     `json:"in_msgs"`       // 流入的消息数
	OutMsgs      int64     `json:"out_msgs"`      // 流出的消息数量
	InBytes      int64     `json:"in_bytes"`      // 流入的字节数量
	OutBytes     int64     `json:"out_bytes"`     // 流出的字节数量
	Device       string    `json:"device"`        // 设备
	DeviceID     string    `json:"device_id"`     // 设备ID
	Version      uint8     `json:"version"`       // 客户端协议版本
}

type Connz

type Connz struct {
	Connections []*ConnInfo `json:"connections"` // 连接数
	Now         time.Time   `json:"now"`         // 查询时间
	Total       int         `json:"total"`       // 总连接数量
	Offset      int         `json:"offset"`      // 偏移位置
	Limit       int         `json:"limit"`       // 限制数量
}

type Options

type Options struct {
	ServerAddr  string
	Description string
	Token       string
}

func NewOptions

func NewOptions() *Options

func (*Options) ContextDir

func (o *Options) ContextDir() string

func (*Options) ContextPath

func (o *Options) ContextPath(name string) (string, error)

func (*Options) Load

func (o *Options) Load() error

func (*Options) Save

func (o *Options) Save(name string) error

type Rates

type Rates struct {
	InMsgsRate   float64
	OutMsgsRate  float64
	InBytesRate  float64
	OutBytesRate float64
}

type RedrawCause

type RedrawCause int
const (
	DueToNewStats RedrawCause = iota
	DueToViewportResize
)

type SortOpt

type SortOpt string
const (
	ByID SortOpt = "id" // By connection ID
)

func (SortOpt) IsValid

func (s SortOpt) IsValid() bool

type Stats

type Stats struct {
	Varz  *Varz
	Connz *Connz
	Rates *Rates
	Error error
}

type Varz

type Varz struct {
	ServerID    string  `json:"server_id"`   // 服务端ID
	ServerName  string  `json:"server_name"` // 服务端名称
	Version     string  `json:"version"`     // 服务端版本
	Connections int     `json:"connections"` // 当前连接数量
	Uptime      string  `json:"uptime"`      // 上线时间
	Mem         int64   `json:"mem"`         // 内存
	CPU         float64 `json:"cpu"`         // cpu

	InMsgs        int64 `json:"in_msgs"`        // 流入消息数量
	OutMsgs       int64 `json:"out_msgs"`       // 流出消息数量
	InBytes       int64 `json:"in_bytes"`       // 流入字节数量
	OutBytes      int64 `json:"out_bytes"`      // 流出字节数量
	SlowConsumers int64 `json:"slow_consumers"` // 慢客户端数量

	TCPAddr     string `json:"tcp_addr"`     // tcp地址
	WSAddr      string `json:"ws_addr"`      // wss地址
	MonitorAddr string `json:"monitor_addr"` // 监控地址
	MonitorOn   int    `json:"monitor_on"`   // 监控是否开启
	Commit      string `json:"commit"`       // git commit id
	CommitDate  string `json:"commit_date"`  // git commit date
	TreeState   string `json:"tree_state"`   // git tree state
}

type ViewMode

type ViewMode int
const (
	TopViewMode ViewMode = iota
	HelpViewMode
)

type WuKongIM

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

func NewWuKongIM

func NewWuKongIM() *WuKongIM

func (*WuKongIM) Execute

func (l *WuKongIM) Execute()

type WuKongIMContext

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

func NewWuKongIMContext

func NewWuKongIMContext(w *WuKongIM) *WuKongIMContext

Jump to

Keyboard shortcuts

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