proto

package
v0.0.0-...-0e3aaa5 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BoolEntry = EntryType(iota)
	Int8Entry
	UInt8Entry
	IntEntry
	UIntEntry
	Float32Entry
	StringEntry
	ListEntry
	ModifyEntry
)
View Source
const (
	UDPPort = 28000
	TCPPort = 27000
)

Pip boy ports

View Source
const (
	PacketTypeKeepAlive = PacketType(iota)
	PacketTypeConnectionAccepted
	PacketTypeConnectionRefused
	PacketTypeDataUpdate
	PacketTypeMapUpdate
	PacketTypeCommand
	PacketTypeCommandResult
	PacketTypeCount
)

Well-known packet types

View Source
const AutoDiscover string = `{"cmd": "autodiscover"}`

AutoDiscover is the command for autodiscovery

View Source
const (
	Bytes32Bit = 4
)

Variables

View Source
var (
	//ErrShortEntryHeader indicates that not enough bytes were available to read a
	//data entry
	ErrShortEntryHeader = fmt.Errorf("not enough bytes for data entry header")
	//ErrShortData indicates that for the type indicated by the header, not
	//enough bytes remain for the vaulue expected
	ErrShortData = fmt.Errorf("not enough bytes for data entry value")
)
View Source
var PipByteOrder = binary.LittleEndian

PipByteOrder is the binary endianness of integers in the pip protocol

Functions

This section is empty.

Types

type DataEntry

type DataEntry struct {
	Type  EntryType
	ID    uint32
	Name  string
	Value any
}

DataEntry is a type that encapsulates the

func UnmarshalDataEntries

func UnmarshalDataEntries(bs []byte) ([]*DataEntry, error)

func UnmarshalDataEntry

func UnmarshalDataEntry(b []byte) (*DataEntry, int, error)

UnmarshalDataEntry takes a byte slice and returns the number of bytes read, and a possible error

type DictEntry

type DictEntry struct {
	Ref  uint32
	Name string
}

func DictEntryFromBytes

func DictEntryFromBytes(bs []byte) (DictEntry, int, error)

type EntryType

type EntryType uint8

func (EntryType) String

func (i EntryType) String() string

type InsRemove

type InsRemove struct {
	Insert []DictEntry
	Remove []uint32
}

type Packet

type Packet struct {
	PacketType PacketType
	Body       []byte
	// contains filtered or unexported fields
}

Packet is the PIPProtocol wire format

func ReadPacket

func ReadPacket(r io.Reader) (*Packet, error)

ReadPacket returns a packet from an io.Reader.

func (*Packet) WriteTo

func (p *Packet) WriteTo(w io.Writer) (int64, error)

WriteTo sends a packet to a writer and returns the number of bytes written.

type PacketType

type PacketType uint8

PacketType accounts for the possible packet types

func (PacketType) String

func (i PacketType) String() string

type Server

type Server struct {
	Address     string
	IsBusy      bool
	MachineType string
}

Server represents a PipBoy game on a server

func Discover

func Discover(ctx context.Context) ([]Server, error)

Discover returns a list of servers and their status

Jump to

Keyboard shortcuts

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