Comparing version 1.8.19-dev to 1.8.20-dev
{ | ||
"name": "bdy", | ||
"preferGlobal": false, | ||
"version": "1.8.19-dev", | ||
"version": "1.8.20-dev", | ||
"type": "commonjs", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -98,2 +98,3 @@ "use strict"; | ||
domain: tunnel.domain, | ||
customDomain: tunnel.customDomain, | ||
subdomain: tunnel.subdomain, | ||
@@ -100,0 +101,0 @@ serve: tunnel.serve, |
@@ -71,2 +71,3 @@ "use strict"; | ||
domain: t.domain, | ||
customDomain: t.customDomain, | ||
sshId: t.sshId, | ||
@@ -193,2 +194,3 @@ sshForwardPort: t.sshForwardPort, | ||
domain: this.tunnel.domain, | ||
customDomain: this.tunnel.customDomain, | ||
sshId: this.tunnel.sshId, | ||
@@ -195,0 +197,0 @@ sshForwardPort: this.tunnel.sshForwardPort, |
@@ -67,2 +67,3 @@ "use strict"; | ||
this.domain = data.domain; | ||
this.customDomain = data.customDomain; | ||
this.sshForwardPort = data.sshForwardPort; | ||
@@ -69,0 +70,0 @@ } |
@@ -109,8 +109,9 @@ "use strict"; | ||
host += tunnel.subdomain; | ||
if (!tunnel.customDomain) { | ||
host += '.'; | ||
host += tunnel.region.toLowerCase(); | ||
host += '-'; | ||
host += tunnel.sshId; | ||
} | ||
host += '.'; | ||
// todo custom domain | ||
host += tunnel.region.toLowerCase(); | ||
host += '-'; | ||
host += tunnel.sshId; | ||
host += '.'; | ||
host += tunnel.domain; | ||
@@ -117,0 +118,0 @@ return host; |
@@ -24,3 +24,3 @@ "use strict"; | ||
class Tunnel extends events_1.default { | ||
constructor({ id, type, target, region, timeout, domain, subdomain, whitelist, tlsSettings, httpSettings, sshSettings, sshHostKey, }) { | ||
constructor({ id, type, target, region, timeout, domain, customDomain, subdomain, whitelist, tlsSettings, httpSettings, sshSettings, sshHostKey, }) { | ||
super(); | ||
@@ -37,2 +37,3 @@ if (!sshHostKey) | ||
domain, | ||
customDomain, | ||
subdomain, | ||
@@ -45,3 +46,3 @@ whitelist, | ||
} | ||
create({ type, target, region, timeout, domain, subdomain, whitelist, tlsSettings, httpSettings, sshSettings, }) { | ||
create({ type, target, region, timeout, domain, customDomain, subdomain, whitelist, tlsSettings, httpSettings, sshSettings, }) { | ||
this.type = type; | ||
@@ -52,2 +53,3 @@ this.region = region; | ||
this.domain = domain; | ||
this.customDomain = !!customDomain; | ||
this.subdomain = subdomain; | ||
@@ -142,3 +144,3 @@ this.timeout = timeout || utils_js_1.DEFAULT_TIMEOUT; | ||
} | ||
recreate({ type, target, region, timeout, domain, subdomain, whitelist, tlsSettings, httpSettings, sshSettings, }) { | ||
recreate({ type, target, region, timeout, domain, customDomain, subdomain, whitelist, tlsSettings, httpSettings, sshSettings, }) { | ||
const started = this.started; | ||
@@ -152,2 +154,3 @@ this.stop(false); | ||
domain, | ||
customDomain, | ||
subdomain, | ||
@@ -556,3 +559,3 @@ whitelist, | ||
// dns health | ||
this.dns = new dns_js_1.default(this.sshIp, this.domain, this.subdomain, this.region, this.sshId); | ||
this.dns = new dns_js_1.default(this.sshIp, this.domain, this.customDomain, this.subdomain, this.region, this.sshId); | ||
this.dns.startChecking(); | ||
@@ -559,0 +562,0 @@ if (this.type === utils_js_1.TUNNEL_TLS && this.terminate === utils_js_1.TLS_TERMINATE_AT_AGENT) { |
@@ -5,3 +5,3 @@ "use strict"; | ||
class TunnelDns { | ||
constructor(sshIp, domain, subdomain, region, sshId) { | ||
constructor(sshIp, domain, customDomain, subdomain, region, sshId) { | ||
this.region = region; | ||
@@ -12,2 +12,3 @@ this.sshId = sshId; | ||
this.subdomain = subdomain; | ||
this.customDomain = customDomain; | ||
this.valid = false; | ||
@@ -19,22 +20,37 @@ this.checking = true; | ||
const r = new dns_1.Resolver(); | ||
// todo custom domain | ||
const hostname = `${this.subdomain}.${this.region.toLowerCase()}-${this.sshId}.${this.domain}`; | ||
r.resolveCname(hostname, (err, a1) => { | ||
if (err || !a1 || a1.length !== 1) { | ||
this.valid = false; | ||
this.checking = false; | ||
} | ||
else { | ||
r.resolve4(a1[0], (err, a2) => { | ||
if (err || !a2 || a2.length !== 1) { | ||
this.valid = false; | ||
this.checking = false; | ||
} | ||
else { | ||
this.valid = a2[0] === this.sshIp; | ||
this.checking = false; | ||
} | ||
}); | ||
} | ||
}); | ||
let hostname; | ||
if (this.customDomain) { | ||
hostname = `${this.subdomain}.${this.domain}`; | ||
r.resolve4(hostname, (err, a1) => { | ||
if (err || !a1 || a1.length !== 1) { | ||
this.valid = false; | ||
this.checking = false; | ||
} | ||
else { | ||
this.valid = a1[0] === this.sshIp; | ||
this.checking = false; | ||
} | ||
}); | ||
} | ||
else { | ||
hostname = `${this.subdomain}.${this.region.toLowerCase()}-${this.sshId}.${this.domain}`; | ||
r.resolveCname(hostname, (err, a1) => { | ||
if (err || !a1 || a1.length !== 1) { | ||
this.valid = false; | ||
this.checking = false; | ||
} | ||
else { | ||
r.resolve4(a1[0], (err, a2) => { | ||
if (err || !a2 || a2.length !== 1) { | ||
this.valid = false; | ||
this.checking = false; | ||
} | ||
else { | ||
this.valid = a2[0] === this.sshIp; | ||
this.checking = false; | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -41,0 +57,0 @@ startChecking() { |
{ | ||
"name": "bdy", | ||
"preferGlobal": false, | ||
"version": "1.8.19-dev", | ||
"version": "1.8.20-dev", | ||
"type": "commonjs", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
425912
10675