Added --bindany option to MeshCMD MicroLMS.

This commit is contained in:
Ylian Saint-Hilaire 2022-05-03 13:43:01 -07:00
parent 3d549dc187
commit 1240733d6c
3 changed files with 21 additions and 4 deletions

View File

@ -157,6 +157,7 @@ function run(argv) {
if ((typeof args.uuidoutput) == 'string' || args.uuidoutput) { settings.uuidoutput = args.uuidoutput; }
if ((typeof args.desc) == 'string') { settings.desc = args.desc; }
if ((typeof args.dnssuffix) == 'string') { settings.dnssuffix = args.dnssuffix; }
if (args.bindany) { settings.bindany = true; }
if (args.emailtoken) { settings.emailtoken = true; }
if (args.smstoken) { settings.smstoken = true; }
if (args.debug === true) { settings.debuglevel = 1; }

View File

@ -17,6 +17,7 @@ limitations under the License.
var MemoryStream = require('MemoryStream');
var lme_id = 0; // Our next channel identifier
var lme_port_offset = 0; // Debug: Set this to "-100" to bind to 16892 & 16893 and IN_ADDRANY. This is for LMS debugging.
var lme_bindany = false; // If true, bind to all network interfaces, not just loopback.
var xmlParser = null;
try { xmlParser = require('amt-xml'); } catch (ex) { }
@ -123,7 +124,10 @@ function lme_heci(options) {
if (name == 'connect' && this._LME._connected == true) { func.call(this); }
if (name == 'error' && this._LME._error !=null) { func.call(this, this._LME._error); }
});
if ((options != null) && (options.debug == true)) { lme_port_offset = -100; } // LMS debug mode
if (options != null) {
if (options.debug == true) { lme_port_offset = -100; } // LMS debug mode
if (options.bindany == true) { lme_bindany = true; } // Bind to all ports
}
var heci = require('heci');
this.INITIAL_RXWINDOW_SIZE = 4096;
@ -189,7 +193,11 @@ function lme_heci(options) {
this[name][port].descriptorMetadata = 'amt-lme (port: ' + port + ')';
this[name][port].HECI = this;
if (lme_port_offset == 0) {
this[name][port].listen({ port: port, host: '127.0.0.1' }); // Normal mode
if (lme_bindany) {
this[name][port].listen({ port: port }); // Bind all mode
} else {
this[name][port].listen({ port: port, host: '127.0.0.1' }); // Normal mode
}
} else {
this[name][port].listen({ port: (port + lme_port_offset) }); // Debug mode
}

View File

@ -17,6 +17,7 @@ limitations under the License.
var MemoryStream = require('MemoryStream');
var lme_id = 0; // Our next channel identifier
var lme_port_offset = 0; // Debug: Set this to "-100" to bind to 16892 & 16893 and IN_ADDRANY. This is for LMS debugging.
var lme_bindany = false; // If true, bind to all network interfaces, not just loopback.
var xmlParser = null;
try { xmlParser = require('amt-xml'); } catch (ex) { }
@ -123,7 +124,10 @@ function lme_heci(options) {
if (name == 'connect' && this._LME._connected == true) { func.call(this); }
if (name == 'error' && this._LME._error !=null) { func.call(this, this._LME._error); }
});
if ((options != null) && (options.debug == true)) { lme_port_offset = -100; } // LMS debug mode
if (options != null) {
if (options.debug == true) { lme_port_offset = -100; } // LMS debug mode
if (options.bindany == true) { lme_bindany = true; } // Bind to all ports
}
var heci = require('heci');
this.INITIAL_RXWINDOW_SIZE = 4096;
@ -189,7 +193,11 @@ function lme_heci(options) {
this[name][port].descriptorMetadata = 'amt-lme (port: ' + port + ')';
this[name][port].HECI = this;
if (lme_port_offset == 0) {
this[name][port].listen({ port: port, host: '127.0.0.1' }); // Normal mode
if (lme_bindany) {
this[name][port].listen({ port: port }); // Bind all mode
} else {
this[name][port].listen({ port: port, host: '127.0.0.1' }); // Normal mode
}
} else {
this[name][port].listen({ port: (port + lme_port_offset) }); // Debug mode
}