This pull request introduces functionality to handle truncated DNS responses in the UDPSerializer class. The primary changes include updating the UDPSerializer to truncate responses that exceed the maximum size and adding corresponding tests to ensure this functionality works correctly.
Enhancements to DNS Response Handling:
src/common/network/udp.ts: Updated the UDPSerializer class to include logic for truncating DNS responses that exceed 512 bytes. This includes setting the truncated response flag and reducing the size of the packet by removing additional, authority, and answer sections as needed.
Testing Improvements:
src/common/network/tests/udp.spec.ts: Added a new test case to verify that the UDPSerializer correctly truncates responses that are too large, ensuring the truncated flag is set and the response size is within the limit.
This pull request introduces functionality to handle truncated DNS responses in the
UDPSerializer
class. The primary changes include updating theUDPSerializer
to truncate responses that exceed the maximum size and adding corresponding tests to ensure this functionality works correctly.Enhancements to DNS Response Handling:
src/common/network/udp.ts
: Updated theUDPSerializer
class to include logic for truncating DNS responses that exceed 512 bytes. This includes setting the truncated response flag and reducing the size of the packet by removing additional, authority, and answer sections as needed.Testing Improvements:
src/common/network/tests/udp.spec.ts
: Added a new test case to verify that theUDPSerializer
correctly truncates responses that are too large, ensuring the truncated flag is set and the response size is within the limit.src/common/network/tests/udp.spec.ts
: Imported necessary utilities and constants (TRUNCATED_RESPONSE
andHasFlag
) to support the new test case.