@gjsify/dns 0.52.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0});export{__name};
|
|
1
|
+
var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0}),__exportAll=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};export{__exportAll,__name};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import e from"@girs/gio-2.0";import{isIP as t}from"node:net";const n=`ENODATA`,r=`EFORMERR`,i=`ESERVFAIL`,a=`ENOTFOUND`,o=`ENOTIMP`,s=`EREFUSED`,c=`EBADQUERY`,l=`EBADNAME`,u=`EBADFAMILY`,d=`EBADRESP`,f=`ECONNREFUSED`,p=`ETIMEOUT`,m=`EOF`,h=`EFILE`,g=`ENOMEM`,_=`EDESTRUCTION`,v=`EBADSTR`,y=`EBADFLAGS`,b=`ENONAME`,x=`EBADHINTS`,S=`ENOTINITIALIZED`,C=`ELOADIPHLPAPI`,w=`EADDRGETNETWORKPARAMS`,T=`ECANCELLED`;function createDnsError(e,t,n){let r=a,i=`${t} ${r} ${e}`,o=Error(i);return o.code=r,o.syscall=t,o.hostname=e,o.errno=void 0,o}function lookup(n,...r){let i={},a;if(typeof r[0]==`function`?a=r[0]:(typeof r[0]==`number`?i={family:r[0]}:r[0]&&(i=r[0]),a=r[1]),!n){let e=TypeError(`The argument 'hostname' must be a non-empty string. Received ${n===``?`''`:String(n)}`);throw e.code=`ERR_INVALID_ARG_VALUE`,e}let o=t(n);if(o){a(null,n,o);return}let s=e.Resolver.get_default();s.lookup_by_name_async(n,null,(t,r)=>{try{let t=s.lookup_by_name_finish(r);if(!t||t.length===0){a(createDnsError(n,`getaddrinfo`),``,0);return}let o=i.family||0,c=[];for(let n of t){let t=n.get_family();(o===0||o===4&&t===e.SocketFamily.IPV4||o===6&&t===e.SocketFamily.IPV6)&&c.push(n)}if(c.length===0&&(c=Array.from(t)),i.all){let t=c.map(t=>({address:t.to_string(),family:t.get_family()===e.SocketFamily.IPV6?6:4}));a(null,t)}else{let t=c[0],n=t.to_string(),r=t.get_family()===e.SocketFamily.IPV6?6:4;a(null,n,r)}}catch{a(createDnsError(n,`getaddrinfo`),``,0)}})}function resolve4(e,t){lookup(e,{family:4,all:!0},(e,n)=>{if(e){t(e,[]);return}t(null,n.map(e=>e.address))})}function resolve6(e,t){lookup(e,{family:6,all:!0},(e,n)=>{if(e){t(e,[]);return}t(null,n.map(e=>e.address))})}function reverse(t,n){let r=e.Resolver.get_default(),i=e.InetAddress.new_from_string(t);if(!i){let e=Error(`Invalid IP address: ${t}`);e.code=`ERR_INVALID_ARG_VALUE`,n(e,[]);return}r.lookup_by_address_async(i,null,(e,i)=>{try{let e=r.lookup_by_address_finish(i);n(null,e?[e]:[])}catch{n(createDnsError(t,`getnameinfo`),[])}})}function resolve(e,...t){let n=`A`,r;switch(typeof t[0]==`function`?r=t[0]:(n=t[0],r=t[1]),n.toUpperCase()){case`A`:resolve4(e,r);break;case`AAAA`:resolve6(e,r);break;default:_resolveRecords(e,n,r)}}function _resolveRecords(t,n,r){let i=e.Resolver.get_default(),a={SRV:e.ResolverRecordType.SRV,MX:e.ResolverRecordType.MX,TXT:e.ResolverRecordType.TXT,SOA:e.ResolverRecordType.SOA,NS:e.ResolverRecordType.NS}[n.toUpperCase()];if(!a){let e=Error(`Unknown record type: ${n}`);e.code=`ERR_INVALID_ARG_VALUE`,r(e,[]);return}i.lookup_records_async(t,a,null,(e,n)=>{try{r(null,i.lookup_records_finish(n).map(e=>e.deep_unpack()))}catch{r(createDnsError(t,`queryDns`),[])}})}let E=`verbatim`;function setDefaultResultOrder(e){E=e}function getDefaultResultOrder(){return E}export{w as ADDRGETNETWORKPARAMS,u as BADFAMILY,y as BADFLAGS,x as BADHINTS,l as BADNAME,c as BADQUERY,d as BADRESP,v as BADSTR,T as CANCELLED,f as CONNREFUSED,_ as DESTRUCTION,m as EOF,h as FILE,r as FORMERR,C as LOADIPHLPAPI,n as NODATA,g as NOMEM,b as NONAME,a as NOTFOUND,o as NOTIMP,S as NOTINITIALIZED,s as REFUSED,i as SERVFAIL,p as TIMEOUT,getDefaultResultOrder,lookup,resolve,resolve4,resolve6,reverse,setDefaultResultOrder};
|
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{ADDRGETNETWORKPARAMS as e,BADFAMILY as t,BADFLAGS as n,BADHINTS as r,BADNAME as i,BADQUERY as a,BADRESP as o,BADSTR as s,CANCELLED as c,CONNREFUSED as l,DESTRUCTION as u,EOF as d,FILE as f,FORMERR as p,LOADIPHLPAPI as m,NODATA as h,NOMEM as g,NONAME as _,NOTFOUND as v,NOTIMP as y,NOTINITIALIZED as b,REFUSED as x,SERVFAIL as S,TIMEOUT as C,getDefaultResultOrder as w,lookup as T,resolve as E,resolve4 as D,resolve6 as O,reverse as k,setDefaultResultOrder as A}from"./callback.js";import{promises_exports as j}from"./promises.js";var M={lookup:T,resolve:E,resolve4:D,resolve6:O,reverse:k,setDefaultResultOrder:A,getDefaultResultOrder:w,NODATA:h,FORMERR:p,SERVFAIL:S,NOTFOUND:v,NOTIMP:y,REFUSED:x,BADQUERY:a,BADNAME:i,BADFAMILY:t,BADRESP:o,CONNREFUSED:l,TIMEOUT:C,EOF:`EOF`,FILE:f,NOMEM:g,DESTRUCTION:u,BADSTR:s,BADFLAGS:n,NONAME:_,BADHINTS:r,NOTINITIALIZED:b,CANCELLED:c,promises:j};export{e as ADDRGETNETWORKPARAMS,t as BADFAMILY,n as BADFLAGS,r as BADHINTS,i as BADNAME,a as BADQUERY,o as BADRESP,s as BADSTR,c as CANCELLED,l as CONNREFUSED,u as DESTRUCTION,d as EOF,f as FILE,p as FORMERR,m as LOADIPHLPAPI,h as NODATA,g as NOMEM,_ as NONAME,v as NOTFOUND,y as NOTIMP,b as NOTINITIALIZED,x as REFUSED,S as SERVFAIL,C as TIMEOUT,M as default,w as getDefaultResultOrder,T as lookup,j as promises,E as resolve,D as resolve4,O as resolve6,k as reverse,A as setDefaultResultOrder};
|
package/lib/esm/promises.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{lookup as
|
|
1
|
+
import{__exportAll as e}from"./_virtual/_rolldown/runtime.js";import{lookup as t,resolve as n,resolve4 as r,resolve6 as i,reverse as a}from"./callback.js";var o=e({default:()=>s,lookup:()=>lookup,resolve:()=>resolve,resolve4:()=>resolve4,resolve6:()=>resolve6,reverse:()=>reverse});function lookup(e,n){return new Promise((r,i)=>{t(e,n,(e,t,n)=>{if(e)return i(e);r(Array.isArray(t)?t:{address:t,family:n})})})}function resolve4(e){return new Promise((t,n)=>{r(e,(e,r)=>{if(e)return n(e);t(r)})})}function resolve6(e){return new Promise((t,n)=>{i(e,(e,r)=>{if(e)return n(e);t(r)})})}function reverse(e){return new Promise((t,n)=>{a(e,(e,r)=>{if(e)return n(e);t(r)})})}function resolve(e,t){return new Promise((r,i)=>{t?n(e,t,(e,t)=>{if(e)return i(e);r(t)}):n(e,(e,t)=>{if(e)return i(e);r(t)})})}var s={lookup,resolve,resolve4,resolve6,reverse};export{s as default,lookup,o as promises_exports,resolve,resolve4,resolve6,reverse};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export declare const NODATA = "ENODATA";
|
|
2
|
+
export declare const FORMERR = "EFORMERR";
|
|
3
|
+
export declare const SERVFAIL = "ESERVFAIL";
|
|
4
|
+
export declare const NOTFOUND = "ENOTFOUND";
|
|
5
|
+
export declare const NOTIMP = "ENOTIMP";
|
|
6
|
+
export declare const REFUSED = "EREFUSED";
|
|
7
|
+
export declare const BADQUERY = "EBADQUERY";
|
|
8
|
+
export declare const BADNAME = "EBADNAME";
|
|
9
|
+
export declare const BADFAMILY = "EBADFAMILY";
|
|
10
|
+
export declare const BADRESP = "EBADRESP";
|
|
11
|
+
export declare const CONNREFUSED = "ECONNREFUSED";
|
|
12
|
+
export declare const TIMEOUT = "ETIMEOUT";
|
|
13
|
+
export declare const EOF = "EOF";
|
|
14
|
+
export declare const FILE = "EFILE";
|
|
15
|
+
export declare const NOMEM = "ENOMEM";
|
|
16
|
+
export declare const DESTRUCTION = "EDESTRUCTION";
|
|
17
|
+
export declare const BADSTR = "EBADSTR";
|
|
18
|
+
export declare const BADFLAGS = "EBADFLAGS";
|
|
19
|
+
export declare const NONAME = "ENONAME";
|
|
20
|
+
export declare const BADHINTS = "EBADHINTS";
|
|
21
|
+
export declare const NOTINITIALIZED = "ENOTINITIALIZED";
|
|
22
|
+
export declare const LOADIPHLPAPI = "ELOADIPHLPAPI";
|
|
23
|
+
export declare const ADDRGETNETWORKPARAMS = "EADDRGETNETWORKPARAMS";
|
|
24
|
+
export declare const CANCELLED = "ECANCELLED";
|
|
25
|
+
export interface LookupOptions {
|
|
26
|
+
family?: 0 | 4 | 6;
|
|
27
|
+
hints?: number;
|
|
28
|
+
all?: boolean;
|
|
29
|
+
verbatim?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface LookupAddress {
|
|
32
|
+
address: string;
|
|
33
|
+
family: 4 | 6;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Resolve a hostname to an IP address using the system DNS resolver.
|
|
37
|
+
*/
|
|
38
|
+
export declare function lookup(hostname: string, options: LookupOptions | number | null | undefined, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
|
|
39
|
+
export declare function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
|
|
40
|
+
/**
|
|
41
|
+
* Resolve a hostname to an array of IPv4 addresses.
|
|
42
|
+
*/
|
|
43
|
+
export declare function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
44
|
+
/**
|
|
45
|
+
* Resolve a hostname to an array of IPv6 addresses.
|
|
46
|
+
*/
|
|
47
|
+
export declare function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
48
|
+
/**
|
|
49
|
+
* Reverse DNS lookup.
|
|
50
|
+
*/
|
|
51
|
+
export declare function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
|
|
52
|
+
/**
|
|
53
|
+
* Resolve hostname using specified record type.
|
|
54
|
+
*/
|
|
55
|
+
export declare function resolve(hostname: string, rrtype: string, callback: (err: NodeJS.ErrnoException | null, records: unknown[]) => void): void;
|
|
56
|
+
export declare function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, records: string[]) => void): void;
|
|
57
|
+
export declare function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
|
|
58
|
+
export declare function getDefaultResultOrder(): string;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,61 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export declare const NOTIMP = "ENOTIMP";
|
|
6
|
-
export declare const REFUSED = "EREFUSED";
|
|
7
|
-
export declare const BADQUERY = "EBADQUERY";
|
|
8
|
-
export declare const BADNAME = "EBADNAME";
|
|
9
|
-
export declare const BADFAMILY = "EBADFAMILY";
|
|
10
|
-
export declare const BADRESP = "EBADRESP";
|
|
11
|
-
export declare const CONNREFUSED = "ECONNREFUSED";
|
|
12
|
-
export declare const TIMEOUT = "ETIMEOUT";
|
|
13
|
-
export declare const EOF = "EOF";
|
|
14
|
-
export declare const FILE = "EFILE";
|
|
15
|
-
export declare const NOMEM = "ENOMEM";
|
|
16
|
-
export declare const DESTRUCTION = "EDESTRUCTION";
|
|
17
|
-
export declare const BADSTR = "EBADSTR";
|
|
18
|
-
export declare const BADFLAGS = "EBADFLAGS";
|
|
19
|
-
export declare const NONAME = "ENONAME";
|
|
20
|
-
export declare const BADHINTS = "EBADHINTS";
|
|
21
|
-
export declare const NOTINITIALIZED = "ENOTINITIALIZED";
|
|
22
|
-
export declare const LOADIPHLPAPI = "ELOADIPHLPAPI";
|
|
23
|
-
export declare const ADDRGETNETWORKPARAMS = "EADDRGETNETWORKPARAMS";
|
|
24
|
-
export declare const CANCELLED = "ECANCELLED";
|
|
25
|
-
export interface LookupOptions {
|
|
26
|
-
family?: 0 | 4 | 6;
|
|
27
|
-
hints?: number;
|
|
28
|
-
all?: boolean;
|
|
29
|
-
verbatim?: boolean;
|
|
30
|
-
}
|
|
31
|
-
export interface LookupAddress {
|
|
32
|
-
address: string;
|
|
33
|
-
family: 4 | 6;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Resolve a hostname to an IP address using the system DNS resolver.
|
|
37
|
-
*/
|
|
38
|
-
export declare function lookup(hostname: string, options: LookupOptions | number | null | undefined, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
|
|
39
|
-
export declare function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
|
|
40
|
-
/**
|
|
41
|
-
* Resolve a hostname to an array of IPv4 addresses.
|
|
42
|
-
*/
|
|
43
|
-
export declare function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
44
|
-
/**
|
|
45
|
-
* Resolve a hostname to an array of IPv6 addresses.
|
|
46
|
-
*/
|
|
47
|
-
export declare function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
48
|
-
/**
|
|
49
|
-
* Reverse DNS lookup.
|
|
50
|
-
*/
|
|
51
|
-
export declare function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
|
|
52
|
-
/**
|
|
53
|
-
* Resolve hostname using specified record type.
|
|
54
|
-
*/
|
|
55
|
-
export declare function resolve(hostname: string, rrtype: string, callback: (err: NodeJS.ErrnoException | null, records: unknown[]) => void): void;
|
|
56
|
-
export declare function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, records: string[]) => void): void;
|
|
57
|
-
export declare function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
|
|
58
|
-
export declare function getDefaultResultOrder(): string;
|
|
1
|
+
import { lookup, resolve, resolve4, resolve6, reverse, setDefaultResultOrder, getDefaultResultOrder } from './callback.js';
|
|
2
|
+
import * as promises from './promises.js';
|
|
3
|
+
export * from './callback.js';
|
|
4
|
+
export { promises };
|
|
59
5
|
declare const _default: {
|
|
60
6
|
lookup: typeof lookup;
|
|
61
7
|
resolve: typeof resolve;
|
|
@@ -86,5 +32,6 @@ declare const _default: {
|
|
|
86
32
|
BADHINTS: string;
|
|
87
33
|
NOTINITIALIZED: string;
|
|
88
34
|
CANCELLED: string;
|
|
35
|
+
promises: typeof promises;
|
|
89
36
|
};
|
|
90
37
|
export default _default;
|
package/lib/types/promises.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LookupOptions, LookupAddress } from './
|
|
1
|
+
import type { LookupOptions, LookupAddress } from './callback.js';
|
|
2
2
|
export declare function lookup(hostname: string, options?: LookupOptions | number): Promise<LookupAddress | LookupAddress[]>;
|
|
3
3
|
export declare function resolve4(hostname: string): Promise<string[]>;
|
|
4
4
|
export declare function resolve6(hostname: string): Promise<string[]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/dns",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.54.0",
|
|
4
4
|
"description": "Node.js dns module for Gjs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -42,16 +42,16 @@
|
|
|
42
42
|
"dns"
|
|
43
43
|
],
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@gjsify/cli": "^0.
|
|
46
|
-
"@gjsify/unit": "^0.
|
|
45
|
+
"@gjsify/cli": "^0.54.0",
|
|
46
|
+
"@gjsify/unit": "^0.54.0",
|
|
47
47
|
"@types/node": "^25.9.2",
|
|
48
48
|
"typescript": "^6.0.3"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@girs/gio-2.0": "5.4.0",
|
|
52
52
|
"@girs/glib-2.0": "5.4.0",
|
|
53
|
-
"@gjsify/net": "^0.
|
|
54
|
-
"@gjsify/utils": "^0.
|
|
53
|
+
"@gjsify/net": "^0.54.0",
|
|
54
|
+
"@gjsify/utils": "^0.54.0"
|
|
55
55
|
},
|
|
56
56
|
"gjsify": {
|
|
57
57
|
"runtimes": {
|