mirror of
https://github.com/snltty/linker.git
synced 2025-10-13 04:43:47 +08:00
sync
This commit is contained in:
@@ -10,6 +10,9 @@ using MemoryPack;
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using linker.tunnel.wanport;
|
||||
using System.Linq;
|
||||
using linker.libs.extends;
|
||||
using System.Buffers.Binary;
|
||||
|
||||
namespace linker.plugins.tunnel
|
||||
{
|
||||
@@ -63,7 +66,26 @@ namespace linker.plugins.tunnel
|
||||
{
|
||||
return new NetworkInfo
|
||||
{
|
||||
LocalIps = config.Data.Client.Tunnel.LocalIPs.Where(c => c.Equals(running.Data.Tuntap.IP) == false).ToArray(),
|
||||
LocalIps = config.Data.Client.Tunnel.LocalIPs
|
||||
.Where(c => c.Equals(running.Data.Tuntap.IP) == false)
|
||||
.Where(c=>
|
||||
{
|
||||
if(c.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||||
{
|
||||
uint ip = BinaryPrimitives.ReadUInt32BigEndian(c.GetAddressBytes());
|
||||
foreach (var item in running.Data.Tunnel.ExcludeIPs)
|
||||
{
|
||||
uint maskValue = NetworkHelper.MaskValue(item.Mask);
|
||||
uint ip1 = BinaryPrimitives.ReadUInt32BigEndian(item.IPAddress.GetAddressBytes());
|
||||
if((ip & maskValue) == (ip1 & maskValue))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.ToArray(),
|
||||
RouteLevel = config.Data.Client.Tunnel.RouteLevel + running.Data.Tunnel.RouteLevelPlus,
|
||||
MachineId = config.Data.Client.Id
|
||||
};
|
||||
|
Reference in New Issue
Block a user