network

package
v0.0.0-...-2af7037 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AudioID = 0
	VideoID = 1
)

List of packet ids

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	SecretKey []byte

	PeerList []*Peer

	Addr DeterminableAddr
	// contains filtered or unexported fields
}

Client refers to the backend of the client containing all basic information needed by the core

func (*Client) Initialize

func (client *Client) Initialize() error

Initialize setup the client, should be called first

type DeterminableAddr

type DeterminableAddr struct {
	Candidates []*net.UDPAddr
	// contains filtered or unexported fields
}

DeterminableAddr is a container of candidates and the current one

type Packet

type Packet struct {
	ID           uint32
	RawData      []byte
	ReceivedTime int64
}

Packet refers to a decrypted incoming packet sent by a peer

type PacketBuffer

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

PacketBuffer is a queue of packet, handles packet ordering internally

func (*PacketBuffer) Pop

func (buffer *PacketBuffer) Pop() *Packet

Pop a packet from the buffer

func (*PacketBuffer) Push

func (buffer *PacketBuffer) Push(packet *Packet)

Push a packet to the buffer

type Peer

type Peer struct {
	PublicKey []byte
	Addr      DeterminableAddr
	Volume    float32
	Name      string

	GetAudioData func() []float32
	SendOpusData func([]byte)
	// contains filtered or unexported fields
}

Peer refers to another spear user

func (*Peer) DisplayName

func (peer *Peer) DisplayName() string

DisplayName returns the displayed name on CUI

func (*Peer) Status

func (peer *Peer) Status() string

Status returns connection status from a peer

Jump to

Keyboard shortcuts

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