From 17f293ca4e4b313caee929ad7dff8336ffea1015 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Mon, 7 Jan 2019 00:28:15 +0100 Subject: [PATCH] fix(core): update --- test/test.ts | 2 +- ts/index.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/test/test.ts b/test/test.ts index 1f097f3..e3a2611 100644 --- a/test/test.ts +++ b/test/test.ts @@ -5,7 +5,7 @@ import * as smartdns from '../ts/index'; let testDnsly: smartdns.Smartdns; tap.test('should create an instance of Dnsly', async () => { - testDnsly = new smartdns.Smartdns('google'); + testDnsly = new smartdns.Smartdns('cloudflare'); expect(testDnsly).to.be.instanceOf(smartdns.Smartdns); }); diff --git a/ts/index.ts b/ts/index.ts index 667f7be..1da252f 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,6 +1,6 @@ import * as plugins from './dnsly.plugins'; -export type TDnsProvider = 'google'; +export type TDnsProvider = 'google' | 'cloudflare'; export type TDnsRecordType = | 'A' | 'AAAA' @@ -29,7 +29,7 @@ export class Smartdns { /** * constructor for class dnsly */ - constructor(dnsProviderArg: TDnsProvider = 'google') { + constructor(dnsProviderArg: TDnsProvider = 'cloudflare') { this._setDnsProvider(dnsProviderArg); } @@ -152,6 +152,10 @@ export class Smartdns { this.dnsServerIp = '8.8.8.8'; this.dnsServerPort = 53; plugins.dns.setServers(['8.8.8.8', '8.8.4.4']); + } else if (dnsProvider === 'cloudflare') { + this.dnsServerIp = '1.1.1.1'; + this.dnsServerPort = 53; + plugins.dns.setServers(['1.1.1.1', '1.0.0.1']); } else { throw new Error('unknown dns provider'); }