update log

This commit is contained in:
陈国伟 2021-11-18 13:19:12 +08:00
parent 16d03784e7
commit deb0e08514

View File

@ -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;