7.2.2 • Published 10 months ago

default-gateway v7.2.2

Weekly downloads
8,494,328
License
BSD-2-Clause
Repository
github
Last release
10 months ago

default-gateway

npm.io npm.io npm.io

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

  • On Linux and Android, the ip command must be available (usually provided by the iproute2 package).
  • On Unix (and macOS), the netstat command must be available.
  • On Windows, wmic must be available.
  • On IBM i, the db2util command must be available (provided by the db2util package).

Usage

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'

API

gateway4async()

gateway6async()

gateway4sync()

gateway6sync()

Returns: result Object

  • gateway String: The IP address of the default gateway.
  • version Number: The IP address version of gateway.
  • int String: The name of the interface. On Windows, this is the network adapter name.

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.

License

© silverwind, distributed under BSD licence

webpack-dev-serverinternal-ipcomponennentt@ishopee/cli-servicevuedragdropuploadimagesmylicensepg-cli-service@kzx/citic-cli-servicebb-chat@frxf/frxfmyrmeke@texttree/demo-bsa-reference-rcl@startdt/cli-service@startdt/next-serviceblocxus@sbase-theme-cli-demo/cli-service@sbase-theme-test/cli-service@l1nyanm1ng/react-picture-viewer@erikpham/cli-servicezoos-mp-images@gentean/vue-cli-servicelevibestliblevibestlib2levilibtest19levilibtest24levilibtest25levilibtest26levilibtest27levilibtest28levilibtest29@bugsounet/nat-apicclibyarntest@mfx0/clihyperpass-sdksklif-ui-kitsklif-api@everything-registry/sub-chunk-1461@314oner_npm/universal-components-libraryvue-cli-service-wc-native-slotsp149-tablesklif-ui@artifexweb/build@albkt/service@beldore/react-otp-input@darwishdev/dash-dev@cube-design/react@cyberspace/run@dcloudio/uni-automator@bmy/cli-service@borealisgroup/cli-service@carhoo/widget-dealers@giantx/cli-service@giantx/giant-cli-service@gibme/arpnextjs-storiesqa_hddprova-2-caroselloprova-cmpprova-cpm-2prova-cpm-3prova-cpm-4react-lightbox-pack-18supportreact-otp-input-uptdreact-solid-gradient-pickerrcli-vue3running-atxj-serviceuimoud7-act2vin-cli-servicevformlmqverify-img-codevirtual-tour-guidevue-compmenttinymce-plugin-toytestweblibapivue-cli-service-chalkfixvue-cli-service-sassjsvue-button-test1wbm-rpi-netwbm-rpi-utilswebpack_component_fundxap-net-addressxtmf-cliwebdatabasetest1webdatabasetest10webliblevi3webpack-build-helperwififoxystv-debug-server-nextzhangwangiuftohsaka888-use-breakpointts-rc-clitingzi-vuepressthirdsf-web-componentssummerseatestlsyy-mp-imagestaman-baca-masyarakatstnenopmoc-iu
7.1.0

10 months ago

7.0.0

10 months ago

7.2.2

10 months ago

7.2.1

10 months ago

7.2.0

10 months ago

6.0.3

3 years ago

6.0.2

4 years ago

6.0.1

4 years ago

6.0.0

4 years ago

5.0.5

4 years ago

5.0.4

4 years ago

5.0.3

5 years ago

5.0.2

5 years ago

5.0.1

5 years ago

5.0.0

5 years ago

4.2.0

5 years ago

4.1.2

5 years ago

4.1.0

5 years ago

4.0.1

5 years ago

4.0.0

5 years ago

3.1.0

5 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.7.2

6 years ago

2.7.1

6 years ago

2.7.0

6 years ago

2.6.3

6 years ago

2.6.2

6 years ago

2.6.1

6 years ago

2.6.0

7 years ago

2.5.0

7 years ago

2.4.0

7 years ago

2.3.1

7 years ago

2.3.0

7 years ago

2.2.2

7 years ago

2.2.1

7 years ago

2.2.0

7 years ago

2.1.0

7 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.8.6

7 years ago

0.8.5

7 years ago

0.8.4

7 years ago

0.8.3

7 years ago

0.8.2

7 years ago

0.8.1

7 years ago

0.8.0

7 years ago