MCPcopy Index your code
hub / github.com/nodejs/node / writeDomainName

Function writeDomainName

test/common/dns.js:184–192  ·  view source on GitHub ↗
(domain)

Source from the content-addressed store, hash-verified

182}
183
184function writeDomainName(domain) {
185 return Buffer.concat(domain.split('.').map((label) => {
186 assert(label.length < 64);
187 return Buffer.concat([
188 Buffer.from([label.length]),
189 Buffer.from(label, 'ascii'),
190 ]);
191 }).concat([Buffer.alloc(1)]));
192}
193
194function writeDNSPacket(parsed) {
195 const buffers = [];

Callers 1

writeDNSPacketFunction · 0.85

Calls 6

concatMethod · 0.80
allocMethod · 0.80
mapMethod · 0.65
assertFunction · 0.50
splitMethod · 0.45
fromMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…