public string ValidateTorHost() { if (string.IsNullOrWhiteSpace(TorHost)) { return(string.Empty); } var torHost = TorHost.Trim(); if (Uri.TryCreate(torHost, UriKind.Absolute, out var uri)) { return(string.Empty); } if (IPAddress.TryParse(torHost, out var ip)) { return(string.Empty); } return("Invalid host."); }
public string ValidateTorHost() { if (string.IsNullOrWhiteSpace(TorHost)) { return(string.Empty); } var torHost = TorHost.Trim(); if (Uri.TryCreate(torHost, UriKind.Absolute, out var uri)) { return(string.Empty); } if (IPAddress.TryParse(torHost, out var ip)) { if (ip.AddressFamily == AddressFamily.InterNetworkV6 && !Socket.OSSupportsIPv6) { return("OS does not support IPv6 addresses."); } return(string.Empty); } return("Invalid host."); }