Documentation
¶
Index ¶
- type DummyFace
- func (f *DummyFace) Close() error
- func (f *DummyFace) Consume() (enc.Buffer, error)
- func (f *DummyFace) FeedPacket(pkt enc.Buffer) error
- func (f *DummyFace) IsLocal() bool
- func (f *DummyFace) IsRunning() bool
- func (f *DummyFace) OnDown(onDown func())
- func (f *DummyFace) OnError(onError func(err error) error)
- func (f *DummyFace) OnPacket(onPkt func(frame []byte) error)
- func (f *DummyFace) OnUp(onUp func())
- func (f *DummyFace) Open() error
- func (f *DummyFace) Send(pkt enc.Wire) error
- func (f *DummyFace) String() string
- type Face
- type StreamFace
- func (f *StreamFace) Close() error
- func (f *StreamFace) IsLocal() bool
- func (f *StreamFace) IsRunning() bool
- func (f *StreamFace) OnDown(onDown func())
- func (f *StreamFace) OnError(onError func(err error) error)
- func (f *StreamFace) OnPacket(onPkt func(frame []byte) error)
- func (f *StreamFace) OnUp(onUp func())
- func (f *StreamFace) Open() error
- func (f *StreamFace) Send(pkt enc.Wire) error
- func (f *StreamFace) String() string
- func (f *StreamFace) Trait() Face
- type WebSocketFace
- func (f *WebSocketFace) Close() error
- func (f *WebSocketFace) IsLocal() bool
- func (f *WebSocketFace) IsRunning() bool
- func (f *WebSocketFace) OnDown(onDown func())
- func (f *WebSocketFace) OnError(onError func(err error) error)
- func (f *WebSocketFace) OnPacket(onPkt func(frame []byte) error)
- func (f *WebSocketFace) OnUp(onUp func())
- func (f *WebSocketFace) Open() error
- func (f *WebSocketFace) Send(pkt enc.Wire) error
- func (f *WebSocketFace) String() string
- func (f *WebSocketFace) Trait() Face
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) FeedPacket ¶ added in v1.5.0
FeedPacket feeds a packet for the engine to consume
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) Open ¶
func (f *StreamFace) Open() 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) Open ¶
func (f *WebSocketFace) Open() 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
Click to show internal directories.
Click to hide internal directories.