removed `bind` from the `http` and `tls` settings
This commit is contained in:
parent
8371170a14
commit
ea55d3cc73
|
@ -67,6 +67,23 @@ function fixRawConfig(config) {
|
||||||
updateDomains(config[key].domains);
|
updateDomains(config[key].domains);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (config.tcp && config.tcp && !Array.isArray(config.tcp)) {
|
||||||
|
config.tcp.bind = [ config.tcp.bind ];
|
||||||
|
updated = true;
|
||||||
|
}
|
||||||
|
if (config.http && config.http.bind) {
|
||||||
|
config.tcp = config.tcp || { bind: [] };
|
||||||
|
config.tcp.bind = (config.tcp.bind || []).concat(config.http.bind);
|
||||||
|
delete config.http.bind;
|
||||||
|
updated = true;
|
||||||
|
}
|
||||||
|
if (config.tls && config.tls.bind) {
|
||||||
|
config.tcp = config.tcp || { bind: [] };
|
||||||
|
config.tcp.bind = (config.tcp.bind || []).concat(config.tls.bind);
|
||||||
|
delete config.tls.bind;
|
||||||
|
updated = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (config.dns) {
|
if (config.dns) {
|
||||||
config.udp = config.dns;
|
config.udp = config.dns;
|
||||||
delete config.dns;
|
delete config.dns;
|
||||||
|
|
|
@ -101,7 +101,9 @@ var httpSchema = {
|
||||||
primary_domain: { type: 'string' }
|
primary_domain: { type: 'string' }
|
||||||
, allow_insecure: { type: 'boolean' }
|
, allow_insecure: { type: 'boolean' }
|
||||||
, trust_proxy: { type: 'boolean' }
|
, trust_proxy: { type: 'boolean' }
|
||||||
, }
|
|
||||||
|
, bind: { not: {} } // this is a forbidden deprecated setting.
|
||||||
|
}
|
||||||
};
|
};
|
||||||
addDomainsSchema(httpSchema, ['proxy', 'static', 'redirect']);
|
addDomainsSchema(httpSchema, ['proxy', 'static', 'redirect']);
|
||||||
|
|
||||||
|
@ -117,6 +119,8 @@ var tlsSchema = {
|
||||||
, server: { type: 'string' }
|
, server: { type: 'string' }
|
||||||
, challenge_type: { type: 'string' }
|
, challenge_type: { type: 'string' }
|
||||||
, approved_domains: { type: 'array', items: { type: 'string' }, minLength: 1}
|
, approved_domains: { type: 'array', items: { type: 'string' }, minLength: 1}
|
||||||
|
|
||||||
|
, bind: { not: {} } // this is a forbidden deprecated setting.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,21 +197,10 @@ module.exports.create = function (deps, config) {
|
||||||
|
|
||||||
var listenPromises = [];
|
var listenPromises = [];
|
||||||
var tcpPortMap = {};
|
var tcpPortMap = {};
|
||||||
function addPorts(bindList) {
|
config.tcp.bind.filter(Number).forEach(function (port) {
|
||||||
if (!bindList) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Array.isArray(bindList)) {
|
|
||||||
bindList.filter(Number).forEach(function (port) {
|
|
||||||
tcpPortMap[port] = true;
|
tcpPortMap[port] = true;
|
||||||
});
|
});
|
||||||
}
|
|
||||||
else if (Number(bindList)) {
|
|
||||||
tcpPortMap[bindList] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addPorts(config.tcp.bind);
|
|
||||||
(config.tcp.modules || []).forEach(function (mod) {
|
(config.tcp.modules || []).forEach(function (mod) {
|
||||||
if (mod.type === 'forward') {
|
if (mod.type === 'forward') {
|
||||||
var forwarder = createTcpForwarder(mod);
|
var forwarder = createTcpForwarder(mod);
|
||||||
|
@ -229,12 +218,6 @@ module.exports.create = function (deps, config) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Even though these ports were specified in different places we treat any TCP
|
|
||||||
// connections we haven't been told to just forward exactly as is equal so that
|
|
||||||
// we can potentially use the same ports for different protocols.
|
|
||||||
addPorts(config.tls.bind);
|
|
||||||
addPorts(config.http.bind);
|
|
||||||
|
|
||||||
var portList = Object.keys(tcpPortMap).map(Number).sort();
|
var portList = Object.keys(tcpPortMap).map(Number).sort();
|
||||||
portList.forEach(function (port) {
|
portList.forEach(function (port) {
|
||||||
listenPromises.push(listeners.tcp.add(port, netHandler));
|
listenPromises.push(listeners.tcp.add(port, netHandler));
|
||||||
|
|
Loading…
Reference in New Issue