This commit is contained in:
SpringHgui 2019-12-24 18:46:39 +08:00
commit cbc41f5843
6 changed files with 28 additions and 12 deletions

View File

@ -1,6 +1,6 @@
name: .NET Core
on: [pull_request]
on: [push]
jobs:
build:

View File

@ -24,4 +24,6 @@
</None>
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>
</Project>

View File

@ -49,6 +49,11 @@
"LocalIp": "127.0.0.1",
"LocalPort": 22,
"RemotePort": 12701
},
{
"LocalIp": "127.0.0.1",
"LocalPort": 3389, // windows3389
"RemotePort": 12702
}
]
}

View File

@ -3,6 +3,7 @@
[![Gitter](https://badges.gitter.im/SpringHgui/community.svg)](https://gitter.im/SpringHgui/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Build status](https://github.com/anjoy8/blog.core/workflows/.NET%20Core/badge.svg)](https://github.com/SpringHgui/FastTunnel/actions)
[![License](https://img.shields.io/badge/license-Apache%202-green.svg)](https://www.apache.org/licenses/LICENSE-2.0)
[![CircleCI](https://circleci.com/gh/gothinkster/aspnetcore-realworld-example-app.svg?style=svg)](https://circleci.com/gh/SpringHgui/FastTunnel)
- FastTunnel是一款内网络代理工具能够快速进行内网穿透。其核心原理是通过http代理所以使用的前提条件是
1. 必须有一台公网的服务器。
2. 拥有自己的域名。
@ -11,7 +12,7 @@
## 已实现功能
- 通过自定义域名访问部署于内网的 web 服务
- ssh远程内网主机
- 远程内网主机 linux/windows/mac
# 快速使用
## 配置服务端和客户端程序
@ -21,12 +22,13 @@
4. 分别修改客户端和服务端的配置文件 `appsettings.json`
5. 在程序根目录下执行 `dotnet FastTunnel.Client.dll`(客户端)`dotnet FastTunnel.Server.dll`(服务端)。
## 通过自定义域名配置访问
# 通过自定义域名配置访问
- 例如你拥有一个服务器公网ip地址为 `110.110.110.110` ,同时你有一个顶级域名为 `test.cc` 的域名,你希望访问 `test.test.cc`可以访问内网的一个网站。
- 你需要新增一个域名地址的DNS解析类型为`A`,名称为 `*` , ipv4地址为 `110.110.110.110` ,这样 `*.test.cc`的域名均会指向`110.110.110.110`的服务器,由于`FastTunnel`默认监听的http端口为1270所以要访问`http://test.test.cc:1270`
- 如果不希望每次访问都带上端口号,可以通过`nginx`转发实现。
## ssh远程内网主机
# 远程内网计算机 Windows/Linux/Mac
客户端配置如下内网有两台主机ip如下:
```
"ClientSettings": {
@ -36,29 +38,36 @@
},
"SSH": [
{
"LocalIp": "192.168.0.100",
"LocalPort": 22,
"LocalIp": "192.168.0.100", // linux主机
"LocalPort": 22, // ssh远程默认端口号
"RemotePort": 12701
},
{
"LocalIp": "192.168.0.101",
"LocalPort": 22,
"LocalIp": "192.168.0.101", // windows主机
"LocalPort": 3389, // windows远程桌面默认端口号
"RemotePort": 12702
}
]
}
```
## ssh远程内网linux主机 (ip:192.168.0.100)
假设内网主机的用户名为 root服务器ip为x.x.x.x访问内网的两个主机分别如下
```
ssh -oPort=12701 root@x.x.x.x
```
```
ssh -oPort=12702 root@x.x.x.x
```
# 开发
## mstsc远程桌面Windows主机(ip:192.168.0.101)
### 被控制端设置
- 打开cmd输入指令 `sysdm.cpl` 在弹出的对话框中选中允许远程连接此计算机
![img1](images/setallow.png)
### 控制端设置
- 打开cmd输入指令 `mstsc`,打开远程对话框,在对话框的计算机输入框,输入 `x.x.x.x:12701` 然后指定用户名密码即可远程内网的windows主机
![img1](images/remote.png)
# 参与开发/PR
- 安装 `vs2019`
- 安装 `dotnetcore runtime&sdk 3.1` 或以上版本
# License
Apache License 2.0

BIN
images/remote.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
images/setallow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB