@astro_z/nodejs-intership-lesson-1

1.0.1-alpha • Public • Published

nodejs-intership-lesson-1

NodeJs internship, lesson 1. Get Info by My Ip

npm install nodejs-intership-lesson-1

Usage

import { getIpByRequest, getPublicIpV4ByNetwork } from 'nodejs-intership-lesson-1';

console.log(getIpByRequest(request));
//=> '0.0.0.0'

console.log(await getPublicIpV4ByNetwork());
//=> '127.0.0.1'

API

The package returns the address of the internet-facing interface, as determined from the default gateway. When the address cannot be determined for any reason, 0.0.0.0 will be returned.

The package relies on operating systems tools and also can return ip with request connection.

getIpByRequest()

Returns the IPv4 address with request connection.

getPublicIpV4ByNetwork()

Returns the internal IPv4 address.

Readme

Keywords

none

Package Sidebar

Install

npm i @astro_z/nodejs-intership-lesson-1

Weekly Downloads

0

Version

1.0.1-alpha

License

MIT

Unpacked Size

9.77 kB

Total Files

7

Last publish

Collaborators

  • astro_z