Help us shape the future of Go! Take the 2026 Go Developer Survey

dmsgctrl

package
v1.3.102 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package dmsgctrl pkg/dmsg/dmsgctrl/control.go c1-net-dmsg

Package dmsgctrl pkg/dmsg/dmsgctrl/serve_listener.go c1-net-dmsg

Index

Constants

View Source
const (
	PingType = PacketType(0x9)
	PongType = PacketType(0xA)
)

Packet types

Variables

View Source
var (
	ErrClosed = errors.New("control is closed")
)

Associated errors.

Functions

func ServeListener

func ServeListener(l net.Listener, chanLen int) <-chan *Control

ServeListener serves a listener with dmsgctrl.Control. It returns a channel for incoming Controls.

Types

type Control

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

Control wraps and takes over a dmsg.Stream and provides control features.

func ControlStream

func ControlStream(conn net.Conn) *Control

ControlStream wraps a dmsg.Stream and returns the Control.

func (*Control) Close

func (c *Control) Close() error

Close implements io.Closer

func (*Control) Conn

func (c *Control) Conn() net.Conn

Conn returns the internal net.Conn

func (*Control) Done

func (c *Control) Done() <-chan struct{}

Done the returned channel unblocks when the control stops serving.

func (*Control) Err

func (c *Control) Err() error

Err returns the resultant error (if any). If Control has not stopped, Err always returns nil.

func (*Control) Ping

func (c *Control) Ping(ctx context.Context) (time.Duration, error)

Ping sends a ping and blocks until a pong is received from remote. Context can be specified for early cancellation. Would also return early if Control stops serving.

type PacketType

type PacketType byte

PacketType represents the packet type.

Jump to

Keyboard shortcuts

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