-
Notifications
You must be signed in to change notification settings - Fork 446
feat: Add support for connecting via a hostname instead of IP #3441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop-2.0.0
Are you sure you want to change the base?
Conversation
…pported versions of unity and unity transport.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no longer any way to know if an endpoint is invalid with this update?
Just wondering why we are deleting tests as opposed to updating them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that FQDNs are supported, there are very few addresses that would be invalid. We could check for things like whitespace or non-printable characters, but that's checking for things the user's unlikely to provide us. The only way to really know if an endpoint is valid is to try to connect to it, and I'd argue that having the same error (failure to connect) for a typo that misspells .com as .con as we do for a typo that adds a space is more consistent behavior.
But there's no way to make StartClient fail because that check is async, and that's what those tests were testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So my question is more relating to removing something like this:
[Test]
public void UnityTransport_StartClientFailsWithBadAddress()
{
UnityTransport transport = new GameObject().AddComponent<UnityTransport>();
transport.Initialize();
transport.SetConnectionData("foobar", 4242);
Assert.False(transport.StartClient());
LogAssert.Expect(LogType.Error, "Invalid network endpoint: foobar:4242.");
LogAssert.Expect(LogType.Error, "Target server network address (foobar) is Invalid!");
transport.Shutdown();
}
As opposed to just wrapping the part I think you are thinking is no longer valid?
[Test]
public void UnityTransport_StartClientFailsWithBadAddress()
{
UnityTransport transport = new GameObject().AddComponent<UnityTransport>();
transport.Initialize();
transport.SetConnectionData("foobar", 4242);
Assert.False(transport.StartClient());
#if !HOSTNAME_RESOLUTION_AVAILABLE && !UTP_TRANSPORT_2_4_ABOVE
LogAssert.Expect(LogType.Error, "Invalid network endpoint: foobar:4242.");
LogAssert.Expect(LogType.Error, "Target server network address (foobar) is Invalid!");
#endif
transport.Shutdown();
}
Where we would still expect the same behavior of the client failing to start if it passed in just "foobar" as the address... which is not FQDN nor an IP... ?
The same would go for DetectInvalidEndpoint
.
I am confused about the async part as both UnityTransport.StartClient
and UnityTransport.StartServer
are non-async methods that are defined within NetworkTransport
?
Don't we want to make sure that if you give UnityTransport an invalid address (IP or FQDN) that the transport fails to start?
Add support for connecting via a hostname instead of IP when using supported versions of unity and unity transport.
Changelog
SetConnectionData
will accept a fully qualified hostname instead of an IP as a connect address on the client side.Testing and Documentation
Backport
Backport: #3440