@@ -118,31 +118,31 @@ console.log('\n\n')
118118
119119assert . strictEqual ( dnsProviders . cloudflare . dnsType , 'HTTPS' )
120120// ip = await dnsProviders.cloudflare.lookup(hostname1)
121- // console.log(' ===> test cloudflare:' , ip, '\n\n')
121+ // console.log(` ===> test cloudflare: ${hostname1} ->` , ip, '\n\n')
122122
123123assert . strictEqual ( dnsProviders . quad9 . dnsType , 'HTTPS' )
124124// ip = await dnsProviders.quad9.lookup(hostname1)
125- // console.log(' ===> test quad9:' , ip, '\n\n')
125+ // console.log(` ===> test quad9: ${hostname1} ->` , ip, '\n\n')
126126
127127assert . strictEqual ( dnsProviders . aliyun . dnsType , 'HTTPS' )
128- // ip = await dnsProviders.aliyun.lookup(hostname1)
129- // console.log(' ===> test aliyun:' , ip, '\n\n')
128+ ip = await dnsProviders . aliyun . lookup ( hostname1 )
129+ console . log ( ` ===> test aliyun: ${ hostname1 } ->` , ip , '\n\n' )
130130
131131assert . strictEqual ( dnsProviders . aliyun2 . dnsType , 'HTTPS' )
132- // ip = await dnsProviders.aliyun2.lookup(hostname1)
133- // console.log(' ===> test aliyun2:' , ip, '\n\n')
132+ ip = await dnsProviders . aliyun2 . lookup ( hostname1 )
133+ console . log ( ` ===> test aliyun2: ${ hostname1 } ->` , ip , '\n\n' )
134134
135135assert . strictEqual ( dnsProviders . safe360 . dnsType , 'HTTPS' )
136- // ip = await dnsProviders.safe360.lookup(hostname1)
137- // console.log(' ===> test safe360:' , ip, '\n\n')
136+ ip = await dnsProviders . safe360 . lookup ( hostname1 )
137+ console . log ( ` ===> test safe360: ${ hostname1 } ->` , ip , '\n\n' )
138138
139139assert . strictEqual ( dnsProviders . rubyfish . dnsType , 'HTTPS' )
140140// ip = await dnsProviders.rubyfish.lookup(hostname1)
141- // console.log(' ===> test rubyfish:' , ip, '\n\n')
141+ // console.log(` ===> test rubyfish: ${hostname1} ->` , ip, '\n\n')
142142
143143assert . strictEqual ( dnsProviders . py233 . dnsType , 'HTTPS' )
144144// ip = await dnsProviders.py233.lookup(hostname1)
145- // console.log(' ===> test py233:' , ip, '\n\n')
145+ // console.log(` ===> test py233: ${hostname1} ->` , ip, '\n\n')
146146
147147
148148console . log ( '\n--------------- test TLS ---------------\n' )
@@ -152,23 +152,23 @@ console.log('\n\n')
152152
153153assert . strictEqual ( dnsProviders . cloudflareTLS . dnsType , 'TLS' )
154154// ip = await dnsProviders.cloudflareTLS.lookup(hostname1)
155- // console.log(' ===> test cloudflareTLS:' , ip, '\n\n')
155+ // console.log(` ===> test cloudflareTLS: ${hostname1} ->` , ip, '\n\n')
156156
157157assert . strictEqual ( dnsProviders . quad9TLS . dnsType , 'TLS' )
158158// ip = await dnsProviders.quad9TLS.lookup(hostname1)
159- // console.log(' ===> test quad9TLS:' , ip, '\n\n')
159+ // console.log(` ===> test quad9TLS: ${hostname1} ->` , ip, '\n\n')
160160
161161assert . strictEqual ( dnsProviders . aliyunTLS . dnsType , 'TLS' )
162- // ip = await dnsProviders.aliyunTLS.lookup(hostname1)
163- // console.log(' ===> test aliyunTLS:' , ip, '\n\n')
162+ ip = await dnsProviders . aliyunTLS . lookup ( hostname1 )
163+ console . log ( ` ===> test aliyunTLS: ${ hostname1 } ->` , ip , '\n\n' )
164164
165165assert . strictEqual ( dnsProviders . aliyunTLS2 . dnsType , 'TLS' )
166- // ip = await dnsProviders.aliyunTLS2.lookup(hostname1)
167- // console.log(' ===> test aliyunTLS2:' , ip, '\n\n')
166+ ip = await dnsProviders . aliyunTLS2 . lookup ( hostname1 )
167+ console . log ( ` ===> test aliyunTLS2: ${ hostname1 } ->` , ip , '\n\n' )
168168
169169assert . strictEqual ( dnsProviders . safe360TLS . dnsType , 'TLS' )
170- // ip = await dnsProviders.safe360TLS.lookup(hostname1)
171- // console.log(' ===> test safe360TLS:' , ip, '\n\n')
170+ ip = await dnsProviders . safe360TLS . lookup ( hostname1 )
171+ console . log ( ` ===> test safe360TLS: ${ hostname1 } ->` , ip , '\n\n' )
172172
173173
174174console . log ( '\n--------------- test TCP ---------------\n' )
@@ -177,12 +177,12 @@ assert.strictEqual(ip, presetIp) // test preset
177177console . log ( '\n\n' )
178178
179179assert . strictEqual ( dnsProviders . googleTCP . dnsType , 'TCP' )
180- // ip = await dnsProviders.googleTCP.lookup(hostname1)
181- // console.log(' ===> test googleTCP:' , ip, '\n\n')
180+ ip = await dnsProviders . googleTCP . lookup ( hostname1 )
181+ console . log ( ` ===> test googleTCP: ${ hostname1 } ->` , ip , '\n\n' )
182182
183183assert . strictEqual ( dnsProviders . aliyunTCP . dnsType , 'TCP' )
184- // ip = await dnsProviders.aliyunTCP.lookup(hostname1)
185- // console.log(' ===> test aliyunTCP:' , ip, '\n\n')
184+ ip = await dnsProviders . aliyunTCP . lookup ( hostname1 )
185+ console . log ( ` ===> test aliyunTCP: ${ hostname1 } ->` , ip , '\n\n' )
186186
187187
188188console . log ( '\n--------------- test UDP ---------------\n' )
@@ -191,9 +191,26 @@ assert.strictEqual(ip, presetIp) // test preset
191191console . log ( '\n\n' )
192192
193193assert . strictEqual ( dnsProviders . googleUDP . dnsType , 'UDP' )
194- // ip = await dnsProviders.googleUDP.lookup(hostname1)
195- // console.log(' ===> test googleUDP:' , ip, '\n\n')
194+ ip = await dnsProviders . googleUDP . lookup ( hostname1 )
195+ console . log ( ` ===> test googleUDP: ${ hostname1 } ->` , ip , '\n\n' )
196196
197197assert . strictEqual ( dnsProviders . aliyunUDP . dnsType , 'UDP' )
198- // ip = await dnsProviders.aliyunUDP.lookup(hostname1)
199- // console.log('===> test aliyunUDP:', ip, '\n\n')
198+ ip = await dnsProviders . aliyunUDP . lookup ( hostname1 )
199+ console . log ( `===> test aliyunUDP: ${ hostname1 } ->` , ip , '\n\n' )
200+
201+ dnsProviders . aliyunUDP . lookup ( hostname1 ) . then ( ip0 => {
202+ console . log ( `===> test aliyunUDP: ${ hostname1 } ->` , ip0 , '\n\n' )
203+ assert . strictEqual ( ip0 , ip )
204+ } )
205+ dnsProviders . aliyunUDP . lookup ( hostname2 ) . then ( ip0 => {
206+ console . log ( `===> test aliyunUDP: ${ hostname2 } ->` , ip0 , '\n\n' )
207+ assert . notStrictEqual ( ip0 , ip )
208+ } )
209+ dnsProviders . aliyunUDP . lookup ( 'baidu.com' ) . then ( ip0 => {
210+ console . log ( '===> test aliyunUDP: baidu.com ->' , ip0 , '\n\n' )
211+ assert . notStrictEqual ( ip0 , ip )
212+ } )
213+ dnsProviders . aliyunUDP . lookup ( 'gitee.com' ) . then ( ip0 => {
214+ console . log ( '===> test aliyunUDP: gitee.com ->' , ip0 , '\n\n' )
215+ assert . notStrictEqual ( ip0 , ip )
216+ } )
0 commit comments