enet

package
v0.0.0-...-727d1a2 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeConnect    = C.ENET_EVENT_TYPE_CONNECT
	EventTypeDisconnect = C.ENET_EVENT_TYPE_DISCONNECT
	EventTypeReceive    = C.ENET_EVENT_TYPE_RECEIVE
)
View Source
const (
	PacketFlagNone               = 0
	PacketFlagReliabe            = (1 << 0)
	PacketFlagUnsequenced        = (1 << 1)
	PacketFlagNoAllocate         = (1 << 2)
	PacketFlagUnreliableFragment = (1 << 3)
	PacketFlagSent               = (1 << 8)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type      EventType
	Peer      *Peer
	ChannelID uint8
	Data      uint32
	Packet    *Packet
}

type EventType

type EventType uint

type Host

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

func NewHost

func NewHost(laddr string, lport int) (*Host, error)

func (*Host) Disconnect

func (h *Host) Disconnect(p *Peer, reason disconnectreason.ID)

func (*Host) Service

func (h *Host) Service() <-chan Event

type Packet

type Packet struct {
	Flags uint32 // bitwise-or of ENetPacketFlag constants
	Data  []byte // allocated data for packet
}

type Peer

type Peer struct {
	Address *net.UDPAddr
	State   PeerState
	// contains filtered or unexported fields
}

func (*Peer) Send

func (p *Peer) Send(channel uint8, payload []byte)

type PeerState

type PeerState uint

Jump to

Keyboard shortcuts

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