Generated from Manticore v1.1.5 • 201 packages. View on pkg.go.dev

class

import "github.com/TheManticoreProject/Manticore/network/llmnr/class"

Index

type Class

Class represents the class field in an LLMNR question.

LLMNR reuses DNS classes, with an additional “QU” (Unicast-Preferred) bit in the most significant bit of the class field as defined by RFC 4795. When the QU bit is set, the responder should prefer sending a unicast response.

type Class uint16

LLMNR Question Classes and Flags.

const (
    // Base classes (DNS-compatible)
    ClassIN   Class = 1   // Internet
    ClassCS   Class = 2   // CSNET (Obsolete)
    ClassCH   Class = 3   // CHAOS
    ClassHS   Class = 4   // Hesiod
    ClassNONE Class = 254 // Used in dynamic update messages
    ClassANY  Class = 255 // Any class

    // QU (Unicast-Preferred) flag for LLMNR questions (MSB of the class field)
    ClassUnicastPreferred Class = 1 << 15
)

func (Class) BaseClass

func (c Class) BaseClass() Class

BaseClass returns the class value with the QU bit cleared.

func (Class) IsUnicastPreferred

func (c Class) IsUnicastPreferred() bool

IsUnicastPreferred returns true if the QU (Unicast-Preferred) bit is set.

func (*Class) Marshal

func (c *Class) Marshal() ([]byte, error)

Marshal encodes the Class into a 2-byte big-endian representation.

func (Class) String

func (c Class) String() string

String returns a string representation of the class, including the QU flag if present.

func (*Class) Unmarshal

func (c *Class) Unmarshal(data []byte) (int, error)

Unmarshal decodes a 2-byte big-endian representation into the Class receiver. It returns an error if the input slice is not exactly 2 bytes.