> ## Documentation Index
> Fetch the complete documentation index at: https://bunnynet-cb9733c2-support-migration.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Query Response Object Types

> The handleQuery entry point function supports multiple object return types to return different types of answers. This page contains the various types of answers the function can return to respond to queries.

Each response object usually consists of a constructor that receives a string representation of the value and a TTL value parameter that determines how long the response client should cache the object.

Objects can be returned as a single object or as an array of objects depending on the desired output.

## Supported response objects

* [ARecord](#arecord)
* [AaaaRecord](#aaaarecord)
* [CnameRecord](#cname-record)
* [PullZoneRecord](#pullzonerecord)

## Example response

Below is an example code snippet to illustrate how to return a dynamic DNS response to a DNS query. If the request is coming from Germany, then 222.222.222.222 is returned, otherwise, 111.111.111.111 is returned.

```javascript theme={null}
export default function handleQuery(query) {
    if (query.request.geoLocation.country == "DE") {
        return new ARecord("222.222.222.222", 30);
    }
    
    return new ARecord("111.111.111.111", 30);
}
```

## ARecord

The ARecord represents the A type DNS answer to return A records.

```typescript theme={null}
declare class ARecord {
    constructor(ip: string, ttl: number = 30);

    /**
     * The IP of the A record
     */
    ip: string;

    /**
     * The TTL of the answer
     */
    ttl: number;
}
```

## AaaaRecord

The AaaaRecord represents the AAAA type DNS answer to return AAAA records.

```typescript theme={null}
declare class AaaaRecord {
    constructor(ip: string, ttl: number = 30);

    /**
     * The IP of the AAAA record
     */
    ip: string;

    /**
     * The TTL of the answer
     */
    ttl: number;
}
```

## Cname Record

The CnameRecord represents the CNAME type DNS answer to return CNAME records.

```typescript theme={null}
declare class CnameRecord {
    constructor(hostname: string, ttl: number = 30);

    /**
     * The hostname of the CNAME record
     */
    hostname: string;

    /**
     * The TTL of the answer
     */
    ttl: number;
}
```

## PullZoneRecord

The PullZoneRecord is used to map the response to a Pull Zone response, meaning the DNS system will automatically map the response to the appropriate A or AAAA records for this specific pull zone.

```typescript theme={null}
declare class PullZoneRecord {
    constructor(pullzone: string);

    /**
     * The name of the pull zone
     */
    pullzone: string;
}
```
