Compare commits

..

No commits in common. "e5050fd9375f2a61924e80c613e15a8152248b71" and "73f1a15018a40133703b0847ab2347554da55a50" have entirely different histories.

9 changed files with 12 additions and 119 deletions

Binary file not shown.

View File

@ -1,9 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -1,55 +0,0 @@
using System.Text;
namespace AxibugTransfer.Config
{
public struct CfgInfo
{
public int localPort;
public string targetIP;
public int targetPort;
}
public static class Config
{
public static bool LoadConfig(out List<CfgInfo> cfgList)
{
cfgList = new List<CfgInfo>();
try
{
StreamReader sr = new StreamReader(System.Environment.CurrentDirectory + "\\config.cfg", Encoding.Default);
String line;
while (!string.IsNullOrEmpty((line = sr.ReadLine())))
{
if (!line.Contains(":"))
continue;
try
{
CfgInfo cfg = new CfgInfo()
{
localPort = Convert.ToInt32(line.Split(':')[0].Trim()),
targetIP = line.Split(':')[1].Trim(),
targetPort = Convert.ToInt32(line.Split(':')[2].Trim())
};
cfgList.Add(cfg);
}
catch
{
continue;
}
}
sr.Close();
if (cfgList.Count > 0)
return true;
else
return false;
}
catch(Exception ex)
{
Console.WriteLine("配置文件异常:"+ex.ToString());
return false;
}
}
}
}

View File

@ -8,7 +8,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\AxibugTransfer.Config\AxibugTransfer.Config.csproj" />
<ProjectReference Include="..\AxibugTransfer.Tcp\AxibugTransfer.Tcp.csproj" /> <ProjectReference Include="..\AxibugTransfer.Tcp\AxibugTransfer.Tcp.csproj" />
</ItemGroup> </ItemGroup>

View File

@ -0,0 +1,5 @@
using AxibugTransfer.Tcp;
new TcpTransfer(80, "Your IP", 8080, true).Start();
Console.ReadLine();

View File

@ -3,11 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59 VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AxibugTransfer.Tcp", "AxibugTransfer.Tcp\AxibugTransfer.Tcp.csproj", "{B5A89E34-0283-44CB-8683-8E41888CA949}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AxibugTransfer.Tcp", "AxibugTransfer.Tcp\AxibugTransfer.Tcp.csproj", "{B5A89E34-0283-44CB-8683-8E41888CA949}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AxibugTransfer.Config", "AxibugTransfer.Config\AxibugTransfer.Config.csproj", "{A4C29DED-B1B3-4312-8743-A2BF20188618}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AxibugTransfer.Test", "AxibugTransfer.Test\AxibugTransfer.Test.csproj", "{A27FCE74-123D-477C-BB5B-2879D0B39D22}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AxibugTransfer", "AxibugTransfer\AxibugTransfer.csproj", "{69341276-017A-43F1-BC73-6123013C689F}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -19,14 +17,10 @@ Global
{B5A89E34-0283-44CB-8683-8E41888CA949}.Debug|Any CPU.Build.0 = Debug|Any CPU {B5A89E34-0283-44CB-8683-8E41888CA949}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B5A89E34-0283-44CB-8683-8E41888CA949}.Release|Any CPU.ActiveCfg = Release|Any CPU {B5A89E34-0283-44CB-8683-8E41888CA949}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B5A89E34-0283-44CB-8683-8E41888CA949}.Release|Any CPU.Build.0 = Release|Any CPU {B5A89E34-0283-44CB-8683-8E41888CA949}.Release|Any CPU.Build.0 = Release|Any CPU
{A4C29DED-B1B3-4312-8743-A2BF20188618}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A27FCE74-123D-477C-BB5B-2879D0B39D22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4C29DED-B1B3-4312-8743-A2BF20188618}.Debug|Any CPU.Build.0 = Debug|Any CPU {A27FCE74-123D-477C-BB5B-2879D0B39D22}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4C29DED-B1B3-4312-8743-A2BF20188618}.Release|Any CPU.ActiveCfg = Release|Any CPU {A27FCE74-123D-477C-BB5B-2879D0B39D22}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4C29DED-B1B3-4312-8743-A2BF20188618}.Release|Any CPU.Build.0 = Release|Any CPU {A27FCE74-123D-477C-BB5B-2879D0B39D22}.Release|Any CPU.Build.0 = Release|Any CPU
{69341276-017A-43F1-BC73-6123013C689F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{69341276-017A-43F1-BC73-6123013C689F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{69341276-017A-43F1-BC73-6123013C689F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{69341276-017A-43F1-BC73-6123013C689F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -1,14 +0,0 @@
using AxibugTransfer.Tcp;
using AxibugTransfer.Config;
if (!Config.LoadConfig(out List<CfgInfo> cfgList))
{
Console.WriteLine("请检查配置文件!");
return;
}
foreach (CfgInfo cfg in cfgList)
new TcpTransfer(cfg.localPort, cfg.targetIP, cfg.targetPort, true).Start();
while (true)
Console.ReadLine();

View File

@ -1 +0,0 @@
80:127.0.0.1:8080

View File

@ -1,29 +1,3 @@
# AxibugTransfer # AxibugTransfer
一个自制的开源端口转发工具 By 皓月 一个自封装的端口转发类库
dotNet 版本: .Net 6
平台: Windows/Linux/Other..
项目"AxibugTransfer"为控制台版本项目
项目"AxibugTransfer.Tcp"为TCP端口转发库
##控制台版本使用方法
下载Release版本或者自编译AxibugTransfer项目.
编辑可执行程序目录的config.cfg配置文件
格式(可多行)
本地监听端口:目标IP:目标端口
如:
80:1.2.3.4:8080
81:1.2.3.4:8081
标识
将本地80端口TCP/HTTP请求转发到1.2.3.4的8080端口上
将本地81端口 转发到1.2.3.4的8081端口上
TODO:
完善的统计功能
使用 IOCP/epoll 提升性能
也许做一个GUI版本