only allow tcp connections locally (#1525)
This commit is contained in:
parent
a5f3a4d75b
commit
066e6f932b
2 changed files with 3 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ export class TcpMessenger<
|
|||
> implements IMessenger<ToProtocol, FromProtocol>
|
||||
{
|
||||
private port: number = 3000;
|
||||
private host: string = "127.0.0.1";
|
||||
private socket: net.Socket | null = null;
|
||||
|
||||
typeListeners = new Map<keyof ToProtocol, ((message: Message) => any)[]>();
|
||||
|
|
@ -30,7 +31,7 @@ export class TcpMessenger<
|
|||
});
|
||||
});
|
||||
|
||||
server.listen(this.port, () => {
|
||||
server.listen(this.port, this.host, () => {
|
||||
console.log(`Server listening on port ${this.port}`);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ class CoreMessenger(private val project: Project, esbuildPath: String, continueC
|
|||
init {
|
||||
if (useTcp) {
|
||||
try {
|
||||
val socket = Socket("localhost", 3000)
|
||||
val socket = Socket("127.0.0.1", 3000)
|
||||
val writer = PrintWriter(socket.getOutputStream(), true)
|
||||
this.writer = writer
|
||||
val reader = BufferedReader(InputStreamReader(socket.getInputStream()))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue