{"id":13825906,"url":"https://github.com/tmoonlight/nsmartproxy","last_synced_at":"2025-05-15T17:08:29.822Z","repository":{"id":38009322,"uuid":"165484892","full_name":"tmoonlight/NSmartProxy","owner":"tmoonlight","description":"NSmartProxy是一款开源的内网穿透工具。采用.NET CORE的全异步模式打造。(NSmartProxy is an open source reverse proxy tool that creates a secure tunnel from a public endpoint to a locally service.)","archived":false,"fork":false,"pushed_at":"2024-08-18T16:48:20.000Z","size":17156,"stargazers_count":1271,"open_issues_count":23,"forks_count":364,"subscribers_count":53,"default_branch":"master","last_synced_at":"2025-05-15T17:08:24.127Z","etag":null,"topics":["csharp","dotnetcore","intranet","linux","nat","p2p","protocols","proxy","remotecontrol","reverse","tcp"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tmoonlight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://tmoonlight.github.io/100lines/111.html"]}},"created_at":"2019-01-13T08:56:27.000Z","updated_at":"2025-05-15T07:34:07.000Z","dependencies_parsed_at":"2024-01-07T22:49:09.329Z","dependency_job_id":"0e969b30-6c0f-403d-ad20-be3b485e45d3","html_url":"https://github.com/tmoonlight/NSmartProxy","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmoonlight%2FNSmartProxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmoonlight%2FNSmartProxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmoonlight%2FNSmartProxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmoonlight%2FNSmartProxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmoonlight","download_url":"https://codeload.github.com/tmoonlight/NSmartProxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254384988,"owners_count":22062422,"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":["csharp","dotnetcore","intranet","linux","nat","p2p","protocols","proxy","remotecontrol","reverse","tcp"],"created_at":"2024-08-04T09:01:28.930Z","updated_at":"2025-05-15T17:08:24.812Z","avatar_url":"https://github.com/tmoonlight.png","language":"C#","readme":"\n\n\u003cimg src=\"http://2017studio.oss-accelerate.aliyuncs.com/NSmartProxyNew.png\"\u003e\n\n[![GitHub\nrelease](https://img.shields.io/github/release/tmoonlight/NSmartProxy.svg?logoColor=%21%5BGitHub%20release%5D%28https%3A%2F%2Fimg.shields.io%2Fgithub%2Frelease%2Ftmoonlight%2FNSmartProxy.svg%29)](https://github.com/tmoonlight/NSmartProxy/releases)\n[![GitHub](https://img.shields.io/github/license/tmoonlight/NSmartProxy.svg)](https://github.com/tmoonlight/NSmartProxy/blob/master/LICENSE)\n[![Build\nStatus](https://dev.azure.com/tmoonlight/NSmartProxy/_apis/build/status/tmoonlight.NSmartProxy?branchName=master)](https://dev.azure.com/tmoonlight/NSmartProxy/_build/latest?definitionId=1\u0026branchName=master)\n\u003cbr /\u003e\n![Docker Pulls](https://img.shields.io/docker/pulls/tmoonlight/nspclient?label=nspclient%20docker%20pulls)\n![Docker Pulls](https://img.shields.io/docker/pulls/tmoonlight/nspserver?label=nspserver%20docker%20pulls)\u003cbr /\u003e\n中文版 \\|\n[English](https://github.com/tmoonlight/NSmartProxy/blob/master/README_EN.md)\n\nNSmartProxy\n===========\n\n#### 什么是NSmartProxy？\u003cbr /\u003e\n\nNSmartProxy是一款免费的内网穿透工具。\u003cbr /\u003e\n使用中如果有任何问题和建议，可以[点击这里加入Gitter群组](https://gitter.im/tmoonlight/NSmartProxy)或者[点击这里加入QQ群\n（群号：813170640）](//shang.qq.com/wpa/qunwpa?idkey=139dc3d01be5cc7ac3226c022d832b8ddcc4ec4b64d8755cd4f5c669994970c7)我们一起讨论。\n\n目录\n----\n -   [特点](#特点)\n -   [运行原理](#运行原理)\n -   [客户端安装](#客户端安装)\n     -   [启动准备](#启动准备)\n     -   [使用方法](#使用方法)\n -   [服务端安装](#服务端安装)\n     -   [启动准备](#启动准备-1)\n     -   [使用方法](#使用方法-1)\n -   [使用案例](#使用案例)\n\n特点\n----\n\n1.  跨平台，客户端和服务端均可运行在MacOS，Linux，Windows系统上；\u003cbr /\u003e\n2.  使用方便，配置简单；\u003cbr /\u003e\n3.  多端映射，只需安装一个NSmartProxy客户端可映射整个局域网内的多种服务；\n4.  支持TCP协议栈下的所有协议（已经经过测试的有FTP、Telnet、SMTP、HTTP/HTTPS、POP3、SMB、VNC、RDP。），以及相当一部分基于UDP的协议（已经经过测试的有DNS查询、mosh服务）。\n\n运行原理\n--------\n\nNSmartProxy包含两个服务程序：\u003cbr /\u003e \n* 服务端（NSmartProxy.ServerHost）：部署在外网，用来接收来自最终使用者和客户端的反向连接，并将它们进行相互转发。\n* 客户端（NSmartProxyClient）：部署在内网，用来转发访问内网各种服务的请求以及响应。\n\u003cimg src=\"http://2017studio.oss-accelerate.aliyuncs.com/theo.png\"\u003e\n\n客户端安装\n----------\n\nNSmartProxy支持各种基于TCP和UDP服务的端口映射，下面以mstsc,iis,ftp以及mosh服务为例：\u003cbr /\u003e\n\n### 启动准备\n\nNSmartProxy的客户端被打包成三种发布方式：第一种是跨平台包，需要预先安装[.NET\nCore环境](https://dotnet.microsoft.com/download)。\n第二种是SCD包（包名带\"scd\"），无需安装.net环境，用户需要根据自己的平台和架构选择相应的压缩包。第三种是Windows窗体版本（包名带\"winform\"）：\n#### Windows \n1. 确保客户端的环境在.NET Framework 4.6.1 以上。 \n2. 下载最新的窗体版本https://github.com/tmoonlight/NSmartProxy/releases/download/v1.2_final4/nspclient_winform_v1.2_final4.zip\n\n#### Linux\n\n-  下载最新版本的NSmartProxyClient，以SCD发布下的linux x64系统为例：\n\n\u003c!-- --\u003e\n\n    wget https://github.com/tmoonlight/NSmartProxy/releases/download/v1.2_final4/nspserver_scd_linux_v1.2_final4.zip\n\n#### MacOS\n\n-  下载最新版本的NSmartProxyClient：\n\n\u003c!-- --\u003e\n\n    wget https://github.com/tmoonlight/NSmartProxy/releases/download/v1.2_final4/nspclient_scd_osx_v1.2_final4.zip\n\n#### Docker\n\n-   如果当前机器上已经有了docker运行环境，则无需安装运行时，直接拉取镜像即可运行，如下脚本在Docker\n    CE 17.09下测试通过：\n\n\u003c!-- --\u003e\n\n    sudo docker pull tmoonlight/nspclient\n    sudo docker run --name mynspclient -dit tmoonlight/nspclient\n\n### 使用方法\n\n1.  打开安装目录下的appsettings.json文件，配置服务地址，映射地址和端口（winform版本也兼容这种配置方式，也可直接进入界面配置）：\u003cbr /\u003e\n\n\u003c!-- --\u003e\n\n    {\n      \"ProviderWebPort\": 12309,         //服务器端口\n      \"ProviderAddress\": \"2017studio.imwork.net\",   //服务器地址\n\n      //反向代理客户端列表\n      \"Clients\": [\n        {//mstsc远程控制服务\n          \"IP\": \"127.0.0.1\",           //反向代理机器的ip\n          \"TargetServicePort\": \"3389\"  //反向代理服务的端口\n          \"ConsumerPort\":\"3389\"          //外网访问端口，如被占用，则会从20000开始按顺序分配端口\n        },\n        {//网站服务\n          \"IP\": \"127.0.0.1\",\n          \"TargetServicePort\": \"80\"\n        },\n        {//ftp服务\n          \"IP\": \"127.0.0.1\",\n          \"TargetServicePort\": \"21\",\n          \"IsCompress\" : true,      //表示启动传输压缩\n          \"Description\": \"这是一个ftp协议。\" //描述字段，方便用户在服务端界面识别\n        },\n        {//mosh服务 \n          \"IP\": \"192.168.0.168\",    //安装mosh服务的受控端地址\n          \"TargetServicePort\": \"60002\",\n          \"ConsumerPort\": \"30002\",  \n          \"Protocol\": \"UDP\"     //表示是一个UDP协议，如果不加以配置，则以TCP协议来转发\n        }\n      ]\n    }\n\n\u003cbr /\u003e 2. 运行NSmartProxy客户端 \u003cbr /\u003e\n\n-   Linux：\n\n\u003c!-- --\u003e\n\n        sudo unzip nspclient_scd_linux_v1.2.zip\n        cd nspclient_scd_linux_v1.2\n        chmod +x ./NSmartProxyClient\n        ./NSmartProxyClient\n\n-   MacOS：\n\n\u003c!-- --\u003e\n\n        sudo unzip nspclient_osx_linux_v1.2.zip\n        cd nspclient_scd_osx_v1.2\n        chmod +x ./NSmartProxyClient\n        ./NSmartProxyClient\n\n-   Windows： 解压后运行NSmartProxyWinform.exe即可:\n\n    \u003cimg src=\"http://2017studio.oss-accelerate.aliyuncs.com/5.nspclientwinformrunning.gif\" /\u003e\n    \u003cbr /\u003e\n\n3.  后台运行：\u003cbr /\u003e\n    您还可以将NSmartProxy客户端注册为一个后台服务，方法如下：\n\n-   Windows：\u003cbr /\u003e \n    - 方法一\u003cbr /\u003e\n    \u003cimg src=\"https://github.com/tmoonlight/NSmartProxy/raw/master/imgs/servicecn.png\"\u003e\u003cbr /\u003e\n\n    - 方法二\u003cbr /\u003e\n```\n    rem 注册客户端windows服务\n    .\\NSmartProxyClient action:install\n```\n```\n    rem 卸载客户端windows服务\n    .\\NSmartProxyClient action:uninstall\n```\n-   MacOS/Linux 暂略\n\n#### 客户端登陆\n默认情况下，客户端以\u003cb\u003e匿名登陆\u003c/b\u003e，这种方式会在NSmartProxyServer端创建一个随机匿名用户（前提是服务端配置了允许\u003cb\u003e匿名登陆\u003c/b\u003e），如果想显式使用特定用户登陆，需要在第一次运行时增加-u 用户名 -p 密码参数，程序会在当前目录生成一份凭据（.usercache）方便下次自动登陆。\n例如输入以下指令来生成一个用户名admin，密码admin123的凭据：\n```\n./NSmartProxyClient -u admin -p admin123\n```\n下次仅需使用：\n```\n./NSmartProxyClient\n```\n自动采用上次的admin用户登陆，如需恢复匿名登陆，则需要删除当前目录下的.usercache文件。\n\n-   P.S：\n    以上是客户端的配置方法，一般情况下，只要用我的免费服务（2017studio.imwork.net）即可进行内网映射了，如果你还想自己搭建服务端，请接着往下看。\n\n服务端安装\n----------\n\n这里介绍NSmartProxy服务端的安装方法（linux,windows,MacOS均适用）\u003cbr /\u003e\n\n### 启动准备\n\n-   首先你需要一台具备独立IP的服务器，以下安装过程均在此机器上执行：\n#### Linux/Windows/MacOS\n\n1.  NSmartProxy的服务端程序被打包成两种发布方式。第一种是跨平台包，需要预先安装[.NET\n    Core环境](https://dotnet.microsoft.com/download)。\n    第二种是SCD包（包名带\"scd\"），无需安装.net环境，用户需要根据自己的平台和架构选择相应的压缩包。\u003cbr /\u003e\n2.  下载最新版的NSmartProxy服务端：\n-   Linux：\n\u003c!-- --\u003e\n    wget https://github.com/tmoonlight/NSmartProxy/releases/download/v1.2_final4/nspserver_scd_linux_v1.2_final4.zip\n\n-   Windows：\u003cbr /\u003e\n下载https://github.com/tmoonlight/NSmartProxy/releases/download/v1.2_final4/nspserver_scd_win_v1.2_final4.zip\n\n-   MacOS：\n\u003c!-- --\u003e\n\n    wget https://github.com/tmoonlight/NSmartProxy/releases/download/v1.2_final4/nspserver_scd_osx_v1.2_final4.zip\n\n#### Docker\n\n-   无需安装运行时，直接拉取镜像即可运行，运行镜像时需要4组端口：配置端口，反向连接端口，API服务端口，以及使用端口，如下脚本在Docker\n    CE 17.09下测试通过：\n\n\u003c!-- --\u003e\n\n    sudo docker pull tmoonlight/nspserver\n    sudo docker run --name mynspserver -dit -p 7842:7842 -p 7841:7841 -p 12309:12309 -p 20000-20050 tmoonlight/nspserver\n\n### 使用方法\n\n1.  解压缩NSmartProxy服务端的压缩包，以下以SCD发布下的linux系统为例\n\n\u003c!-- --\u003e\n\n    unzip nspserver_scd_linux_v1.2_final4.zip\n\n2.  打开安装目录下的appsettings.json文件，设置反向连接端口和配置服务端口，如果没有特殊需求，默认就好：\u003cbr /\u003e\n\n\u003c!-- --\u003e\n\n    {\n      \"ReversePort\": 7842, //反向连接端口\n      \"ConfigPort\": 7841, //配置服务端口\n      \"WebAPIPort\": 12309         //API服务端口\n    }\n\n3. 运行NSmartProxy \u003cbr /\u003e\n\n第一步 cd到安装目录 \u003cbr /\u003e 第二步 执行以下命令 \n* Linux/MacOS：\n\u003c!-- --\u003e\n    chmod +x ./NSmartProxy.ServerHost\n    ./NSmartProxy.ServerHost\n\n* Windows：\n点击 Win+R 打开运行窗口. 输入 \"cmd\" 按下Ctrl+Shift+Enter打开管理员身份运行的命令行窗口。cd到安装目录，运行如下指令：\n\u003c!-- --\u003e\n    NSmartProxy.ServerHost\n\n第三步 登陆http://ip:12309 进入web端，出厂用户密码为admin/admin\n\n\u003cimg src=\"http://2017studio.oss-accelerate.aliyuncs.com/6.nspserverrunnning_1.gif\" /\u003e\n\n第四步 进入服务端对用户进行各种管理操作\n\n\u003cimg src=\"http://2017studio.oss-accelerate.aliyuncs.com/6.nspserverrunnning_2.gif\" /\u003e\n\n####   注册为后台服务\u003cbr /\u003e\nNSmartProxy客户端和服务端均可以注册为一个后台服务，方法如下：\n* Windows\n    以管理员身份打开命令行后，cd到程序运行目录，运行以下指令进行服务的注册和卸载：\n\n\u003c!-- --\u003e\n\n    rem 注册服务端windows服务\n    .\\NSmartProxy.ServerHost action:install\n\n    rem 卸载服务端windows服务\n    .\\NSmartProxy.ServerHost action:uninstall\n\n* MacOS/Linux \u003cbr /\u003e\n可参考wiki: [How To: 30秒使用Linux搭建一个内网穿透服务端](https://github.com/tmoonlight/NSmartProxy/wiki/How-To:-30%E7%A7%92%E4%BD%BF%E7%94%A8Linux%E6%90%AD%E5%BB%BA%E4%B8%80%E4%B8%AA%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F%E6%9C%8D%E5%8A%A1%E7%AB%AF)\n\n使用案例\n--------\n以上已经讲述了将内网的服务映射到外网的方法，还有更多有趣的用法等着你发掘：\u003cbr /\u003e\n1. 远程开机 \n2. [使用windows远程控制操作办公室电脑](https://github.com/tmoonlight/NSmartProxy/wiki/How-To:-%E4%BD%BF%E7%94%A8NSmartProxy%E5%AE%9E%E7%8E%B0windows%E4%B8%8A%E7%9A%84%E8%BF%9C%E7%A8%8B%E5%8A%9E%E5%85%AC) \n3. 告别昂贵的vps，以极低的成本制作一个更强大的服务集群\u003cbr /\u003e\n","funding_links":["https://tmoonlight.github.io/100lines/111.html"],"categories":["\u003ca id=\"01e6651181d405ecdcd92a452989e7e0\"\u003e\u003c/a\u003e工具"],"sub_categories":["\u003ca id=\"9d6789f22a280f5bb6491d1353b02384\"\u003e\u003c/a\u003e隧道\u0026\u0026穿透"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmoonlight%2Fnsmartproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmoonlight%2Fnsmartproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmoonlight%2Fnsmartproxy/lists"}