shared

package
v0.0.0-...-1c6777f Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Recv

func Recv(conn *net.UDPConn, ch chan<- Message)

func Send

func Send(conn *net.UDPConn, ch <-chan Message)

Types

type CAPS_Packet

type CAPS_Packet struct {
	Name      string
	NumVoices uint32
	Identity  [24]byte
}

Caps Packet (CAPS) [0-3] name [4-7] uint32 number of voices [8-31] identity

func (*CAPS_Packet) DeSerialize

func (p *CAPS_Packet) DeSerialize(data []byte) error

func (*CAPS_Packet) Serialize

func (p *CAPS_Packet) Serialize() []byte

func (*CAPS_Packet) String

func (p *CAPS_Packet) String() string

func (*CAPS_Packet) Type

func (*CAPS_Packet) Type() PacketType

type KA_Packet

type KA_Packet struct{}

Keep Alive Packet (KA) [0-31] unused

func (*KA_Packet) DeSerialize

func (*KA_Packet) DeSerialize(data []byte) error

func (*KA_Packet) Serialize

func (*KA_Packet) Serialize() []byte

func (*KA_Packet) String

func (*KA_Packet) String() string

func (*KA_Packet) Type

func (*KA_Packet) Type() PacketType

type Message

type Message struct {
	Pkt  Packet
	Addr *net.UDPAddr
}

type PING_Packet

type PING_Packet []byte

Ping Packet (PING) [0-31] bytes to be echoed back

func RandomPing

func RandomPing() PING_Packet

func (PING_Packet) DeSerialize

func (p PING_Packet) DeSerialize(data []byte) error

func (PING_Packet) Serialize

func (p PING_Packet) Serialize() []byte

func (PING_Packet) String

func (p PING_Packet) String() string

func (PING_Packet) Type

func (PING_Packet) Type() PacketType

type PLAY_Packet

type PLAY_Packet struct {
	Duration  time.Duration
	Frequency uint32
	Amplitude float32
	Voice     uint32
}

Play Packet (PLAY) [0-3] uint32 duration in seconds [4-7] uint32 duration in nanoseconds [8-11] uint32 frequency [12-15] float32 amplitude [16-19] uint32 voice id [20-31] unused

func (*PLAY_Packet) DeSerialize

func (p *PLAY_Packet) DeSerialize(data []byte) error

func (*PLAY_Packet) Serialize

func (p *PLAY_Packet) Serialize() []byte

func (*PLAY_Packet) String

func (p *PLAY_Packet) String() string

func (*PLAY_Packet) Type

func (*PLAY_Packet) Type() PacketType

type Packet

type Packet interface {
	fmt.Stringer
	Type() PacketType
	Serialize() []byte
	DeSerialize(data []byte) error
}

type PacketType

type PacketType uint32
const (
	KA PacketType = iota // Keep Alive
	PING
	QUIT
	PLAY    // [0] uint duration seconds [1] uint nanoseconds offest [2] frequency [3] Amplitude [4] Voice
	CAPS    // [0] name [1] number of voices [2-7] identity
	UNKNOWN = 0xFFFFFFFF
)

type QUIT_Packet

type QUIT_Packet struct{}

Quit Packet (QUIT) [0-31] unused

func (*QUIT_Packet) DeSerialize

func (*QUIT_Packet) DeSerialize(data []byte) error

func (*QUIT_Packet) Serialize

func (*QUIT_Packet) Serialize() []byte

func (QUIT_Packet) String

func (QUIT_Packet) String() string

func (*QUIT_Packet) Type

func (*QUIT_Packet) Type() PacketType

type UNKNOWN_Packet

type UNKNOWN_Packet []byte

func (UNKNOWN_Packet) DeSerialize

func (p UNKNOWN_Packet) DeSerialize(data []byte) error

func (UNKNOWN_Packet) Serialize

func (p UNKNOWN_Packet) Serialize() []byte

func (UNKNOWN_Packet) String

func (p UNKNOWN_Packet) String() string

func (UNKNOWN_Packet) Type

func (UNKNOWN_Packet) Type() PacketType

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳