Documentation ¶
Overview ¶
This file implements the Zircon loglistener protocol.
Package netboot implements the Zircon netboot protocol.
Index ¶
- Constants
- func UDPConnWithReusablePort(port int, zone string, reusable bool) (*net.UDPConn, error)
- type Advertisement
- type Client
- func (n *Client) Beacon() (*net.UDPAddr, error)
- func (n *Client) BeaconForDevice(ctx context.Context, nodename string, ipv6Addr *net.UDPAddr, reusable bool) (*net.UDPAddr, *Advertisement, func(), error)
- func (n *Client) BeaconOnInterface(networkInterface string) (*net.UDPAddr, error)
- func (n *Client) Boot(addr *net.UDPAddr) error
- func (n *Client) Discover(ctx context.Context, nodename string) (*net.UDPAddr, error)
- func (n *Client) DiscoverAll(ctx context.Context) ([]*Target, error)
- func (n *Client) Reboot(addr *net.UDPAddr) error
- func (n *Client) StartDiscover(ctx context.Context, t chan<- *Target, nodename string) (func() error, error)
- type LogListener
- type Target
Constants ¶
const NodenameWildcard = "*"
NodenameWildcard is the wildcard for discovering all nodes.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Advertisement ¶
Advertisement represents the information in an advertisement sent from a device.
type Client ¶
Client implements the netboot protocol.
func (*Client) BeaconForDevice ¶
func (n *Client) BeaconForDevice(ctx context.Context, nodename string, ipv6Addr *net.UDPAddr, reusable bool) (*net.UDPAddr, *Advertisement, func(), error)
BeaconForDevice receives the beacon packet for a particular device with the given nodename or ipv6 address.
func (*Client) BeaconOnInterface ¶
BeaconOnInterface receives the beacon packet on a particular interface.
func (*Client) DiscoverAll ¶
DiscoverAll returns all netsvc addresses on the local network.
If no devices are found, returns a nil array.
func (*Client) StartDiscover ¶
func (n *Client) StartDiscover(ctx context.Context, t chan<- *Target, nodename string) (func() error, error)
StartDiscover takes a channel and returns every Target as it is found. Returns a cleanup function for closing the discovery connection or an error if there is a failure.
Errors within discovery will be propagated up the channel via the Target.Error field.
The Timeout field is not used with this function, and as such it is the caller's responsibility to handle timeouts when using this function.
Example:
ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() cleanup, err := c.StartDiscover(ctx, t, true) if err != nil { return err } defer cleanup() for { select { case target := <-t: // Do something with the target. case <-ctx.Done(): // Do something now that the parent context is // completed. } }
type LogListener ¶
type LogListener struct {
// contains filtered or unexported fields
}
LogListener is Zircon's debug log listener.
func NewLogListener ¶
func NewLogListener(nodename string) (*LogListener, error)
NewLogListener creates and connects a new instance of debug log listener.
func (*LogListener) Close ¶
func (l *LogListener) Close() error
Close shuts down the log listener underlying connection.
func (*LogListener) Listen ¶
func (l *LogListener) Listen() (string, error)
Listen receive a single debug log packet.
type Target ¶
type Target struct { // Nodename is target's nodename: thumb-set-human-neon is an example. // This is derived from the NIC mac address. Nodename string // TargetAddress is the address of the target from the host. TargetAddress net.IP // HostAddress is the "local" address, i.e. the one to which the target // is responding. This would be the address the target would send to in // order to communicate with the host. HostAddress net.IP // Interface is the index of the "local" interface connecting to // the Fuchsia device. nil if this does not apply. Interface *net.Interface // Error is the error associated with the device when returned via // the StartDiscover function. Error error }
Target defines a netboot protocol target, which includes information about how to find said target on the network: the target's nodename, its address, the address from the target back to the host, and the interface used to connect from the host to the target.