{"id":13634796,"url":"https://github.com/enobufs/stun","last_synced_at":"2025-04-12T21:19:11.644Z","repository":{"id":40589257,"uuid":"2084777","full_name":"enobufs/stun","owner":"enobufs","description":"STUN server using node.js","archived":false,"fork":false,"pushed_at":"2022-12-30T18:20:17.000Z","size":219,"stargazers_count":484,"open_issues_count":13,"forks_count":115,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-03T23:09:28.881Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/enobufs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-07-21T17:47:03.000Z","updated_at":"2025-03-30T10:23:36.000Z","dependencies_parsed_at":"2023-01-31T13:00:28.108Z","dependency_job_id":null,"html_url":"https://github.com/enobufs/stun","commit_stats":{"total_commits":25,"total_committers":6,"mean_commits":4.166666666666667,"dds":0.24,"last_synced_commit":"5e417950733bf7528d4cfa645c2d08048eed585a"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enobufs%2Fstun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enobufs%2Fstun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enobufs%2Fstun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enobufs%2Fstun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enobufs","download_url":"https://codeload.github.com/enobufs/stun/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631900,"owners_count":21136585,"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-08-02T00:00:34.419Z","updated_at":"2025-04-12T21:19:11.621Z","avatar_url":"https://github.com/enobufs.png","language":"JavaScript","funding_links":[],"categories":["net protocol (网络库)"],"sub_categories":[],"readme":"# STUN server for Node.js\n\n\u003e Looking for older implementation? Go to [legacy](https://github.com/enobufs/stun/tree/legacy) branch.\n\n## Overview\nSTUN (Simple Traversal of UDP through NAT: RFC3489) is a protocol that allows a\nclient node to obtain an external IP address and port number assigned by a NAT\nthe client is behind. It can also identify behavioral type of the NAT.\n\n## System requirement\n* Node.js v0.10.x or above\n* Two IP addresses on the same machine (for server)\n\n## Installation\n```\n$ npm install -g node-stun\n```\n\n## Usage\n### How to run STUN server\nPlace a config file named as `node-stun.ini` in your current directory.\nThe config file should look like following. (These local loopback addresses\nshould be routable public IP addresses in the real settings, of course)\n\n```\n[primary]\nhost = 127.0.0.1\n\n[secondary]\nhost = 127.0.0.2\n```\n\nOn Mac, you can add another loopback address by typing:\n\n```\n$ sudo ifconfig lo0 alias 127.0.0.2 up\n```\n\nThe start STUN server:\n\n```\n$ node-stun-server\n```\n\n\n### How to run STUN client\n\nIn another terminal, type:\n\n```\n$ node-stun-client -s 127.0.0.1\n```\n\nIf successful, you should see the following on your console:\n```\nComplete(0): Open NB=I EF=I (Open to internet) mapped=127.0.0.1:61072 rtt=0\n```\n\n### API\n(TODO: Will finalize the API in the next release)\n\n\n# Limitations\n* Current implementation does not support RFC 5389\n* Following attributes are not supported\n   * RESPONSE-ADDRESS\n   * USERNAME\n   * PASSWORD\n   * MESSAGE-INTEGRITY\n   * ERROR-CODE\n   * UNKNOWN-ATTRIBUTE\n   * REFLECTED-FROM\n   * XOR-MAPPED-ADDRESS (RFC3489bis)\n\n# Public STUN servers that work with this STUN client\n\u003e Last tested on Jan 24, 2018\n\n* sip1.lakedestiny.cordiaip.com\n* stun.callwithus.com\n* stun.counterpath.net\n* stun.ideasip.com\n* stun.internetcalls.com\n* stun.sipgate.net\n* stun.stunprotocol.org\n* stun.voip.aebc.com\n* stun.voipbuster.com\n* stun.voxgratia.org\n* stun.xten.com\n\n\n# License\n\n```\n  Copyright (c) 2011 Yutaka Takeda \u003cyt0916 at gmail.com\u003e\n  MIT Lincesed\n \n  Permission is hereby granted, free of charge, to any person obtaining\n  a copy of this software and associated documentation files (the \"Software\"),\n  to deal in the Software without restriction, including without limitation\n  the rights to use, copy, modify, merge, publish, distribute, sublicense,\n  and/or sell copies of the Software, and to permit persons to whom the\n  Software is furnished to do so, subject to the following conditions:\n \n  The above copyright notice and this permission notice shall be included in\n  all copies or substantial portions of the Software.\n\n  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n  IN THE SOFTWARE.\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenobufs%2Fstun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenobufs%2Fstun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenobufs%2Fstun/lists"}