galaxy

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

README

galaxy

GoDoc GoReport Travis License Chat Mentioned in Awesome Go

Package galaxy provides ...

Overview

This package ...

Documentation

Index

Constants

View Source
const (
	CmdQuestion = "question"
	CmdVersion  = "version"
	CmdRoots    = "roots"
	CmdMessages = "messages"
	CmdPing     = "ping"
	CmdPong     = "pong"
	CmdUser     = "user"
	CmdPeers    = "peers"
	CmdErr      = "error"
)

Commands used in wave which describe the type of wave.

View Source
const CommandSize = 12

CommandSize is the fixed size of all commands

View Source
const WaveHeaderSize = 24

WaveHeaderSize is the number of bytes in a wave header command 12 bytes + length 4 bytes + checksum 4 bytes

View Source
const WaveSize = 1048 * 64

WaveSize is the number of bytes in a wave WaveHeaderSize 24 bytes + waveBody

Variables

This section is empty.

Functions

func SendWave

func SendWave(w io.Writer, wave Wave) (int, error)

SendWave send a wave message to w

Types

type Wave

type Wave interface {
	Command() string
}

Wave is an interface that describes a galaxy information.

func ReceiveWave

func ReceiveWave(r io.Reader) (Wave, error)

ReceiveWave receive a wave message from r

type WaveErr

type WaveErr struct {
	WaveID common.Hash `json:"waveID"`
	Err    string      `json:"err"`
}

WaveErr return err of wave questions

func (*WaveErr) Command

func (w *WaveErr) Command() string

Command returns the protocol command string for the wave.

type WaveMessages

type WaveMessages struct {
	WaveID common.Hash `json:"waveID"`
	Msgs   [][]byte    `json:"msgs"`
}

WaveMessages implements the Wave interface and represents a broadcast new message.

func (*WaveMessages) Command

func (w *WaveMessages) Command() string

Command returns the protocol command string for the wave.

type WavePeers

type WavePeers struct {
	WaveID common.Hash `json:"waveID"`
	Peers  [][]byte    `json:"peers"`
}

WavePeers implements the Wave interface and represent node peers.

func (*WavePeers) Command

func (w *WavePeers) Command() string

Command returns the protocol command string for the wave.

type WavePing

type WavePing struct {
	WaveID common.Hash `json:"waveID"`
}

WavePing implements the Wave interface and represents a ping message

func (*WavePing) Command

func (w *WavePing) Command() string

Command returns the protocol command string for the wave.

type WavePong

type WavePong struct {
	WaveID common.Hash `json:"waveID"`
}

WavePong implements the Wave interface and represents a pong message

func (*WavePong) Command

func (w *WavePong) Command() string

Command returns the protocol command string for the wave.

type WaveQuestion

type WaveQuestion struct {
	WaveID common.Hash `json:"waveID"`
	Cmd    string      `json:"cmd"`
	Args   [][]byte    `json:"args"`
}

WaveQuestion implements the Wave interface and represents request info message.

func (*WaveQuestion) Command

func (w *WaveQuestion) Command() string

Command returns the protocol command string for the wave.

type WaveRoots

type WaveRoots struct {
	WaveID common.Hash   `json:"waveID"`
	Users  [2]*core.User `json:"users"`
}

WaveRoots implements the Wave interface and represents a getRoots message.

func (*WaveRoots) Command

func (w *WaveRoots) Command() string

Command returns the protocol command string for the wave.

type WaveUser

type WaveUser struct {
	WaveID common.Hash `json:"waveID"`
}

WaveUser implements the Wave interface and represents a checkUser message.

func (*WaveUser) Command

func (w *WaveUser) Command() string

Command returns the protocol command string for the wave.

type WaveVersion

type WaveVersion struct {
	WaveID common.Hash `json:"waveID"`
}

WaveVersion implements the Wave interface and represents a galaxy protocol version message.

func (*WaveVersion) Command

func (w *WaveVersion) Command() string

Command returns the protocol command string for the wave.

Jump to

Keyboard shortcuts

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