node-nat-pmp

Node.js implementation of the NAT Port Mapping Protocol

  • 所有者: TooTallNate/node-nat-pmp
  • 平台:
  • 許可證:
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

node-nat-pmp

Node.js implementation of the NAT Port Mapping Protocol

This module offers an implementation of the NAT-PMP written in
pure JavaScript. You can use this module to dynamically open and close arbitrary
TCP and UDP ports against the network's internet gateway device.

Installation

Install with npm:

$ npm install nat-pmp

Examples

var natpmp = require('nat-pmp');

// create a "client" instance connecting to your local gateway
var client = natpmp.connect('10.0.1.1');


// explicitly ask for the current external IP address
client.externalIp(function (err, info) {
  if (err) throw err;
  console.log('Current external IP address: %s', info.ip.join('.'));
});


// setup a new port mapping
client.portMapping({ private: 22, public: 2222, ttl: 3600 }, function (err, info) {
  if (err) throw err;
  console.log(info);
  // {
  //   type: 'tcp',
  //   epoch: 8922109,
  //   private: 22,
  //   public: 2222,
  //   ...
  // }
});

API

License

(The MIT License)

Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

主要指標

概覽
名稱與所有者TooTallNate/node-nat-pmp
主編程語言JavaScript
編程語言JavaScript (語言數: 1)
平台
許可證
所有者活动
創建於2012-08-01 23:24:38
推送於2020-05-11 21:52:37
最后一次提交2015-06-30 09:42:29
發布數5
最新版本名稱1.0.0 (發布於 2016-01-12 11:53:15)
第一版名稱v0.0.1 (發布於 )
用户参与
星數133
關注者數5
派生數16
提交數47
已啟用問題?
問題數9
打開的問題數6
拉請求數2
打開的拉請求數2
關閉的拉請求數1
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?