First MeshCentral with working UDP routing.

This commit is contained in:
Ylian Saint-Hilaire 2019-05-07 12:39:49 -07:00
parent 187a2e92c0
commit 825bff5bc0
3 changed files with 3 additions and 6 deletions

Binary file not shown.

View File

@ -418,7 +418,7 @@ function createMeshCore(agent) {
var woptions = http.parseUri(xurl); var woptions = http.parseUri(xurl);
woptions.rejectUnauthorized = 0; woptions.rejectUnauthorized = 0;
//sendConsoleText(JSON.stringify(woptions)); //sendConsoleText(JSON.stringify(woptions));
sendConsoleText('TUNNEL: ' + JSON.stringify(data)); //sendConsoleText('TUNNEL: ' + JSON.stringify(data));
var tunnel = http.request(woptions); var tunnel = http.request(woptions);
tunnel.upgrade = onTunnelUpgrade; tunnel.upgrade = onTunnelUpgrade;
tunnel.on('error', function (e) { sendConsoleText('ERROR: ' + JSON.stringify(e)); }); tunnel.on('error', function (e) { sendConsoleText('ERROR: ' + JSON.stringify(e)); });
@ -621,7 +621,6 @@ function createMeshCore(agent) {
s.tcprelay.peerindex = this.index; s.tcprelay.peerindex = this.index;
} if (this.udpport != null) { } if (this.udpport != null) {
// This is a UDP relay connection, get the UDP socket setup. // TODO: *************** // This is a UDP relay connection, get the UDP socket setup. // TODO: ***************
sendConsoleText('UDP relay connection');
s.data = onUdpRelayServerTunnelData; s.data = onUdpRelayServerTunnelData;
s.udprelay = require('dgram').createSocket({ type: 'udp4' }); s.udprelay = require('dgram').createSocket({ type: 'udp4' });
s.udprelay.bind({ port: 0 }); s.udprelay.bind({ port: 0 });
@ -638,10 +637,8 @@ function createMeshCore(agent) {
// Called when UDP relay data is received // TODO**** // Called when UDP relay data is received // TODO****
function onUdpRelayTargetTunnelConnect(data) { function onUdpRelayTargetTunnelConnect(data) {
// TODO!!!
sendConsoleText('onUdpRelayTargetTunnelConnect: ' + data);
var peerTunnel = tunnels[this.peerindex]; var peerTunnel = tunnels[this.peerindex];
peerTunnel.send(data); peerTunnel.s.write(data);
} }
// Called when we get data from the server for a TCP relay (We have to skip the first received 'c' and pipe the rest) // Called when we get data from the server for a TCP relay (We have to skip the first received 'c' and pipe the rest)

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.3.3-t", "version": "0.3.3-u",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",