{"id":13396777,"url":"https://github.com/node-modules/address","last_synced_at":"2025-05-15T11:00:22.260Z","repository":{"id":9791859,"uuid":"11767981","full_name":"node-modules/address","owner":"node-modules","description":"Get current machine IP and MAC address.","archived":false,"fork":false,"pushed_at":"2024-06-21T05:29:35.000Z","size":113,"stargazers_count":238,"open_issues_count":13,"forks_count":33,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-04-22T04:34:24.049Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"dotnet/orleans","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/node-modules.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-07-30T15:08:35.000Z","updated_at":"2025-03-04T02:41:06.000Z","dependencies_parsed_at":"2023-11-12T06:20:43.807Z","dependency_job_id":"bdfc643d-6bac-4f5d-8f70-7a432134d511","html_url":"https://github.com/node-modules/address","commit_stats":{"total_commits":50,"total_committers":12,"mean_commits":4.166666666666667,"dds":0.5,"last_synced_commit":"75fbf02740f8880949ef76b4b3563bcdade6c77d"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Faddress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Faddress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Faddress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Faddress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/node-modules","download_url":"https://codeload.github.com/node-modules/address/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251871521,"owners_count":21657467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T18:01:02.863Z","updated_at":"2025-05-15T11:00:22.235Z","avatar_url":"https://github.com/node-modules.png","language":"TypeScript","readme":"# address\n\n[![NPM version][npm-image]][npm-url]\n[![Node.js CI](https://github.com/node-modules/address/actions/workflows/nodejs.yml/badge.svg)](https://github.com/node-modules/address/actions/workflows/nodejs.yml)\n[![Test coverage][coveralls-image]][coveralls-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/address.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/address\n[coveralls-image]: https://img.shields.io/coveralls/node-modules/address.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/node-modules/address?branch=master\n[download-image]: https://img.shields.io/npm/dm/address.svg?style=flat-square\n[download-url]: https://npmjs.org/package/address\n\nGet current machine IPv4, IPv6, MAC and DNS servers.\n\nDNS servers receive from `/etc/resolv.conf`.\n\n## Install\n\n```bash\nnpm install address\n```\n\n## Usage\n\nGet IP is sync and get MAC is async for now.\n\n- esm \u0026 typescript\n\n```ts\nimport { ip, ipv6, mac } from 'address';\n\n// default interface 'eth' on linux, 'en' on osx.\nip();   // '192.168.0.2'\nipv6(); // 'fe80::7aca:39ff:feb0:e67d'\nmac(function (err, addr) {\n  console.log(addr); // '78:ca:39:b0:e6:7d'\n});\n\n// local loopback\nip('lo'); // '127.0.0.1'\n\n// vboxnet MAC\nmac('vboxnet', function (err, addr) {\n  console.log(addr); // '0a:00:27:00:00:00'\n});\n```\n\n- commonjs\n\n```js\nconst { ip, ipv6, mac } = require('address');\n\n// default interface 'eth' on linux, 'en' on osx.\nip();   // '192.168.0.2'\nipv6(); // 'fe80::7aca:39ff:feb0:e67d'\nmac(function (err, addr) {\n  console.log(addr); // '78:ca:39:b0:e6:7d'\n});\n\n// local loopback\nip('lo'); // '127.0.0.1'\n\n// vboxnet MAC\nmac('vboxnet', function (err, addr) {\n  console.log(addr); // '0a:00:27:00:00:00'\n});\n```\n\n### Get all addresses: IPv4, IPv6 and MAC\n\n- esm \u0026 typescript\n\n```ts\nimport { address } from 'address';\n\naddress((err, addrs) =\u003e {\n  console.log(addrs.ip, addrs.ipv6, addrs.mac);\n  // '192.168.0.2', 'fe80::7aca:39ff:feb0:e67d', '78:ca:39:b0:e6:7d'\n});\n\naddress('vboxnet', (err, addrs) =\u003e {\n  console.log(addrs.ip, addrs.ipv6, addrs.mac);\n  // '192.168.56.1', null, '0a:00:27:00:00:00'\n});\n```\n\n- commonjs\n\n```js\nconst { address } = require('address');\n\naddress((err, addrs) =\u003e {\n  console.log(addrs.ip, addrs.ipv6, addrs.mac);\n  // '192.168.0.2', 'fe80::7aca:39ff:feb0:e67d', '78:ca:39:b0:e6:7d'\n});\n\naddress('vboxnet', (err, addrs) =\u003e {\n  console.log(addrs.ip, addrs.ipv6, addrs.mac);\n  // '192.168.56.1', null, '0a:00:27:00:00:00'\n});\n```\n\n### Get an interface info with family\n\n- esm \u0026 typescript\n\n```ts\nimport { getInterfaceAddress } from 'address';\n\ngetInterfaceAddress('IPv4', 'eth1');\n// { address: '192.168.1.1', family: 'IPv4', mac: '78:ca:39:b0:e6:7d' }\n```\n\n- commonjs\n\n```js\nconst { getInterfaceAddress } = require('address');\n\ngetInterfaceAddress('IPv4', 'eth1');\n// { address: '192.168.1.1', family: 'IPv4', mac: '78:ca:39:b0:e6:7d' }\n```\n\n### Get DNS servers\n\n- esm \u0026 typescript\n\n```js\nimport { dns } from 'address';\n\ndns((err, servers) =\u003e {\n  console.log(servers);\n  // ['10.13.2.1', '10.13.2.6']\n});\n```\n\n- commonjs\n\n```js\nconst { dns } = require('address');\n\ndns((err, servers) =\u003e {\n  console.log(servers);\n  // ['10.13.2.1', '10.13.2.6']\n});\n```\n\n### Promise style apis\n\n```ts\nimport { address, mac, dns } from 'address/promises';\n\nconst addr = await address();\nconst macAddress = await mac();\nconst servers = await dns();\n```\n\n## License\n\n[MIT](LICENSE.txt)\n\n\u003c!-- GITCONTRIBUTOR_START --\u003e\n\n## Contributors\n\n|[\u003cimg src=\"https://avatars.githubusercontent.com/u/156269?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003efengmk2\u003c/b\u003e\u003c/sub\u003e](https://github.com/fengmk2)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/1147375?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003ealsotang\u003c/b\u003e\u003c/sub\u003e](https://github.com/alsotang)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/10237910?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003ejkelleyrtp\u003c/b\u003e\u003c/sub\u003e](https://github.com/jkelleyrtp)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/63956?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003eslyon\u003c/b\u003e\u003c/sub\u003e](https://github.com/slyon)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/1409643?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003emariodu\u003c/b\u003e\u003c/sub\u003e](https://github.com/mariodu)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/11351322?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003emathieutu\u003c/b\u003e\u003c/sub\u003e](https://github.com/mathieutu)\u003cbr/\u003e|\n| :---: | :---: | :---: | :---: | :---: | :---: |\n[\u003cimg src=\"https://avatars.githubusercontent.com/u/2139038?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003ezhangyuheng\u003c/b\u003e\u003c/sub\u003e](https://github.com/zhangyuheng)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/32174276?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003esemantic-release-bot\u003c/b\u003e\u003c/sub\u003e](https://github.com/semantic-release-bot)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/1400114?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003ecoolme200\u003c/b\u003e\u003c/sub\u003e](https://github.com/coolme200)\u003cbr/\u003e|[\u003cimg src=\"https://avatars.githubusercontent.com/u/5856440?v=4\" width=\"100px;\"/\u003e\u003cbr/\u003e\u003csub\u003e\u003cb\u003ewhxaxes\u003c/b\u003e\u003c/sub\u003e](https://github.com/whxaxes)\u003cbr/\u003e\n\nThis project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Fri Sep 22 2023 20:49:32 GMT+0800`.\n\n\u003c!-- GITCONTRIBUTOR_END --\u003e\n","funding_links":[],"categories":["系统","Repository","Uncategorized"],"sub_categories":["Network","Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-modules%2Faddress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnode-modules%2Faddress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-modules%2Faddress/lists"}