mirror of
https://github.com/FastTunnel/FastTunnel.git
synced 2025-02-08 02:39:29 +08:00
Merge branch 'master' of https://github.com/SpringHgui/FastTunnel
# Conflicts: # FastTunnel.Client/appsettings.json # FastTunnel.Core/Core/SuiDaoServer.cs # FastTunnel.Core/Handlers/LoginHandler.cs # FastTunnel.Server/Program.cs
This commit is contained in:
commit
9ddcbfbdf7
|
@ -244,7 +244,7 @@ namespace FastTunnel.Core.Core
|
|||
return null;
|
||||
}
|
||||
|
||||
private void HandleMsg(Socket client, Message<JObject> msg)
|
||||
private void HandleMsg(Socket client, Message<object> msg)
|
||||
{
|
||||
_logger.LogDebug($"收到客户端指令:{msg.MessageType}");
|
||||
switch (msg.MessageType)
|
||||
|
|
16
FastTunnel.Core/Handlers/LoginHandler.cs
Normal file
16
FastTunnel.Core/Handlers/LoginHandler.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using FastTunnel.Core.Models;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace FastTunnel.Core.Handlers
|
||||
{
|
||||
public class LoginHandler : ILoginHandler
|
||||
{
|
||||
public LogInRequest GetConfig(object content)
|
||||
{
|
||||
return (content as JObject).ToObject<LogInRequest>();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,6 +8,6 @@ namespace FastTunnel.Core.Handlers
|
|||
{
|
||||
public interface IConfigHandler
|
||||
{
|
||||
LogInRequest GetConfig(JObject content);
|
||||
LogInRequest GetConfig(object content);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,11 @@ namespace FastTunnel.Server
|
|||
private static void Config(ServiceCollection service)
|
||||
{
|
||||
service.AddTransient<FastTunnelServer>()
|
||||
<<<<<<< HEAD
|
||||
.AddSingleton<LoginHandler>()
|
||||
=======
|
||||
.AddTransient<ILoginHandler, LoginHandler>()
|
||||
>>>>>>> b12e8925412fbe56feb317950a40e7bd799638d3
|
||||
.AddSingleton<ServerConfig>(implementationFactory);
|
||||
}
|
||||
|
||||
|
|
33
README.md
33
README.md
|
@ -5,34 +5,20 @@
|
|||
[![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是一款跨平台网络代理工具,能够快速进行内网穿透。既然是代理,所以使用的时应具备
|
||||
1. 拥有一台公网的服务器
|
||||
2. 拥有自己的域名(如果使用域名穿透访问web则需要)
|
||||
|
||||
***如果上面两个都没有,您还可以使用下面的测试服务器。***
|
||||
- FastTunnel是一款跨平台内网穿透工具,提供反向代理内网服务,将内网服务暴露在公网供别人访问,您可以通过本项目快速搭建一个穿透服务,需要的物料如下:
|
||||
1. 一台公网的服务器
|
||||
2. 自己的域名(如果使用域名穿透访问内网站点则需要)
|
||||
|
||||
## 免费内网穿透地址
|
||||
https://suidao.io
|
||||
|
||||
## 特性
|
||||
- [x] 用自定义域名访问内网web服务(常用于微信开发)
|
||||
- [x] 远程内网计算机 Windows/Linux/Mac
|
||||
- [x] 端口转发,访问内网任意端口提供的服务 mysql、redis、ftp等等
|
||||
- [ ] 点对点p2p穿透
|
||||
|
||||
## 测试服务器 (请勿滥用)
|
||||
```
|
||||
ip `45.132.12.57`
|
||||
```
|
||||
```
|
||||
已开端口号,括号内容为本端口的测试用途
|
||||
1270(httpProxy) 1271(bindPort) 1273(ssh) 1274(ssh) 1275(ssh)
|
||||
```
|
||||
```
|
||||
域名解析
|
||||
A *.ft.suidao.io
|
||||
```
|
||||
```
|
||||
本服务器已运行 `FastTunnel.Server` 本地可以直接运行客户端连接
|
||||
nginx反向代理已开启,web穿透可不加端口号1270即可直接访问。
|
||||
```
|
||||
## 快速使用
|
||||
## 快速开始
|
||||
1. 在 [releases](https://github.com/SpringHgui/FastTunnel/releases) 页面下载对应的程序
|
||||
2. 分别修改配置文件`appsettings.json`
|
||||
3. 服务端运行FastTunnel.Server.exe(windows),其他平台安装dotnetcore运行时,执行 dotnet FastTunnel.Server.dll
|
||||
|
@ -89,3 +75,6 @@ ssh -oPort=12701 root@x.x.x.x
|
|||
|
||||
# License
|
||||
Apache License 2.0
|
||||
|
||||
# 联系作者
|
||||
hangui0127@qq.com
|
||||
|
|
|
@ -67,7 +67,6 @@ namespace SuiDao.Client
|
|||
|
||||
private static void Run(IServiceProvider servicesProvider, ILogger _logger, string key)
|
||||
{
|
||||
// https://localhost:5002
|
||||
var res = HttpHelper.PostAsJson("https://api1.suidao.io/api/Client/GetServerByKey", $"{{ \"key\":\"{key}\"}}").Result;
|
||||
var jobj = JObject.Parse(res);
|
||||
if ((bool)jobj["success"] == true)
|
||||
|
|
|
@ -12,9 +12,9 @@ namespace SuiDao.Server
|
|||
{
|
||||
public class SuiDaoLoginHandler : IConfigHandler
|
||||
{
|
||||
public LogInRequest GetConfig(JObject content)
|
||||
public LogInRequest GetConfig(object content)
|
||||
{
|
||||
var key = content["key"].ToString();
|
||||
var key = (content as JObject)["key"].ToString();
|
||||
var res = HttpHelper.PostAsJson("https://api1.suidao.io/api/Client/GetTunnelByKey", $"{{ \"key\":\"{key}\"}}").Result;
|
||||
var jobj = JObject.Parse(res);
|
||||
if ((bool)jobj["success"] == true)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<_LastSelectedProfileId>G:\GitHub\FastTunnel\SuiDao.Server\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
|
||||
<_LastSelectedProfileId>D:\GitHub\FastTunnel\SuiDao.Server\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -3,7 +3,7 @@
|
|||
for /d %%p in (FastTunnel.Client,FastTunnel.Server,SuiDao.Client) do (
|
||||
CD ./%%p
|
||||
for %%I in (win-x64,osx-x64,linux-x64) do (
|
||||
dotnet publish -o=../publish/%%p.%%I -c=release -f=netcoreapp3.1 -r=%%I --self-contained & 7z a -tzip ../publish/%%p.%%I.zip ../publish/%%p.%%I
|
||||
dotnet publish -o=../publish/%%p.%%I -c=release -f=netcoreapp3.1 -r=%%I --no-self-contained --nologo & 7z a -tzip ../publish/%%p.%%I.zip ../publish/%%p.%%I
|
||||
)
|
||||
cd ../
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user