MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / writeRData

Method writeRData

modules/network/dns/dnsserializer.js:192–212  ·  view source on GitHub ↗
(type, data)

Source from the content-addressed store, hash-verified

190 this.writeU8(0);
191 }
192 writeRData(type, data) {
193 if (!data)
194 return;
195
196 if (data instanceof Uint8Array)
197 this.writeBytes(data);
198 else if (DNS.RR.PTR === type)
199 this.writeName(data.name);
200 else if (DNS.RR.NSEC === type) {
201 this.writeName(data.next);
202 this.writeBytes(data.bitmaps);
203 }
204 else if (DNS.RR.SRV === type) {
205 this.writeU16(data.priority);
206 this.writeU16(data.weight);
207 this.writeU16(data.port);
208 this.writeName(data.target);
209 }
210 else
211 this.writeBytes(data);
212 }
213 writeRecord(record) {
214 this.writeName(record.name);
215 this.writeU16(record.type);

Callers 1

writeRecordMethod · 0.95

Calls 3

writeBytesMethod · 0.95
writeNameMethod · 0.95
writeU16Method · 0.95

Tested by

no test coverage detected