in sdk/src/Core/Internal/Utils/IPEndPointExtension.cs [108:138]
public static bool TryParse(string input, out HostEndPoint hostEndpoint)
{
var entries = input.Split(':');
if (entries.Length != 2)
{
_logger.InfoFormat("Failed to parse HostEndPoint because input has not exactly two parts splitting by ':'. ({0})", input);
hostEndpoint = null;
return false;
}
if (!int.TryParse(entries[1], out var port))
{
_logger.InfoFormat("Failed to parse HostEndPoint because port is invalid. ({0})", input);
hostEndpoint = null;
return false;
}
if (port < 0 || 65535 < port)
{
_logger.InfoFormat("Failed to parse HostEndPoint because port is out of range. ({0})", input);
hostEndpoint = null;
return false;
}
/*
* Almost anything can be a hostname which makes further validation here hard.
* Accept any string in entries[0] and let it fail in the DNS lookup instead.
*/
hostEndpoint = new HostEndPoint(entries[0], port);
_logger.InfoFormat("Using custom daemon address: {0}:{1}", hostEndpoint.Host, hostEndpoint.Port);
return true;
}