private string CreateConsumerNameByIP() { if (string.IsNullOrEmpty(IPValue)) { IPValue = IPUtils.IPToInt(IPUtils.GetLocalIP()).ToString(); AssertUtils.IsNotEmpty(IPValue, "获取本机IP地址错误"); } return($"{RedisMessageBusOptions.DefaultConsumerName}_{IPValue}"); }
public bool CheckNewPublicIPAdress() { string auxPublicIP = IPUtils.GetPublicIP(); if ((auxPublicIP != PublicIP) || (String.IsNullOrEmpty(PublicIP) && String.IsNullOrEmpty(LocalIP))) { PublicIP = auxPublicIP; LocalIP = IPUtils.GetLocalIP(); email.Subject = "[WhatsMyIP] Se cambió la IP pública a " + PublicIP; email.Message = "<b>IP pública:</b> " + PublicIP + "\n <br />" + "<b>IP local:</b> " + LocalIP; email.Message += "\n <br /> \n <br /> <b><u>NETSTAT</u></b> \n <br />" + IPUtils.GetNetStat(); email.Message += "\n <br /> \n <br /> <b><u>GEOLOCALIZACION</u></b> \n <br />" + IPUtils.GetGeoLocationWithIP(this.PublicIP); MailUtils.SendEmail(email); return(true); } return(false); }
private string CreateConsumerNameByIP() { return($"{RedisMessageBusOptions.DefaultConsumerName}_{IPUtils.IPToInt(IPUtils.GetLocalIP())}"); }
public void GetLocalIPTest() { Regex ip = new Regex(@"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b"); Assert.IsFalse(String.IsNullOrEmpty(ip.Matches(IPUtils.GetLocalIP())[0].ToString())); }