\href{https://www.npmjs.org/package/default-gateway}{\texttt{ }} \href{https://www.npmjs.org/package/default-gateway}{\texttt{ }} \href{https://travis-ci.org/silverwind/default-gateway}{\texttt{ }}

\begin{quote}
Get the default network gateway, cross-\/platform. \end{quote}
Obtains the machine\textquotesingle{}s default gateway through {\ttfamily exec} calls to OS routing interfaces. On Linux and Android, the {\ttfamily ip} command must be available (usually provided by the {\ttfamily iproute2} package). On IBM i, the {\ttfamily db2util} command must be available (provided by the {\ttfamily db2util} package).\hypertarget{md_sfcode_node_modules_default_gateway_README_autotoc_md7915}{}\doxysection{Installation}\label{md_sfcode_node_modules_default_gateway_README_autotoc_md7915}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install default-\/gateway }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_default_gateway_README_autotoc_md7916}{}\doxysection{Example}\label{md_sfcode_node_modules_default_gateway_README_autotoc_md7916}

\begin{DoxyCode}{0}
\DoxyCodeLine{const defaultGateway = require('default-\/gateway');}
\DoxyCodeLine{}
\DoxyCodeLine{defaultGateway.v4().then(result => \{}
\DoxyCodeLine{  // result = \{gateway: '1.2.3.4', interface: 'en1'\}}
\DoxyCodeLine{\});}
\DoxyCodeLine{}
\DoxyCodeLine{defaultGateway.v6().then(result => \{}
\DoxyCodeLine{  // result = \{gateway: '2001:db8::1', interface: 'en2'\}}
\DoxyCodeLine{\});}
\DoxyCodeLine{}
\DoxyCodeLine{const result = defaultGateway.v4.sync();}
\DoxyCodeLine{// result = \{gateway: '1.2.3.4', interface: 'en1'\}}
\DoxyCodeLine{}
\DoxyCodeLine{const result = defaultGateway.v6.sync();}
\DoxyCodeLine{// result = \{gateway: '2001:db8::1', interface: 'en2'\} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_default_gateway_README_autotoc_md7917}{}\doxysection{API}\label{md_sfcode_node_modules_default_gateway_README_autotoc_md7917}
\hypertarget{md_sfcode_node_modules_default_gateway_README_autotoc_md7918}{}\doxysubsection{default\+Gateway.\+v4()}\label{md_sfcode_node_modules_default_gateway_README_autotoc_md7918}
\hypertarget{md_sfcode_node_modules_default_gateway_README_autotoc_md7919}{}\doxysubsection{default\+Gateway.\+v6()}\label{md_sfcode_node_modules_default_gateway_README_autotoc_md7919}
\hypertarget{md_sfcode_node_modules_default_gateway_README_autotoc_md7920}{}\doxysubsection{default\+Gateway.\+v4.\+sync()}\label{md_sfcode_node_modules_default_gateway_README_autotoc_md7920}
\hypertarget{md_sfcode_node_modules_default_gateway_README_autotoc_md7921}{}\doxysubsection{default\+Gateway.\+v6.\+sync()}\label{md_sfcode_node_modules_default_gateway_README_autotoc_md7921}
Returns\+: {\ttfamily result} {\itshape Object}
\begin{DoxyItemize}
\item {\ttfamily gateway}\+: The IP address of the default gateway.
\item {\ttfamily interface}\+: The name of the interface. On Windows, this is the network adapter name.
\end{DoxyItemize}

The {\ttfamily .v\{4,6\}()} methods return a Promise while the {\ttfamily .v\{4,6\}.sync()} variants will return the result synchronously.

The {\ttfamily gateway} property will always be defined on success, while {\ttfamily interface} can be {\ttfamily null} if it cannot be determined. All methods reject/throw on unexpected conditions.\hypertarget{md_sfcode_node_modules_default_gateway_README_autotoc_md7922}{}\doxysection{License}\label{md_sfcode_node_modules_default_gateway_README_autotoc_md7922}
© \href{https://github.com/silverwind}{\texttt{ silverwind}}, distributed under BSD licence 