Skip to content

Commit 0c1c070

Browse files
authored
Default to IPv4 localhost for Node 17 compatibility (#214)
Signed-off-by: Tim Perry <[email protected]>
1 parent d059e83 commit 0c1c070

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ Creates a client instance with the provided options. Note that this will not aut
194194

195195
- **options** An object compatible with [Net.connect][net-connect]'s options:
196196
- **port** The port where the ADB server is listening. Defaults to `5037`.
197-
- **host** The host of the ADB server. Defaults to `'localhost'`.
197+
- **host** The host of the ADB server. Defaults to `'127.0.0.1'`.
198198
- **bin** As the sole exception, this option provides the path to the `adb` binary, used for starting the server locally if initial connection fails. Defaults to `'adb'`.
199199
- Returns: The client instance.
200200

src/adb/client.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@ import DeviceClient from './DeviceClient';
2121

2222
export default class Client extends EventEmitter {
2323
public readonly options: ClientOptions;
24+
public readonly host: string;
2425
public readonly port: number | string;
2526
public readonly bin: string;
2627

27-
constructor({ port = 5037, bin = 'adb' }: ClientOptions = { port: 5037 }) {
28+
constructor({ host = '127.0.0.1', port = 5037, bin = 'adb' }: ClientOptions = { port: 5037 }) {
2829
super();
30+
this.host = host;
2931
this.port = port;
3032
this.bin = bin;
31-
this.options = { port, bin };
33+
this.options = { host, port, bin };
3234
}
3335

3436
public createTcpUsbBridge(serial: string, options: SocketOptions): TcpUsbServer {

0 commit comments

Comments
 (0)