multiplayer

package
v0.0.0-...-93c852a Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CateOption

func CateOption() cate.Options

Types

type ED25519Key

type ED25519Key struct {
	Key []byte
	// contains filtered or unexported fields
}

func NewED25519Key

func NewED25519Key() (*ED25519Key, error)

func (*ED25519Key) Equal

func (k *ED25519Key) Equal(s Signer) bool

func (*ED25519Key) ID

func (k *ED25519Key) ID() ID

func (*ED25519Key) Public

func (k *ED25519Key) Public() Signer

func (*ED25519Key) Sign

func (k *ED25519Key) Sign(rand io.Reader, digest []byte) (signature []byte, err error)

func (*ED25519Key) Verify

func (k *ED25519Key) Verify(rand io.Reader, message, sig []byte) error

type Engine

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

func Start

func Start(key Signer) *Engine

Start creates a new multiplayer state for the given net.Conn and starts listening for packets. The connection must be a packet-oriented connection such as net.UDPConn.

func (*Engine) Accept

func (e *Engine) Accept(conn io.ReadWriteCloser) (err error)

func (*Engine) Dial

func (e *Engine) Dial(conn io.ReadWriteCloser) (err error)

func (*Engine) Next

func (e *Engine) Next(ctx context.Context) (Event, error)

type ID

type ID [sha256.Size]byte

type Signer

type Signer interface {
	ID() ID
	Equal(Signer) bool
	Public() Signer
	Sign(rand io.Reader, message []byte) (signature []byte, err error)
	Verify(rand io.Reader, message, sig []byte) error
}

type UDP

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

func ListenUDP

func ListenUDP(key Signer, addr *net.UDPAddr) (*UDP, error)

func (*UDP) Connect

func (m *UDP) Connect(addr *net.UDPAddr)

Jump to

Keyboard shortcuts

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