This commit is contained in:
snltty
2024-07-25 14:26:32 +08:00
parent c998d14b0b
commit 8365676bc8
10 changed files with 67 additions and 45 deletions

View File

@@ -48,14 +48,16 @@ jobs:
env:
GITHUB_TOKEN: '${{ secrets.ACTIONS_TOKEN }}'
with:
tag_name: v1.1.3.2
release_name: v1.1.3.2.${{ steps.date.outputs.today }}
tag_name: v1.2.0.0
release_name: v1.2.0.0.${{ steps.date.outputs.today }}
draft: false
prerelease: false
body: |
1. 托盘检查
2. 停止服务清理网卡
3. 打洞错误
4. 网关层级计算修复(在linux下计算错误导致打洞失败)
5. 在IPV6环境下域名解析缓慢修复
- name: upload win x64
id: upload-win-x64

View File

@@ -36,5 +36,5 @@ jobs:
- name: Push
run: |
nuget push ./linker.tunnel/bin/release/linker.tunnel.1.1.3.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol
nuget push ./linker.libs/bin/release/linker.libs.1.1.3.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol
nuget push ./linker.tunnel/bin/release/linker.tunnel.1.2.0.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol
nuget push ./linker.libs/bin/release/linker.libs.1.2.0.nupkg -Source https://api.nuget.org/v3/index.json -SkipDuplicate -ApiKey ${{ secrets.NUGET_KEY }} -NoSymbol

View File

@@ -54,8 +54,11 @@ systemctl enable linker
3. 配置文件夹 `./configs`
4. 日志文件夹 `./logs`
5. debian `snltty/linker-debian-x64``snltty/linker-debian-arm64`,压缩约`70MB`、未压缩约`177MB`
4. alpine `snltty/linker-musl-x64``snltty/linker-musl-arm64`,压缩约`19MB`、未压缩约`43MB`
6. alpine `snltty/linker-musl-x64``snltty/linker-musl-arm64`,压缩约`19MB`、未压缩约`43MB`
#### 特别说明
1. 在容器中监听一个端口,宿主机无法访问,所以你需要把端口映射一下,比如 `-p 18000-18010:18000-18010`,预留这些端口,这样就可以使用这些端口做转发
2. 在docker容器中创建虚拟网卡是无法直接通过虚拟网卡访问宿主机的你需要把端口映射一下或者直接使用`host`网络模式
#### 客户端
```
docker run -it -d --name linker \

View File

@@ -31,31 +31,30 @@ namespace linker.libs
{
return ip;
}
IPAddress[] ips = Dns.GetHostEntry(domain).AddressList;
ip = ips.FirstOrDefault(c => c.AddressFamily == AddressFamily.InterNetwork);
if (ip == null)
{
ip = ips.FirstOrDefault(c => c.AddressFamily == AddressFamily.InterNetworkV6);
}
return ip;
return Dns.GetHostEntry(domain, AddressFamily.InterNetwork).AddressList.FirstOrDefault();
}
catch (Exception)
{
}
return null;
}
public static IPEndPoint GetEndPoint(string host, int defaultPort)
{
string[] hostArr = host.Split(':');
int port = defaultPort;
if (hostArr.Length == 2)
try
{
port = int.Parse(hostArr[1]);
string[] hostArr = host.Split(':');
int port = defaultPort;
if (hostArr.Length == 2)
{
port = int.Parse(hostArr[1]);
}
IPAddress ip = GetDomainIp(hostArr[0]);
return new IPEndPoint(ip, port);
}
IPAddress ip = GetDomainIp(hostArr[0]);
return new IPEndPoint(ip, port);
catch (Exception)
{
}
return null;
}

View File

@@ -14,9 +14,9 @@
<Copyright>snltty</Copyright>
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<Version>1.1.3</Version>
<AssemblyVersion>1.1.3.2</AssemblyVersion>
<FileVersion>1.1.3.2</FileVersion>
<Version>1.2.0</Version>
<AssemblyVersion>1.2.0.0</AssemblyVersion>
<FileVersion>1.2.0.0</FileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>full</DebugType>

View File

@@ -14,7 +14,7 @@
<PublishAot>false</PublishAot>
<JsonSerializerIsReflectionEnabledByDefault>true</JsonSerializerIsReflectionEnabledByDefault>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
<Version>1.1.3</Version>
<Version>1.2.0</Version>
<Authors>snltty</Authors>
<Company>snltty</Company>
<Description>snltty</Description>
@@ -22,8 +22,8 @@
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<PackageReleaseNotes>snltty service</PackageReleaseNotes>
<AssemblyVersion>1.1.3.2</AssemblyVersion>
<FileVersion>1.1.3.2</FileVersion>
<AssemblyVersion>1.2.0.0</AssemblyVersion>
<FileVersion>1.2.0.0</FileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -9,7 +9,7 @@
<JsonSerializerIsReflectionEnabledByDefault>true</JsonSerializerIsReflectionEnabledByDefault>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
<Title>linker tunnel</Title>
<Version>1.1.3</Version>
<Version>1.2.0</Version>
<Authors>snltty</Authors>
<Company>snltty</Company>
<Description>linker tunnel</Description>
@@ -17,8 +17,8 @@
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<PackageReleaseNotes>linker tunnel</PackageReleaseNotes>
<AssemblyVersion>1.1.3.2</AssemblyVersion>
<FileVersion>1.1.3.2</FileVersion>
<AssemblyVersion>1.2.0.0</AssemblyVersion>
<FileVersion>1.2.0.0</FileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -51,14 +51,10 @@ namespace linker.tunnel.wanport
if (tunnelWanPort == null) return null;
try
{
Stopwatch sw = new Stopwatch();
sw.Start();
if (LoggerHelper.Instance.LoggerLevel <= LoggerTypes.DEBUG)
LoggerHelper.Instance.Debug($"get domain ip {info.Host}");
IPEndPoint server = NetworkHelper.GetEndPoint(info.Host, 3478);
sw.Stop();
if (sw.ElapsedMilliseconds > 1000)
{
LoggerHelper.Instance.Warning($"get domain ip time:{sw.ElapsedMilliseconds}ms");
}
if(server == null) return null;
TunnelWanPortEndPoint wanPort = await tunnelWanPort.GetAsync(server).ConfigureAwait(false);
if (wanPort != null)
{

View File

@@ -17,7 +17,7 @@
<EnablePreviewFeatures>true</EnablePreviewFeatures>
<ServerGarbageCollection>false</ServerGarbageCollection>
<Title>linker</Title>
<Version>1.1.3</Version>
<Version>1.2.0</Version>
<Authors>snltty</Authors>
<Company>snltty</Company>
<Description>linker</Description>
@@ -25,8 +25,8 @@
<PackageProjectUrl>https://github.com/snltty/linker</PackageProjectUrl>
<RepositoryUrl>https://github.com/snltty/linker</RepositoryUrl>
<PackageReleaseNotes>linker</PackageReleaseNotes>
<AssemblyVersion>1.1.3.2</AssemblyVersion>
<FileVersion>1.1.3.2</FileVersion>
<AssemblyVersion>1.2.0.0</AssemblyVersion>
<FileVersion>1.2.0.0</FileVersion>
</PropertyGroup>

View File

@@ -13,11 +13,13 @@ namespace linker.plugins.tunnel.messenger
{
private readonly TunnelTransfer tunnel;
private readonly TunnelConfigTransfer tunnelConfigTransfer;
private readonly MessengerSender messengerSender;
public TunnelClientMessenger(TunnelTransfer tunnel, TunnelConfigTransfer tunnelConfigTransfer)
public TunnelClientMessenger(TunnelTransfer tunnel, TunnelConfigTransfer tunnelConfigTransfer, MessengerSender messengerSender)
{
this.tunnel = tunnel;
this.tunnelConfigTransfer = tunnelConfigTransfer;
this.messengerSender = messengerSender;
}
[MessengerId((ushort)TunnelMessengerIds.Begin)]
@@ -33,14 +35,34 @@ namespace linker.plugins.tunnel.messenger
}
[MessengerId((ushort)TunnelMessengerIds.Info)]
public async Task Info(IConnection connection)
public void Info(IConnection connection)
{
TunnelWanPortProtocolInfo info = MemoryPackSerializer.Deserialize<TunnelWanPortProtocolInfo>(connection.ReceiveRequestWrap.Payload.Span);
TunnelTransportWanPortInfo tunnelTransportPortInfo = await tunnel.GetWanPort(info).ConfigureAwait(false);
if (tunnelTransportPortInfo != null)
uint requestid = connection.ReceiveRequestWrap.RequestId;
tunnel.GetWanPort(info).ContinueWith(async (result) =>
{
connection.Write(MemoryPackSerializer.Serialize(tunnelTransportPortInfo));
}
if (result.Result == null)
{
await messengerSender.ReplyOnly(new MessageResponseWrap
{
Connection = connection,
Code = MessageResponeCodes.ERROR,
Payload = Helper.EmptyArray,
RequestId = requestid
});
}
else
{
await messengerSender.ReplyOnly(new MessageResponseWrap
{
Connection = connection,
Code = MessageResponeCodes.OK,
Payload = MemoryPackSerializer.Serialize(result.Result),
RequestId = requestid
});
}
});
}
[MessengerId((ushort)TunnelMessengerIds.Fail)]