@remote.it/core
Version:
Core remote.it JavasScript/TypeScript library
252 lines • 6.48 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ServiceType = /** @class */ (function () {
function ServiceType(args) {
this.defaultPort = args.defaultPort;
this.name = args.name;
this.id = args.id;
this.hex = args.hex;
}
return ServiceType;
}());
exports.ServiceType = ServiceType;
var ALL_SERVICES = {
// 0 Camera Viewer
tcp: new ServiceType({
name: 'TCP',
defaultPort: 445,
id: 1,
hex: '01',
}),
// 2 Telnet
// 3 SVN
vnc: new ServiceType({
name: 'VNC',
defaultPort: 5900,
id: 4,
hex: '04',
}),
rdp: new ServiceType({
name: 'RDP',
defaultPort: 3389,
id: 5,
hex: '05',
}),
// 6 Share
httpProxy: new ServiceType({
name: 'HTTP reverse proxy',
defaultPort: 80,
id: 7,
hex: '07',
}),
httpsProxy: new ServiceType({
name: 'HTTPS reverse proxy',
defaultPort: 443,
id: 8,
hex: '08',
}),
// 9 Reserved
// 10 HTTPS
// 11 iTunes
// 12 File Folder
// 13 Printer
// 14 Tversity
// 15 Video
// 16 Video
// 17 Photo Folder
// 18 Camera Folder
// 19 Camera Viewer
// 20 Microsoft Media
// 21 RDP Plus
// 22 My Tunes
// 23 DVR Viewer
// 24 DVR
// 25 Video Stream
// 26 Network Storage
// 27 Network Storage
ssh: new ServiceType({
name: 'SSH',
defaultPort: 22,
id: 28,
hex: '1C',
}),
// 29 Generic TCP
// 30 Basic Web
// 33 Secure Web
http: new ServiceType({
defaultPort: 80,
name: 'HTTP',
id: 30,
hex: '1E',
}),
https: new ServiceType({
defaultPort: 443,
name: 'HTTPS',
id: 33,
hex: '21',
}),
samba: new ServiceType({
defaultPort: 445,
name: 'Samba',
id: 34,
hex: '22',
}),
bulk: new ServiceType({
name: 'Bulk Service',
defaultPort: 65535,
id: 35,
hex: '23',
}),
nxWitness: new ServiceType({
defaultPort: 7001,
name: 'NX Witness',
id: 37,
hex: '25',
}),
nextCloud: new ServiceType({
defaultPort: 443,
name: 'NextCloud',
id: 38,
hex: '26',
}),
openVPN: new ServiceType({
defaultPort: 1194,
name: 'Open VPN',
id: 39,
hex: '27',
}),
multiport: new ServiceType({
defaultPort: 65535,
name: 'MultiPort',
id: 40,
hex: '28',
}),
};
var ServiceTypes = /** @class */ (function () {
function ServiceTypes() {
}
Object.defineProperty(ServiceTypes, "tcp", {
get: function () {
return this.findByKey('tcp');
},
enumerable: true,
configurable: true
});
Object.defineProperty(ServiceTypes, "vnc", {
get: function () {
return this.findByKey('vnc');
},
enumerable: true,
configurable: true
});
Object.defineProperty(ServiceTypes, "rdp", {
get: function () {
return this.findByKey('rdp');
},
enumerable: true,
configurable: true
});
Object.defineProperty(ServiceTypes, "httpProxy", {
get: function () {
return this.findByKey('httpProxy');
},
enumerable: true,
configurable: true
});
Object.defineProperty(ServiceTypes, "httpsProxy", {
get: function () {
return this.findByKey('httpsProxy');
},
enumerable: true,
configurable: true
});
Object.defineProperty(ServiceTypes, "ssh", {
get: function () {
return this.findByKey('ssh');
},
enumerable: true,
configurable: true
});
Object.defineProperty(ServiceTypes, "http", {
get: function () {
return this.findByKey('http');
},
enumerable: true,
configurable: true
});
Object.defineProperty(ServiceTypes, "https", {
get: function () {
return this.findByKey('https');
},
enumerable: true,
configurable: true
});
Object.defineProperty(ServiceTypes, "samba", {
get: function () {
return this.findByKey('samba');
},
enumerable: true,
configurable: true
});
Object.defineProperty(ServiceTypes, "bulk", {
get: function () {
return this.findByKey('bulk');
},
enumerable: true,
configurable: true
});
Object.defineProperty(ServiceTypes, "nxWitness", {
get: function () {
return this.findByKey('nxWitness');
},
enumerable: true,
configurable: true
});
Object.defineProperty(ServiceTypes, "nextCloud", {
get: function () {
return this.findByKey('nextCloud');
},
enumerable: true,
configurable: true
});
Object.defineProperty(ServiceTypes, "openVPN", {
get: function () {
return this.findByKey('openVPN');
},
enumerable: true,
configurable: true
});
Object.defineProperty(ServiceTypes, "multiport", {
get: function () {
return this.findByKey('multiport');
},
enumerable: true,
configurable: true
});
ServiceTypes.findByKey = function (key) {
var match = this.all[key];
if (!match)
throw new Error('could not find service type with key: ' + key);
return match;
};
ServiceTypes.findByTypeString = function (type) {
var hex = type.split(':')[1];
return this.findByHex(hex);
};
ServiceTypes.findByHex = function (hex) {
var match = Object.values(this.all).find(function (t) { return t.hex === hex; });
if (!match)
throw new Error('could not find service type with hex: ' + hex);
return match;
};
ServiceTypes.findByID = function (id) {
var match = Object.values(this.all).find(function (t) { return t.id === id; });
if (!match)
throw new Error('could not find service type with id: ' + id);
return match;
};
ServiceTypes.all = ALL_SERVICES;
return ServiceTypes;
}());
exports.ServiceTypes = ServiceTypes;
//# sourceMappingURL=ServiceTypes.js.map