face

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DummyFace added in v1.5.0

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

func NewDummyFace added in v1.5.0

func NewDummyFace() *DummyFace

func (*DummyFace) Close added in v1.5.0

func (f *DummyFace) Close() error

func (*DummyFace) Consume added in v1.5.0

func (f *DummyFace) Consume() (enc.Buffer, error)

Consume consumes a packet from the engine

func (*DummyFace) FeedPacket added in v1.5.0

func (f *DummyFace) FeedPacket(pkt enc.Buffer) error

FeedPacket feeds a packet for the engine to consume

func (*DummyFace) IsLocal added in v1.5.0

func (f *DummyFace) IsLocal() bool

func (*DummyFace) IsRunning added in v1.5.0

func (f *DummyFace) IsRunning() bool

func (*DummyFace) OnDown added in v1.5.0

func (f *DummyFace) OnDown(onDown func())

func (*DummyFace) OnError added in v1.5.0

func (f *DummyFace) OnError(onError func(err error) error)

func (*DummyFace) OnPacket added in v1.5.0

func (f *DummyFace) OnPacket(onPkt func(frame []byte) error)

func (*DummyFace) OnUp added in v1.5.0

func (f *DummyFace) OnUp(onUp func())

func (*DummyFace) Open added in v1.5.0

func (f *DummyFace) Open() error

func (*DummyFace) Send added in v1.5.0

func (f *DummyFace) Send(pkt enc.Wire) error

func (*DummyFace) String added in v1.5.0

func (f *DummyFace) String() string

type Face

type Face interface {
	// String returns the log identifier.
	String() string
	// IsRunning returns true if the face is running.
	IsRunning() bool
	// IsLocal returns true if the face is local.
	IsLocal() bool
	// OnPacket sets the callback for receiving packets.
	// This function should only be called by engine implementations.
	OnPacket(onPkt func(frame []byte) error)
	// OnError sets the callback for errors.
	// This function should only be called by engine implementations.
	OnError(onError func(err error) error)

	// Open starts the face and may blocks until it is up.
	Open() error
	// Close stops the face.
	Close() error
	// Send sends a packet frame to the face.
	Send(pkt enc.Wire) error

	// OnUp sets the callback for the face going up.
	// The callback may be called multiple times.
	OnUp(onUp func())
	// OnDown sets the callback for the face going down.
	// The callback may be called multiple times.
	// The callback will not be called when the face is closed.
	OnDown(onDown func())
}

type StreamFace

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

StreamFace is a face that uses a stream connection.

func NewStreamFace

func NewStreamFace(network string, addr string, local bool) *StreamFace

func (*StreamFace) Close

func (f *StreamFace) Close() error

func (*StreamFace) IsLocal

func (f *StreamFace) IsLocal() bool

func (*StreamFace) IsRunning

func (f *StreamFace) IsRunning() bool

func (*StreamFace) OnDown added in v1.5.0

func (f *StreamFace) OnDown(onDown func())

func (*StreamFace) OnError added in v1.5.0

func (f *StreamFace) OnError(onError func(err error) error)

func (*StreamFace) OnPacket added in v1.5.0

func (f *StreamFace) OnPacket(onPkt func(frame []byte) error)

func (*StreamFace) OnUp added in v1.5.0

func (f *StreamFace) OnUp(onUp func())

func (*StreamFace) Open

func (f *StreamFace) Open() error

func (*StreamFace) Send

func (f *StreamFace) Send(pkt enc.Wire) error

func (*StreamFace) String added in v1.5.0

func (f *StreamFace) String() string

func (*StreamFace) Trait added in v1.5.0

func (f *StreamFace) Trait() Face

type WebSocketFace

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

func NewWebSocketFace

func NewWebSocketFace(url string, local bool) *WebSocketFace

func (*WebSocketFace) Close

func (f *WebSocketFace) Close() error

func (*WebSocketFace) IsLocal

func (f *WebSocketFace) IsLocal() bool

func (*WebSocketFace) IsRunning

func (f *WebSocketFace) IsRunning() bool

func (*WebSocketFace) OnDown added in v1.5.0

func (f *WebSocketFace) OnDown(onDown func())

func (*WebSocketFace) OnError added in v1.5.0

func (f *WebSocketFace) OnError(onError func(err error) error)

func (*WebSocketFace) OnPacket added in v1.5.0

func (f *WebSocketFace) OnPacket(onPkt func(frame []byte) error)

func (*WebSocketFace) OnUp added in v1.5.0

func (f *WebSocketFace) OnUp(onUp func())

func (*WebSocketFace) Open

func (f *WebSocketFace) Open() error

func (*WebSocketFace) Send

func (f *WebSocketFace) Send(pkt enc.Wire) error

func (*WebSocketFace) String added in v1.5.0

func (f *WebSocketFace) String() string

func (*WebSocketFace) Trait added in v1.5.0

func (f *WebSocketFace) Trait() Face

Jump to

Keyboard shortcuts

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