Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only returns MAC address of server #4

Closed
Jaspur opened this issue Sep 10, 2013 · 3 comments
Closed

Only returns MAC address of server #4

Jaspur opened this issue Sep 10, 2013 · 3 comments

Comments

@Jaspur
Copy link

Jaspur commented Sep 10, 2013

It returns the MAC-address of my server, not the MAC-address of the client that is visiting the page.

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello Node.js\n');

    module.exports = require('./lib/address');

    var address = require('address');

    // default interface 'eth' on linux, 'en' on osx.
    address.ip();   // '192.168.0.2'
    address.ipv6(); // 'fe80::7aca:39ff:feb0:e67d'
    address.mac(function (err, addr) {
      console.log('Mac: '+addr); // '78:ca:39:b0:e6:7d'
    });

    // local loopback
    address.ip('lo'); // '127.0.0.1'

    // vboxnet MAC
    address.mac('vboxnet', function (err, addr) {
      console.log(addr); // '0a:00:27:00:00:00'
    });

    address(function (err, addrs) {
      console.log(addrs.ip, addrs.ipv6, addrs.mac);
      // '192.168.0.2', 'fe80::7aca:39ff:feb0:e67d', '78:ca:39:b0:e6:7d'
    });

    address('vboxnet', function (err, addrs) {
      console.log(addrs.ip, addrs.ipv6, addrs.mac);
      // '192.168.56.1', null, '0a:00:27:00:00:00'
    });

    address.interface('IPv4', 'eth1');


    address.dns(function (err, addrs) {
      console.log('DNS: '+addrs);

      res.writeHead(200, {'Content-Type': 'text/plain'});
      res.end(addrs);
      // ['10.13.2.1', '10.13.2.6']
    });



}).listen(8124, "192.168.2.42");
console.log('Server running at http://192.168.2.42:8124/');
@fengmk2
Copy link
Member

fengmk2 commented Sep 24, 2013

It can't got the client MAC address from this module.

@fengmk2 fengmk2 closed this as completed Sep 24, 2013
@Jaspur
Copy link
Author

Jaspur commented Sep 24, 2013

So the script isn't for getting the clients mac address?

@fengmk2
Copy link
Member

fengmk2 commented Sep 24, 2013

It just work on the current machine.


@fengmk2 (https://twitter.com/fengmk2)
@python发烧友 (http://weibo.com/imk2/profile)
http://fengmk2.github.com (http://fengmk2.github.com/)


记得当时年纪小/
你爱谈天,我爱笑/
有一回并肩坐在桃树下/
风在林梢鸟儿在叫/
我们不知怎样睡着了/
梦里花落知多少

On Tuesday, September 24, 2013 at 5:32 PM, Jaspur wrote:

So the script isn't for getting the clients mac address?


Reply to this email directly or view it on GitHub (#4 (comment)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants