From deb0e085144913e8054d33a2fbd0ba232e94e493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=9B=BD=E4=BC=9F?= <366193849@qq.com> Date: Thu, 18 Nov 2021 13:19:12 +0800 Subject: [PATCH] update log --- FastGithub.PacketIntercept/Tcp/TcpInterceptor.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/FastGithub.PacketIntercept/Tcp/TcpInterceptor.cs b/FastGithub.PacketIntercept/Tcp/TcpInterceptor.cs index 729480b..f25b0c6 100644 --- a/FastGithub.PacketIntercept/Tcp/TcpInterceptor.cs +++ b/FastGithub.PacketIntercept/Tcp/TcpInterceptor.cs @@ -2,6 +2,8 @@ using Microsoft.Extensions.Logging; using System; using System.ComponentModel; +using System.Net; +using System.Net.Sockets; using System.Runtime.Versioning; using System.Threading; using System.Threading.Tasks; @@ -53,7 +55,14 @@ namespace FastGithub.PacketIntercept.Tcp throw new Win32Exception(); } - this.logger.LogInformation($"tcp://localhost:{this.oldServerPort} => tcp://localhost:{this.newServerPort}"); + if (Socket.OSSupportsIPv4) + { + this.logger.LogInformation($"{IPAddress.Loopback}:{this.oldServerPort} <=> {IPAddress.Loopback}:{this.newServerPort}"); + } + if (Socket.OSSupportsIPv6) + { + this.logger.LogInformation($"{IPAddress.IPv6Loopback}:{this.oldServerPort} <=> {IPAddress.IPv6Loopback}:{this.newServerPort}"); + } cancellationToken.Register(hwnd => WinDivert.WinDivertClose((IntPtr)hwnd!), handle); var packetLength = 0U;