client

package
v0.0.0-...-6d0c0f3 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Id        string
	SessionId string
	//需要连接的服务端地址
	ServerAddress string

	NetConn       net.PacketConn
	QuicConn      *quic.Conn
	Socket        *network.Socket
	StreamConfigs []network.StreamConfig
	network.Config
	ice.IceWorker
	framework.CloseableObject

	OnSocketConnected network.SocketCallbackFunc
	// contains filtered or unexported fields
}

Client 客户端

func NewClient

func NewClient(addr string, id string) *Client

NewClient 创建客户端实例

func (*Client) CloseChannel

func (cli *Client) CloseChannel(channelId int) bool

func (*Client) Connect

func (cli *Client) Connect(channelCount int, networkType string, onDisconnect network.SocketCallbackFunc) error

func (*Client) ConnectByIce

func (cli *Client) ConnectByIce(conn net.PacketConn, dummyAddr net.Addr) error

ConnectByIce 通过Ice连接

-param conn:通过Ice获取到的连接
-param dummyAddr:通过ice获取的连接的目标地址,注意:因为使用的是已知打通的 PacketConn,Target Address 可以使用 Dummy 虚拟地址

return: 返回错误

func (*Client) ConnectToNet

func (cli *Client) ConnectToNet(channelCount int, conn net.PacketConn, addr net.Addr, onDisconnect network.SocketCallbackFunc) error

func (*Client) OnClosed

func (cli *Client) OnClosed() error

func (*Client) OnClosing

func (cli *Client) OnClosing() bool

func (*Client) Send

func (cli *Client) Send(channelId int, data []byte) (bool, error)

Jump to

Keyboard shortcuts

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