coapjs / coapjs/node-coap

Automatic selection of IPv4 vs IPv6 sockets when using DNS names

Open
#320 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
552
Forks
154
PR merge metrics
No merged PRs in 30d

Description

This supersedes https://github.com/JKRhb/node-red-contrib-coap/issues/15.

Currently, the API of node-coap requires you to select whether you want to create a v4 or a v6 socket; this property is inherited from the dgram.socket APIs. However, when connecting via a DNS name, this should be automatically selected based on the DNS records that are found. If I send something to coap://lamp1a/lamp/dimming, and lamp1a returns an AAAA record, the API of node-coap should be able to auto-select a v6 socket. Manually selecting v4/v6 should only be a thing for listening sockets, not for sending sockets.

That said, the NodeJS dgram.createSocket API doesn't seem to comprehend this. I am not sure how this should be solved in NodeJS, especially since the socket.send API allows to supply a hostname. It seems to me that DNS lookups and connection management should be handled outside of the dgram API.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the NodeJS dgram.createSocket and socket.send APIs linked in the issue, then inspect the current node-coap sending path to see where socket-family selection occurs. Define the expected behavior for DNS names with A and AAAA records, including how sending and listening sockets differ, before identifying tests that can verify completion.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.