p2p

package
v0.0.0-...-7ac3615 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: BSD-3-Clause-Clear Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	P2P_PROTOID_GLOBAL_REGISTER       int32 = 1101
	P2P_PROTOID_GLOBAL_RETURN_ADDRESS int32 = 1102

	P2P_PROTOID_PING    int32 = 2101
	P2P_PROTOID_PONG    int32 = 2102
	P2P_PROTOID_PONGRET int32 = 2103
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BeanClientRegister

type BeanClientRegister struct {
	Zone      string `json:"Zone"`
	IncludeMe bool   `json:"IncludeMe"`
}

type BeanClientRegisterRet

type BeanClientRegisterRet struct {
	Zone        string `json:"Zone"`
	GatewayAddr string
	ClientAddrs []string
}

type P2PConnection

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

func (*P2PConnection) BroadMessage

func (p2p *P2PConnection) BroadMessage(code int32, msg string)

func (*P2PConnection) ConnectPublic

func (p2p *P2PConnection) ConnectPublic()

func (*P2PConnection) FetchMyPublicAddress

func (p2p *P2PConnection) FetchMyPublicAddress()

func (*P2PConnection) FetchOtherAddressInGroup

func (p2p *P2PConnection) FetchOtherAddressInGroup()

func (*P2PConnection) GetOtherConnection

func (p2p *P2PConnection) GetOtherConnection() *udpex.UDPConnection

func (*P2PConnection) Init

func (p2p *P2PConnection) Init(publicServer string)

func (*P2PConnection) OnMessage

func (p2p *P2PConnection) OnMessage(msg string)

func (*P2PConnection) OnRecv

func (t *P2PConnection) OnRecv(conn *udpex.UDPConnection, code int32, data []byte)

func (*P2PConnection) OnSentEmpty

func (t *P2PConnection) OnSentEmpty()

发送空了

func (*P2PConnection) OnSentSuccess

func (t *P2PConnection) OnSentSuccess(code int32)

发送成功接口

type P2PGlobalServer

type P2PGlobalServer struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*P2PGlobalServer) Init

func (p2ps *P2PGlobalServer) Init(listenaddr string)

func (*P2PGlobalServer) OnClientDead

func (t *P2PGlobalServer) OnClientDead(conn *udpex.UDPConnection)

链接断开

func (*P2PGlobalServer) OnRecv

func (t *P2PGlobalServer) OnRecv(conn *udpex.UDPConnection, code int32, data []byte)

func (*P2PGlobalServer) OnSentEmpty

func (t *P2PGlobalServer) OnSentEmpty()

发送空了

func (*P2PGlobalServer) OnSentSuccess

func (t *P2PGlobalServer) OnSentSuccess(code int32)

发送成功接口

func (*P2PGlobalServer) Register

func (t *P2PGlobalServer) Register(conn *udpex.UDPConnection, reg *BeanClientRegister)

type Pingpng

type Pingpng struct {
	Value int64 `json:"Value"`
}

type RemoteClient

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

func (*RemoteClient) OnRecv

func (t *RemoteClient) OnRecv(conn *udpex.UDPConnection, code int32, data []byte)

func (*RemoteClient) OnSentEmpty

func (t *RemoteClient) OnSentEmpty()

发送空了

func (*RemoteClient) OnSentSuccess

func (t *RemoteClient) OnSentSuccess(code int32)

发送成功接口

Jump to

Keyboard shortcuts

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