A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/silverwind/default-gateway below:

silverwind/default-gateway: Get the default network gateway, cross-platform.

Obtains the machine's default gateway through exec calls to OS routing ints.

import {gateway4async, gateway4sync, gateway6async, gateway6sync} from "default-gateway";

const {gateway, version, int} = await gateway4async();
// gateway = '1.2.3.4', version = 4, int = 'en1'

const {gateway, version, int} = await gateway6async();
// gateway = '2001:db8::1', version = 6,int = 'en2'

const {gateway, version, int} = gateway4sync();
// gateway = '1.2.3.4', version = 4, int = 'en1'

const {gateway, version, int} = gateway6sync();
// gateway = '2001:db8::1', version = 6, int = 'en2'

Returns: result Object

The gateway property will always be defined on success, while int can be null if it cannot be determined. All methods reject/throw on unexpected conditions.

© silverwind, distributed under BSD licence


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4