2
0
陈国伟 3 жил өмнө
parent
commit
deb0e08514

+ 10 - 1
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;