rcon

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MulanPSL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxRCONPackageSize = 4096
	// DefaultDialTimeout 远程服务器默认身份验证超时.
	DefaultDialTimeout = 5 * time.Second

	// DefaultDeadline TCP 读写操作默认截止时间.
	DefaultDeadline = 5 * time.Second

	// ServerdataAuth 是客户端发送的第一个数据包,用于向服务器验证连接
	ServerdataAuth int32 = 3

	// ServerdataAuthResponse 数据包是 conn 当前身份验证状态的通知。
	//	当服务器收到身份验证请求时,它将以空SERVERDATA_RESPONSE_VALUE进行响应,后跟指示身份验证是成功还是失败的SERVERDATA_AUTH_RESPONSE。请注意,状态代码在数据包 id 字段中返回,
	//	因此在将响应与原始身份验证请求配对时,您可能需要查看前面 SERVERDATA_RESPONSE_VALUE 的数据包 ID。
	//	如果身份验证成功,则为请求分配的 ID。如果身份验证失败,则为 -1 (0xFF FF FF FF)。
	ServerdataAuthResponse int32 = 2

	// ServerdataResponseValue 数据包是对SERVERDATA_EXECCOMMAND请求的响应
	ServerdataResponseValue int32 = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

Conn is source RCON generic stream-oriented network connection.

func Dial

func Dial(address string, password string, options ...time.Duration) (*Conn, error)

Dial 创建新的授权连接 TCP 拨号器连接,

address:服务器地址 ip+post
password: rcon链接密码
options: 链接超时配置 dialTimeout = 5 * time.Second | deadline = 5 * time.Second

func (*Conn) Close

func (c *Conn) Close() error

Close closes the connection.

func (*Conn) ListUser

func (c *Conn) ListUser() []string

func (*Conn) Send

func (c *Conn) Send(cmd string) (string, error)

Jump to

Keyboard shortcuts

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