Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@applitools/execution-grid-tunnel

Package Overview
Dependencies
Maintainers
34
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/execution-grid-tunnel - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5-beta.0

scripts/frpc.js

5

package.json
{
"name": "@applitools/execution-grid-tunnel",
"version": "1.0.4",
"version": "1.0.5-beta.0",
"description": "",

@@ -12,4 +12,3 @@ "main": "scripts/run-execution-grid-tunnel.js",

"scripts",
"examples",
"bin"
"examples"
],

@@ -16,0 +15,0 @@ "bin": {

42

scripts/run-execution-grid-tunnel.js
'use strict'
const os = require('os')
const path = require('path')
const {promises: fs} = require('fs')
const crypto = require('crypto');
const {promises: fs, existsSync, statSync} = require('fs')
const nodeCleanup = require('node-cleanup')
const {getCacheDirectoryPath} = require('../src/utils')
const createApp = require('../src/execution-grid-tunnel')

@@ -15,3 +17,4 @@ const {

initSocks5ProxyServer,
} = require('../src/utils')
} = require('../src/utils');
const { getExpectedHash, downloadFrpc, getBinHash, getManualFrpcInstallingErrorMessage } = require('./frpc');

@@ -59,2 +62,4 @@ // TODO: Client Should need other logging system

sendTunnelHeartBeatAlways = false, // Set it to true only in tests. By default, you shouldn't send heartbeat if there is no tunnel
shouldInstallFrpc = true,
cacheDirectoryPath = process.env.APPLITOOLS_EG_FRPC_CACHE_DIRECTORY || path.join(getCacheDirectoryPath(os.platform()), 'eg-applitools'),
mode = process.env.APPLITOOLS_EG_TUNNEL_MODE_ENV, // Set it to 'development' only in tests

@@ -76,22 +81,24 @@ } = {}) {

})
const platform = os.platform()
const arch = os.arch()
await createDirectoryIfDoesntExist(cacheDirectoryPath)
const frpcBinFilePath = frpcBinMap.get(`${os.platform()}_${os.arch()}`)
const fileSuffix = platform === 'win32' ? '.exe' : ''
const frpcPath = path.resolve(cacheDirectoryPath, `frpc${fileSuffix}`)
if (!frpcBinFilePath) {
throw `execution-grid-tunnel doesn't support ${os.platform()} with ${os.arch} architecture yet`
const expectedHash = getExpectedHash({platform, arch})
if (!expectedHash) {
throw `execution-grid-tunnel doesn't support ${platform} with ${arch} architecture yet`
}
const buffer = await fs.readFile(frpcBinFilePath)
const binPath = path.resolve(
FILES_ROOT_DIRECTORY,
`frpc${os.platform() === 'win32' ? '.exe' : ''}`,
)
let isFrpcExist = existsSync(frpcPath)
let isExpectedFrpc = existsSync(frpcPath) && (await getBinHash(frpcPath)) === expectedHash
// Create frpc file in tmp dir with rwe permissions
await fs.writeFile(binPath, buffer)
await fs.chmod(binPath, 0o777)
if (!isExpectedFrpc && !shouldInstallFrpc) throw new Error(getManualFrpcInstallingErrorMessage({platform, arch, cacheDirectoryPath, frpcPath, shouldUpdate: isFrpcExist}))
// if (!egTunnelManagerUrl) {
// throw 'You should define APPLITOOLS_EG_TUNNEL_MANAGER_URL first'
// }
if (!isExpectedFrpc) {
await downloadFrpc({platform, arch, cacheDirectoryPath, frpcPath ,expectedHash})
}

@@ -120,3 +127,3 @@ createDirectoryIfDoesntExist(serviceLoggerDirectory)

logFileDirectory: tunnelLogFileDirectory,
runTunnelBinPath: binPath,
runTunnelBinPath: frpcPath,
socks5Proxies: [socks5ProxyServer],

@@ -219,2 +226,3 @@ portRange,

module.exports = main

@@ -10,2 +10,3 @@ const createDirectoryIfDoesntExist = require('./create-directory-if-doesnt-exist')

const initSocks5ProxyServer = require('./init-socks5-proxy-server')
const {getCacheDirectoryPath} = require("./get-cache-directory-path")

@@ -34,2 +35,3 @@ function generatePromise() {

initSocks5ProxyServer,
getCacheDirectoryPath
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc