mirror of
https://github.com/netchx/netch.git
synced 2026-03-14 17:43:18 +08:00
[Netch] Support TCP Fast Open
This commit is contained in:
@@ -117,6 +117,8 @@ public class StreamSettings
|
||||
public TlsSettings xtlsSettings { get; set; }
|
||||
|
||||
public GrpcSettings grpcSettings { get; set; }
|
||||
|
||||
public Sockopt sockopt { get; set; }
|
||||
}
|
||||
|
||||
#region Transport
|
||||
@@ -184,4 +186,9 @@ public class GrpcSettings
|
||||
public bool multiMode { get; set; }
|
||||
}
|
||||
|
||||
public class Sockopt
|
||||
{
|
||||
public bool tcpFastOpen { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -160,6 +160,17 @@ public static class V2rayConfigUtils
|
||||
plugin = ss.Plugin ?? "",
|
||||
pluginOpts = ss.PluginOption ?? ""
|
||||
};
|
||||
|
||||
if (Global.Settings.V2RayConfig.TCPFastOpen)
|
||||
{
|
||||
outbound.streamSettings = new StreamSettings
|
||||
{
|
||||
sockopt = new Sockopt
|
||||
{
|
||||
tcpFastOpen = true
|
||||
}
|
||||
};
|
||||
}
|
||||
break;
|
||||
case ShadowsocksRServer ssr:
|
||||
outbound.protocol = "shadowsocks";
|
||||
@@ -184,6 +195,17 @@ public static class V2rayConfigUtils
|
||||
"--protocol-param=" + ssr.ProtocolParam ?? ""
|
||||
}
|
||||
};
|
||||
|
||||
if (Global.Settings.V2RayConfig.TCPFastOpen)
|
||||
{
|
||||
outbound.streamSettings = new StreamSettings
|
||||
{
|
||||
sockopt = new Sockopt
|
||||
{
|
||||
tcpFastOpen = true
|
||||
}
|
||||
};
|
||||
}
|
||||
break;
|
||||
case TrojanServer trojan:
|
||||
outbound.protocol = "trojan";
|
||||
@@ -225,6 +247,15 @@ public static class V2rayConfigUtils
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Global.Settings.V2RayConfig.TCPFastOpen)
|
||||
{
|
||||
outbound.streamSettings.sockopt = new Sockopt
|
||||
{
|
||||
tcpFastOpen = true
|
||||
}
|
||||
};
|
||||
}
|
||||
break;
|
||||
case WireGuardServer wg:
|
||||
outbound.protocol = "wireguard";
|
||||
@@ -238,6 +269,17 @@ public static class V2rayConfigUtils
|
||||
preSharedKey = wg.PreSharedKey,
|
||||
mtu = wg.MTU
|
||||
};
|
||||
|
||||
if (Global.Settings.V2RayConfig.TCPFastOpen)
|
||||
{
|
||||
outbound.streamSettings = new StreamSettings
|
||||
{
|
||||
sockopt = new Sockopt
|
||||
{
|
||||
tcpFastOpen = true
|
||||
}
|
||||
};
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -366,6 +408,14 @@ public static class V2rayConfigUtils
|
||||
throw new MessageException($"transfer protocol \"{server.TransferProtocol}\" not implemented yet");
|
||||
}
|
||||
|
||||
if (Global.Settings.V2RayConfig.TCPFastOpen)
|
||||
{
|
||||
streamSettings.sockopt = new Sockopt
|
||||
{
|
||||
tcpFastOpen = true
|
||||
};
|
||||
}
|
||||
|
||||
return streamSettings;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user