diff --git a/NoSugarNet.ClientCore/Manager/AppLocalClient.cs b/NoSugarNet.ClientCore/Manager/AppLocalClient.cs
index d21c0c9..3679e72 100644
--- a/NoSugarNet.ClientCore/Manager/AppLocalClient.cs
+++ b/NoSugarNet.ClientCore/Manager/AppLocalClient.cs
@@ -220,7 +220,7 @@ namespace ServerCore.Manager
///
public void OnServerLocalDataCallBack(byte tunnelId,byte Idx, byte[] data)
{
- AppNoSugarNet.log.Debug($"OnServerLocalDataCallBack {tunnelId},{Idx}");
+ AppNoSugarNet.log.Debug($"OnServerLocalDataCallBack {tunnelId},{Idx},Data长度:{data.Length}");
if (!GetLocalListener(tunnelId, out LocalListener _listener))
return;
//解压
diff --git a/NoSugarNet.ClientCore/Manager/LocalClient/LocalListener.cs b/NoSugarNet.ClientCore/Manager/LocalClient/LocalListener.cs
index 8cb7abd..f8f84c2 100644
--- a/NoSugarNet.ClientCore/Manager/LocalClient/LocalListener.cs
+++ b/NoSugarNet.ClientCore/Manager/LocalClient/LocalListener.cs
@@ -58,7 +58,7 @@ namespace NoSugarNet.ClientCore
public void DataCallBack(Socket sk, byte[] data)
{
- AppNoSugarNet.log.Debug("收到消息 数据长度=>" + data.Length);
+ //AppNoSugarNet.log.Debug("收到消息 数据长度=>" + data.Length);
if (!GetSocketIdxBySocket(sk, out int Idx))
return;
@@ -201,9 +201,9 @@ namespace NoSugarNet.ClientCore
if (!GetSocketByIdx(Idx, out LocalClientInfo _localClientInfo))
return;
if (bConnected)
- AppNoSugarNet.log.Debug("远端本地连接已连接");
+ AppNoSugarNet.log.Debug("远端本地连接已连接!!!!");
else
- AppNoSugarNet.log.Debug("远端本地连接已断开连接");
+ AppNoSugarNet.log.Debug("远端本地连接已断开连接!!!!");
_localClientInfo.bRemoteConnect = bConnected;
}
diff --git a/NoSugarNet.ClientCore/NoSugarNet.ClientCore.csproj b/NoSugarNet.ClientCore/NoSugarNet.ClientCore.csproj
index c036340..acb0332 100644
--- a/NoSugarNet.ClientCore/NoSugarNet.ClientCore.csproj
+++ b/NoSugarNet.ClientCore/NoSugarNet.ClientCore.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net8.0
enable
enable
diff --git a/NoSugarNet.ClientCore/NoSugarNet.ClientCore.csproj.user b/NoSugarNet.ClientCore/NoSugarNet.ClientCore.csproj.user
new file mode 100644
index 0000000..410c61e
--- /dev/null
+++ b/NoSugarNet.ClientCore/NoSugarNet.ClientCore.csproj.user
@@ -0,0 +1,6 @@
+
+
+
+ <_LastSelectedProfileId>F:\Sin365\NoSugarNet\NoSugarNet.ClientCore\Properties\PublishProfiles\FolderProfile.pubxml
+
+
\ No newline at end of file
diff --git a/NoSugarNet.ClientCore/Properties/PublishProfiles/FolderProfile.pubxml b/NoSugarNet.ClientCore/Properties/PublishProfiles/FolderProfile.pubxml
new file mode 100644
index 0000000..5821348
--- /dev/null
+++ b/NoSugarNet.ClientCore/Properties/PublishProfiles/FolderProfile.pubxml
@@ -0,0 +1,15 @@
+
+
+
+
+ Release
+ Any CPU
+ bin\Release\net8.0\publish\
+ FileSystem
+ <_TargetId>Folder
+ net8.0
+ false
+
+
\ No newline at end of file
diff --git a/NoSugarNet.ClientCore/Properties/PublishProfiles/FolderProfile.pubxml.user b/NoSugarNet.ClientCore/Properties/PublishProfiles/FolderProfile.pubxml.user
new file mode 100644
index 0000000..be64a25
--- /dev/null
+++ b/NoSugarNet.ClientCore/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -0,0 +1,10 @@
+
+
+
+
+ True|2024-01-23T08:25:49.0876201Z;
+
+
+
\ No newline at end of file
diff --git a/NoSugarNet.ServerCore/Manager/LocalClientManager.cs b/NoSugarNet.ServerCore/Manager/LocalClientManager.cs
index 39575e9..6821f7c 100644
--- a/NoSugarNet.ServerCore/Manager/LocalClientManager.cs
+++ b/NoSugarNet.ServerCore/Manager/LocalClientManager.cs
@@ -108,7 +108,7 @@ namespace ServerCore.Manager
///
void OnClientLocalConnect(long uid, byte tunnelId,int Idx)
{
- ServerManager.g_Log.Debug($"OnClientLocalConnect {uid},{tunnelId},{Idx}");
+ ServerManager.g_Log.Debug($"OnClientLocalConnect!!!!!! {uid},{tunnelId},{Idx}");
if (!ServerManager.g_ClientMgr.GetClientByUID(uid, out ClientInfo client))
return;
@@ -145,7 +145,7 @@ namespace ServerCore.Manager
///
void OnClientLocalDisconnect(long uid, byte tunnelId,byte Idx)
{
- ServerManager.g_Log.Debug($"OnClientLocalDisconnect {uid},{tunnelId},{Idx}");
+ ServerManager.g_Log.Debug($"OnClientLocalDisconnect,收到客户端断开链接!!!!!! {uid},{tunnelId},{Idx}");
if (!ServerManager.g_ClientMgr.GetClientByUID(uid, out ClientInfo client))
return;
@@ -153,7 +153,7 @@ namespace ServerCore.Manager
if (!GetServerLocalClient(uid, tunnelId, Idx, out ServerLocalClient serverLocalClient))
return;
- //清楚服务器数据
+ //清除服务器数据
RemoveServerLocalClient(uid, tunnelId, Idx);
//断开服务端本地客户端连接
serverLocalClient.CloseConntect();
diff --git a/NoSugarNet.ServerCore/Manager/ServerLocalClient/ServerLocalClient.cs b/NoSugarNet.ServerCore/Manager/ServerLocalClient/ServerLocalClient.cs
index ed9275d..215ae65 100644
--- a/NoSugarNet.ServerCore/Manager/ServerLocalClient/ServerLocalClient.cs
+++ b/NoSugarNet.ServerCore/Manager/ServerLocalClient/ServerLocalClient.cs
@@ -55,7 +55,7 @@ namespace NoSugarNet.ClientCore.Network
/// 业务数据
public void GetDataCallBack(byte[] data)
{
- NetworkDeBugLog("收到消息 数据长度=>" + data.Length);
+ //NetworkDeBugLog("收到消息 数据长度=>" + data.Length);
try
{
//抛出网络数据
diff --git a/NoSugarNet.ServerCore/Manager/ServerManager.cs b/NoSugarNet.ServerCore/Manager/ServerManager.cs
index c9fe2ed..86d9e5d 100644
--- a/NoSugarNet.ServerCore/Manager/ServerManager.cs
+++ b/NoSugarNet.ServerCore/Manager/ServerManager.cs
@@ -23,7 +23,8 @@ namespace ServerCore.Manager
g_Login = new LoginManager();
g_Chat = new ChatManager();
g_Local = new LocalClientManager();
- g_SocketMgr = new IOCPNetWork(1024, 1024);
+ //g_SocketMgr = new IOCPNetWork(1024, 1024);
+ g_SocketMgr = new IOCPNetWork(1024, 4096);
g_SocketMgr.Init();
g_SocketMgr.Start(new IPEndPoint(IPAddress.Any.Address, port));
Console.WriteLine("Succeed!");
diff --git a/NoSugarNet.ServerCore/NoSugarNet.ServerCore.csproj b/NoSugarNet.ServerCore/NoSugarNet.ServerCore.csproj
index 4cc33e2..dd8c631 100644
--- a/NoSugarNet.ServerCore/NoSugarNet.ServerCore.csproj
+++ b/NoSugarNet.ServerCore/NoSugarNet.ServerCore.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net8.0
enable
enable
diff --git a/README.md b/README.md
index 803fe0f..c08994c 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,54 @@
# NoSugarNet
-NoSugarNet(无糖网络),一个有效降低任意C/S程序(软件,程序)网络流量传输的网络中间工具。
\ No newline at end of file
+NoSugarNet(无糖网络),一个有效降低任意C/S程序(软件,程序)网络流量传输的网络中间工具。
+
+
+
+# 流程诠释:
+
+【需要代理的程序】<----Localhost本地通讯----->【NoSugarNet.Client】 <----代理通讯-----> 【NoSugarNet.ServerCli】<----服务端本地-----> 【目标服务端程序】
+
+————————————————————
+
+# 服务端 NoSugarNet.ServerCli
+
+其中config.cfg 是配置文件
+
+格式:
+
+```
+ <配置编号>:<目标服务端IP>:<目标服务器端口>:<客户端监听的端口>
+```
+
+每个配置换行
+
+形如
+
+```
+0:1.2.3.4:3389:10001
+1:1.2.3.5:3389:10002
+```
+
+表示
+
+本代理服务,可以连接代理访问,1.2.3.4:3389 和 1.2.3.5:3389
+
+配置编号和客户端安排端口会发送到给客户端。
+
+客户端连接服务器获取基本信息后,客户端会开始监听10001和10002
+
+————————————————————
+
+客户端 NoSugarNet.ClientCli
+
+其中config.cfg 是配置文件
+
+格式:
+
+```
+<代理服务端IP>:<代理服务端Port>
+```
+
+*代理端口IP可以改,端口哦固定为1000,因为服务器中转端口写死的1000(笑)
+
+
diff --git a/Sample/NoSugarNet.ClientCli/Config.cs b/Sample/NoSugarNet.ClientCli/Config.cs
new file mode 100644
index 0000000..cf2535b
--- /dev/null
+++ b/Sample/NoSugarNet.ClientCli/Config.cs
@@ -0,0 +1,42 @@
+using System.Text;
+
+namespace NoSugarNet.ClientCli
+{
+ public static class Config
+ {
+ public static string ServerIP;
+ public static int ServerPort;
+ public static bool LoadConfig()
+ {
+ 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
+ {
+ ServerIP = line.Split(':')[0].Trim();
+ ServerPort = Convert.ToInt32(line.Split(':')[1].Trim());
+ }
+ catch
+ {
+ continue;
+ }
+ }
+ sr.Close();
+ if (!string.IsNullOrEmpty(ServerIP))
+ return true;
+ else
+ return false;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("配置文件异常:" + ex.ToString());
+ return false;
+ }
+ }
+ }
+}
diff --git a/Sample/NoSugarNet.ClientCli/NoSugarNet.ClientCli.csproj b/Sample/NoSugarNet.ClientCli/NoSugarNet.ClientCli.csproj
index e667905..e0be5ac 100644
--- a/Sample/NoSugarNet.ClientCli/NoSugarNet.ClientCli.csproj
+++ b/Sample/NoSugarNet.ClientCli/NoSugarNet.ClientCli.csproj
@@ -1,12 +1,20 @@
-
+
Exe
- net7.0
+ net8.0
enable
enable
+
+
+
+
+
+
+
+
diff --git a/Sample/NoSugarNet.ClientCli/NoSugarNet.ClientCli.csproj.user b/Sample/NoSugarNet.ClientCli/NoSugarNet.ClientCli.csproj.user
new file mode 100644
index 0000000..6d2fdd4
--- /dev/null
+++ b/Sample/NoSugarNet.ClientCli/NoSugarNet.ClientCli.csproj.user
@@ -0,0 +1,6 @@
+
+
+
+ <_LastSelectedProfileId>F:\Sin365\NoSugarNet\Sample\NoSugarNet.ClientCli\Properties\PublishProfiles\FolderProfile.pubxml
+
+
\ No newline at end of file
diff --git a/Sample/NoSugarNet.ClientCli/Program.cs b/Sample/NoSugarNet.ClientCli/Program.cs
index 35b52b7..49c7c29 100644
--- a/Sample/NoSugarNet.ClientCli/Program.cs
+++ b/Sample/NoSugarNet.ClientCli/Program.cs
@@ -6,7 +6,13 @@ namespace NoSugarNet.ClientCli
{
static void Main(string[] args)
{
- AppNoSugarNet.Init("127.0.0.1", 1000);
+ if (!Config.LoadConfig())
+ {
+ Console.WriteLine("配置文件错误");
+ Console.ReadLine();
+ return;
+ }
+ AppNoSugarNet.Init(Config.ServerIP, Config.ServerPort);
while (true)
{
Console.ReadLine();
diff --git a/Sample/NoSugarNet.ClientCli/Properties/PublishProfiles/FolderProfile.pubxml b/Sample/NoSugarNet.ClientCli/Properties/PublishProfiles/FolderProfile.pubxml
new file mode 100644
index 0000000..d37ba18
--- /dev/null
+++ b/Sample/NoSugarNet.ClientCli/Properties/PublishProfiles/FolderProfile.pubxml
@@ -0,0 +1,18 @@
+
+
+
+
+ Release
+ Any CPU
+ bin\Release\net8.0\publish\win-x64\
+ FileSystem
+ <_TargetId>Folder
+ net8.0
+ win-x64
+ false
+ false
+ false
+
+
\ No newline at end of file
diff --git a/Sample/NoSugarNet.ClientCli/Properties/PublishProfiles/FolderProfile.pubxml.user b/Sample/NoSugarNet.ClientCli/Properties/PublishProfiles/FolderProfile.pubxml.user
new file mode 100644
index 0000000..c2ac5d6
--- /dev/null
+++ b/Sample/NoSugarNet.ClientCli/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -0,0 +1,10 @@
+
+
+
+
+ True|2024-01-23T08:35:06.3918472Z;True|2024-01-23T16:34:52.0595483+08:00;True|2024-01-23T16:27:36.4850749+08:00;True|2024-01-23T16:27:04.0721589+08:00;
+
+
+
\ No newline at end of file
diff --git a/Sample/NoSugarNet.ClientCli/config.cfg b/Sample/NoSugarNet.ClientCli/config.cfg
new file mode 100644
index 0000000..a4c1abb
--- /dev/null
+++ b/Sample/NoSugarNet.ClientCli/config.cfg
@@ -0,0 +1 @@
+127.0.0.1:1000
\ No newline at end of file
diff --git a/Sample/NoSugarNet.ServerCli/NoSugarNet.ServerCli.csproj b/Sample/NoSugarNet.ServerCli/NoSugarNet.ServerCli.csproj
index 75d10bb..c941ed4 100644
--- a/Sample/NoSugarNet.ServerCli/NoSugarNet.ServerCli.csproj
+++ b/Sample/NoSugarNet.ServerCli/NoSugarNet.ServerCli.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ net8.0
enable
enable
diff --git a/Sample/NoSugarNet.ServerCli/NoSugarNet.ServerCli.csproj.user b/Sample/NoSugarNet.ServerCli/NoSugarNet.ServerCli.csproj.user
new file mode 100644
index 0000000..3108627
--- /dev/null
+++ b/Sample/NoSugarNet.ServerCli/NoSugarNet.ServerCli.csproj.user
@@ -0,0 +1,6 @@
+
+
+
+ <_LastSelectedProfileId>F:\Sin365\NoSugarNet\Sample\NoSugarNet.ServerCli\Properties\PublishProfiles\FolderProfile.pubxml
+
+
\ No newline at end of file
diff --git a/Sample/NoSugarNet.ServerCli/Program.cs b/Sample/NoSugarNet.ServerCli/Program.cs
index 76d02a8..b2e542b 100644
--- a/Sample/NoSugarNet.ServerCli/Program.cs
+++ b/Sample/NoSugarNet.ServerCli/Program.cs
@@ -6,6 +6,7 @@ namespace NoSugarNet.ServerCli
{
static void Main(string[] args)
{
+ Console.ForegroundColor = ConsoleColor.Green;
if (!Config.LoadConfig())
{
Console.WriteLine("配置文件错误");
diff --git a/Sample/NoSugarNet.ServerCli/Properties/PublishProfiles/FolderProfile.pubxml b/Sample/NoSugarNet.ServerCli/Properties/PublishProfiles/FolderProfile.pubxml
new file mode 100644
index 0000000..d37ba18
--- /dev/null
+++ b/Sample/NoSugarNet.ServerCli/Properties/PublishProfiles/FolderProfile.pubxml
@@ -0,0 +1,18 @@
+
+
+
+
+ Release
+ Any CPU
+ bin\Release\net8.0\publish\win-x64\
+ FileSystem
+ <_TargetId>Folder
+ net8.0
+ win-x64
+ false
+ false
+ false
+
+
\ No newline at end of file
diff --git a/Sample/NoSugarNet.ServerCli/Properties/PublishProfiles/FolderProfile.pubxml.user b/Sample/NoSugarNet.ServerCli/Properties/PublishProfiles/FolderProfile.pubxml.user
new file mode 100644
index 0000000..fa68c26
--- /dev/null
+++ b/Sample/NoSugarNet.ServerCli/Properties/PublishProfiles/FolderProfile.pubxml.user
@@ -0,0 +1,10 @@
+
+
+
+
+ True|2024-01-23T08:36:21.1141328Z;
+
+
+
\ No newline at end of file
diff --git a/Sample/NoSugarNet.ServerCli/config.cfg b/Sample/NoSugarNet.ServerCli/config.cfg
index 96e433c..1013425 100644
--- a/Sample/NoSugarNet.ServerCli/config.cfg
+++ b/Sample/NoSugarNet.ServerCli/config.cfg
@@ -1,4 +1,2 @@
-0:127.0.0.1:3306:10001
-1:127.0.0.1:3306:10002
-2:127.0.0.1:3306:10003
-3:127.0.0.1:3306:10004
\ No newline at end of file
+0:1.2.3.4:3389:10001
+1:1.2.3.5:3389:10002
\ No newline at end of file