refactor: use paths.runtime in socket proxyPipe
This commit is contained in:
parent
2a657ab930
commit
d7f1415290
@ -4,8 +4,7 @@ import * as path from "path"
|
|||||||
import * as tls from "tls"
|
import * as tls from "tls"
|
||||||
import { Emitter } from "../common/emitter"
|
import { Emitter } from "../common/emitter"
|
||||||
import { generateUuid } from "../common/util"
|
import { generateUuid } from "../common/util"
|
||||||
import { tmpdir } from "./constants"
|
import { canConnect, paths } from "./util"
|
||||||
import { canConnect } from "./util"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a way to proxy a TLS socket. Can be used when you need to pass a
|
* Provides a way to proxy a TLS socket. Can be used when you need to pass a
|
||||||
@ -13,7 +12,7 @@ import { canConnect } from "./util"
|
|||||||
*/
|
*/
|
||||||
export class SocketProxyProvider {
|
export class SocketProxyProvider {
|
||||||
private readonly onProxyConnect = new Emitter<net.Socket>()
|
private readonly onProxyConnect = new Emitter<net.Socket>()
|
||||||
private proxyPipe = path.join(tmpdir, "tls-proxy")
|
private proxyPipe = path.join(paths.runtime, "tls-proxy")
|
||||||
private _proxyServer?: Promise<net.Server>
|
private _proxyServer?: Promise<net.Server>
|
||||||
private readonly proxyTimeout = 5000
|
private readonly proxyTimeout = 5000
|
||||||
|
|
||||||
@ -76,7 +75,10 @@ export class SocketProxyProvider {
|
|||||||
this._proxyServer = this.findFreeSocketPath(this.proxyPipe)
|
this._proxyServer = this.findFreeSocketPath(this.proxyPipe)
|
||||||
.then((pipe) => {
|
.then((pipe) => {
|
||||||
this.proxyPipe = pipe
|
this.proxyPipe = pipe
|
||||||
return Promise.all([fs.mkdir(tmpdir, { recursive: true }), fs.rmdir(this.proxyPipe, { recursive: true })])
|
return Promise.all([
|
||||||
|
fs.mkdir(paths.runtime, { recursive: true }),
|
||||||
|
fs.rmdir(this.proxyPipe, { recursive: true }),
|
||||||
|
])
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
|
Reference in New Issue
Block a user