# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

<!-- %% CHANGELOG_ENTRIES %% -->

## 0.3.2 - 2026-02-11

## Fix late UDP packets leaking into caller's mailbox

### Fixed

- **Stream mode now properly cleans up sockets** - When using `Madness.request/2`
  in stream mode (the default), sockets are owned by the caller process. Late
  UDP packets could remain in the caller's mailbox as orphaned `{:udp, ...}`
  messages after the request completed. The cleanup function now sets sockets
  to passive mode before draining pending messages, eliminating the race window
  between draining and closing.


## 0.3.1 - 2026-02-11

## Fix late UDP packets leaking into caller's mailbox

### Fixed

- **Stream mode now drains pending UDP messages on cleanup** - When using
  `Madness.request/2` in stream mode (the default), sockets are owned by the
  caller process. If UDP packets arrived between the last `set_active` call
  and stream termination, they would remain in the caller's mailbox as orphaned
  `{:udp, socket, ip, port, data}` messages. These could cause unexpected
  behavior in GenServers or other OTP processes. The cleanup function now
  drains any pending UDP messages before closing sockets.


## 0.3.0 - 2026-02-03

## Fix IPv6 mDNS queries

### Fixed

- **Link-local IPv6 addresses now allowed for mDNS** - Previously, link-local
  addresses (fe80::) were filtered out, but they are required for IPv6 mDNS
  since the multicast address ff02::fb is link-local scope.

- **PTR queries no longer return immediately with no results** - PTR queries
  are excluded from the pending questions set since we don't know how many
  responses to expect. However, an empty pending set was incorrectly causing
  immediate exit. Now PTR-only queries correctly wait for the full timeout.


## 0.2.1 - 2026-01-30

### Added

- GitLab CI pipeline with deps, compile, test, format, credo, and dialyzer stages
- Credo for static code analysis
- Dialyxir for type checking
- ExCoveralls for test coverage reporting

### Changed

- Refactored deeply nested functions across lib and test files to satisfy Credo checks
- Replaced `length/1 > 0` with empty list comparison for performance
- Added underscores to large numeric literals for readability


## 0.2.0 - 2026-01-29

### Changed

- Default `:family` option from `:inet` to `:any`, sending mDNS queries over both IPv4 and IPv6
- Minimum Elixir version from ~> 1.19 to ~> 1.18

### Added

- `:any` value for the `:family` option, which resolves interfaces and opens sockets for both address families
- IPv6 mDNS demo script (`scripts/demo_ipv6.exs`)


## 0.1.1 - 2026-01-28

- Initial release
- `Madness.request/2` for sending mDNS queries
- Stream and message response modes
- IPv4 and IPv6 multicast support
- Automatic parsing of A, AAAA, PTR, SRV, TXT, CNAME, NS, MX, SOA, NSEC records
- Additional section records included in responses
- NSEC record support for early query termination
- Unicast response flag (QU bit) support
- Multi-interface support with efficient active mode sockets

