@remote.it/core
Version:
Core remote.it JavasScript/TypeScript library
36 lines (30 loc) • 1.03 kB
text/typescript
import debug from 'debug'
import { InitiatorConfig, UserConfig } from './ConfigFile'
import { Process } from './Process'
import { Environment } from './Environment'
const d = debug('remoteit:InitiatorProcess')
export class InitiatorProcess extends Process {
authHash: string
port: number
hostname: string
uid: string
username: string
constructor(
config: InitiatorConfig, //& { debug?: boolean },
user: UserConfig //{ username: string; authHash: string }
) {
const encryption = 2
const restrictedIPs = '0.0.0.0'
const usernameBase64 = Buffer.from(user.username).toString('base64')
const hostname = config.hostname || '127.0.0.1'
const binary = Environment.connectdPath
super(
`${binary} -p ${usernameBase64} ${user.authHash} ${config.uid} T${config.port} ${encryption} ${hostname} ${restrictedIPs} 12 0 0`
)
this.authHash = user.authHash
this.port = config.port
this.hostname = hostname
this.uid = config.uid
this.username = user.username
}
}