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

question

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

Index

type Question

Question represents a question in an LLMNR message.

An LLMNR (Link-Local Multicast Name Resolution) question consists of a domain name, a type, and a class. The domain name specifies the name being queried, while the type and class specify the type of the query (e.g., TypeA, TypeAAAA) and the class of the query (e.g., ClassIN), respectively.

Fields: - Name: The domain name being queried. - Type: The type of the query (e.g., TypeA, TypeAAAA). - Class: The class of the query (e.g., ClassIN).

The Question struct is used in the Questions section of an LLMNR message to represent individual questions being asked in the message. Each question is encoded and decoded using the EncodeQuestion and DecodeQuestion functions, respectively.

type Question struct {
    Name  domain_name.DomainName `json:"name"`
    Type  llmnr_type.Type        `json:"type"`
    Class class.Class            `json:"class"`
}

func (*Question) Describe

func (q *Question) Describe(indent int)

Describe prints a detailed description of the Question.

Parameters: - indent: An integer value specifying the indentation level for the output.

func (*Question) Marshal

func (q *Question) Marshal() ([]byte, error)

Usage:

buf, err := EncodeQuestion(buf, question)
if err != nil {
    // handle error
}

The function returns the updated byte slice with the encoded question appended to it, or an error if the domain name encoding fails.

func (*Question) Unmarshal

func (q *Question) Unmarshal(data []byte) (int, error)

Unmarshal decodes a byte slice into the receiver Question struct.

This method takes a byte slice (starting at offset 0) and decodes its wire format representation into the Question struct fields. It decodes the domain name first, followed by the type and class fields. It returns the number of bytes read and an error if any part of the decoding process fails.

Parameters: - data: A byte slice containing the encoded question in wire format.

Returns:

  • An integer representing the number of bytes read from data.
  • An error if the decoding fails at any point, such as if the data is truncated or if there is an error decoding the domain name.

Usage:

var q Question
n, err := q.Unmarshal(data)
if err != nil {
    // handle error
}