protocol

package
v0.0.0-...-9f49c80 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitPacket          = 0
	DataPacket          = 1
	EndPacket           = 2
	HandshakePacket     = 3
	UserDisconectPacket = 4
)
View Source
const HeadeSize = 9

Variables

This section is empty.

Functions

func WritePacket

func WritePacket(bw *bufio.Writer, packet *Packet) error

Types

type Header struct {
	Type       PacketType
	Length     uint32
	LengthUser uint32
}

type Packet

type Packet struct {
	Header  Header
	Payload []byte
	User    string
}

type PacketType

type PacketType uint8

type TCPConn

type TCPConn struct {
	Addr string
	User string
	Room string
}

func (*TCPConn) ReceiveLoop

func (c *TCPConn) ReceiveLoop(ctx context.Context, br *bufio.Reader, output chan<- *Packet) error

func (*TCPConn) Run

func (c *TCPConn) Run(ctx context.Context, input <-chan *voiceio.Chunk, output chan<- *Packet) error

func (*TCPConn) SendLoop

func (c *TCPConn) SendLoop(ctx context.Context, input <-chan *voiceio.Chunk, bw *bufio.Writer) error

Jump to

Keyboard shortcuts

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