Use existing variable for request type

This commit is contained in:
2025-01-03 13:57:36 -06:00
parent c7e2ab7675
commit 0c946505b0
7 changed files with 18 additions and 13 deletions

4
dist/dns.d.ts vendored
View File

@ -1,3 +1,7 @@
export declare const TypeTxt = 16;
export declare const TypePtr = 12;
export declare const TypeSrv = 33;
export declare const TypeA = 1;
export declare class Question {
name: string;
type: number;

8
dist/dns.js vendored
View File

@ -1,7 +1,7 @@
const TypeTxt = 16;
const TypePtr = 12;
const TypeSrv = 33;
const TypeA = 1;
export const TypeTxt = 16;
export const TypePtr = 12;
export const TypeSrv = 33;
export const TypeA = 1;
export class Question {
name = "";
type = 0;

2
dist/dns.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/finder.js vendored
View File

@ -3,7 +3,7 @@
import { createSocket } from "dgram";
import { EventEmitter } from "events";
import debug from "debug";
import { ARecord, GetDNSAnswer, GetDNSQuestion, ipToString, PtrRecord, SrvRecord, } from "./dns.js";
import { ARecord, GetDNSAnswer, GetDNSQuestion, ipToString, PtrRecord, SrvRecord, TypePtr, } from "./dns.js";
const debugFind = debug("ic:find");
export class UnitInfo {
name;
@ -39,7 +39,7 @@ export class FindUnits extends EventEmitter {
offset = this.message.writeUInt8("local".length, offset);
offset += this.message.write("local", offset);
offset = this.message.writeUInt8(0, offset); // no more strings
offset = this.message.writeUInt16BE(0x000c, offset); // type: ptr
offset = this.message.writeUInt16BE(TypePtr, offset); // type
this.message.writeUInt16BE(1, offset); // class: IN
this.finder = createSocket("udp4");
this.finder

2
dist/finder.js.map vendored

File diff suppressed because one or more lines are too long

8
dns.ts
View File

@ -1,7 +1,7 @@
const TypeTxt = 16;
const TypePtr = 12;
const TypeSrv = 33;
const TypeA = 1;
export const TypeTxt = 16;
export const TypePtr = 12;
export const TypeSrv = 33;
export const TypeA = 1;
export class Question {
public name = "";

View File

@ -12,6 +12,7 @@ import {
PtrRecord,
Record,
SrvRecord,
TypePtr,
} from "./dns.js";
const debugFind = debug("ic:find");
@ -59,7 +60,7 @@ export class FindUnits extends EventEmitter {
offset = this.message.writeUInt8("local".length, offset);
offset += this.message.write("local", offset);
offset = this.message.writeUInt8(0, offset); // no more strings
offset = this.message.writeUInt16BE(0x000c, offset); // type: ptr
offset = this.message.writeUInt16BE(TypePtr, offset); // type
this.message.writeUInt16BE(1, offset); // class: IN
this.finder = createSocket("udp4");