debug

package
v0.0.0-...-8d187f3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOG_LEVEL_CMD_SHOW = iota
	LOG_LEVEL_CMD_SET
)
View Source
const (
	DEFAULT_LISTEN_PORT = 9528
	UDP_MAXLEN          = 9710
	MAX_PAYLOAD_LEN     = UDP_MAXLEN - 128 //发送时会封装为DebugMessage,净荷为DebugMessage的Args
	MODULE_MAX          = 32
)
View Source
const (
	LOG_LEVEL_CMD = 20
)

Variables

This section is empty.

Functions

func ClientRegisterSimple

func ClientRegisterSimple(moduleId ModuleId, module CmdHelper, operates []CmdHelper) *cobra.Command

client注册命令

func CommmandGetResult

func CommmandGetResult(mid ModuleId, operate int, arg string) (string, error)

func GetOrgId

func GetOrgId() uint16

func RecvFromServer

func RecvFromServer(conn *net.UDPConn) (*bytes.Buffer, error)

func RecvFromServerMulti

func RecvFromServerMulti(conn *net.UDPConn) (*bytes.Buffer, error)

func Register

func Register(module ModuleId, process CommandLineProcess)

server端注册命令处理

func RegisterCommand

func RegisterCommand(root *cobra.Command, moduleId ModuleId, handle RegisterCommmandLine)

client注册命令处理

func RegisterLogLevelCommand

func RegisterLogLevelCommand() *cobra.Command

客户端注册命令

func SendToClient

func SendToClient(conn *net.UDPConn, remote *net.UDPAddr, result uint32, args *bytes.Buffer)

func SendToServer

func SendToServer(module ModuleId, operate ModuleOperate, args *bytes.Buffer) (*net.UDPConn, *bytes.Buffer, error)

func ServerRegisterSimple

func ServerRegisterSimple(module ModuleId, process CommandSimpleProcess)

server端注册简单命令, module值要大于MODULE_MAX, 小于2*MODULE_MAX

func SetIpAndPort

func SetIpAndPort(ip string, port int)

func SetOrgId

func SetOrgId(id int)

Types

type CmdHelper

type CmdHelper struct {
	Cmd    string
	Helper string
}

type CommandLineProcess

type CommandLineProcess interface {
	RecvCommand(conn *net.UDPConn, remote *net.UDPAddr, operate uint16, arg *bytes.Buffer)
}

type CommandSimpleProcess

type CommandSimpleProcess interface {
	HandleSimpleCommand(operate uint16, arg string) string
}

增加简单的命令接口, 支持一个字符串输入参数

type DebugMessage

type DebugMessage struct {
	Module, Operate uint16
	Result          uint32
	Args            []byte
}

type LogLevelControl

type LogLevelControl struct {
}

func NewLogLevelControl

func NewLogLevelControl() *LogLevelControl

func (*LogLevelControl) RecvCommand

func (l *LogLevelControl) RecvCommand(conn *net.UDPConn, remote *net.UDPAddr, operate uint16, arg *bytes.Buffer)

type ModuleId

type ModuleId uint16

type ModuleOperate

type ModuleOperate uint16

type RegisterCommmandLine

type RegisterCommmandLine func(moduleId ModuleId) *cobra.Command

Jump to

Keyboard shortcuts

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