Documentation
¶
Overview ¶
Package qemu implements QEMU's userspace network socket protocol.
QEMU's -netdev socket (and the newer -netdev stream) uses a simple L2 framing protocol over stream sockets: each Ethernet frame is prefixed with a 4-byte big-endian uint32 length. There is no handshake.
This package provides Conn, an pktkit.L2Device that wraps any stream-oriented net.Conn (TCP or Unix). Use Dial and Listen for TCP/Unix client-server setups, or Socketpair for an in-process pair connected via OS socketpair(2).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn wraps a stream connection and implements pktkit.L2Device. Each Ethernet frame is length-prefixed with a 4-byte big-endian uint32.
func Dial ¶
Dial connects to a QEMU socket netdev at the given address and returns a Conn implementing pktkit.L2Device. Network must be "tcp", "tcp4", "tcp6", or "unix".
func Socketpair ¶
Socketpair creates a pair of connected Conn values using OS socketpair(2). Both ends implement pktkit.L2Device.
func (*Conn) Done ¶
func (c *Conn) Done() <-chan struct{}
Done returns a channel that is closed when the connection is closed. This allows pktkit.Serve to detect disconnection and trigger cleanup.
func (*Conn) HWAddr ¶
func (c *Conn) HWAddr() net.HardwareAddr
HWAddr returns the connection's MAC address.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener accepts incoming QEMU socket connections.
func Listen ¶
Listen creates a Listener on the given network and address. Network must be "tcp", "tcp4", "tcp6", or "unix".
func (*Listener) Accept ¶
Accept waits for and returns the next connection as a Conn implementing pktkit.L2Device.
func (*Listener) AcceptL2 ¶
AcceptL2 implements pktkit.L2Acceptor. It accepts a connection and returns it as an pktkit.L2Device.