You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add support for connecting via a hostname instead of IP (#3441)
Add support for connecting via a hostname instead of IP when using
supported versions of unity and unity transport.
## Changelog
- Added: When using UnityTransport >=2.4 and Unity >= 6000.1.0a1,
`SetConnectionData` will accept a fully qualified hostname instead of an
IP as a connect address on the client side.
## Testing and Documentation
- No tests have been added. (Manual tests were performed. The CI
environment doesn't have "localhost" consistently defined to be able to
run automated tests.)
- Includes edits to existing public API documentation.
## Backport
Backport:
#3440
---------
Co-authored-by: NoelStephensUnity <[email protected]>
Copy file name to clipboardExpand all lines: com.unity.netcode.gameobjects/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
10
10
11
11
### Added
12
12
13
+
- When using UnityTransport >=2.4 and Unity >= 6000.1.0a1, SetConnectionData will accept a fully qualified hostname instead of an IP as a connect address on the client side. (#3441)
// If it's not valid, assure it meets FQDN standards
601
+
if(!IsValidFqdn(ConnectionData.Address))
602
+
{
603
+
// If not then log an error and return false
604
+
Debug.LogError($"Listen network address ({ConnectionData.Address}) is not a valid {NetworkFamily.Ipv4} or {NetworkFamily.Ipv6} address!");
605
+
}
606
+
else
607
+
{
608
+
Debug.LogError($"While ({ConnectionData.Address}) is a valid Fully Qualified Domain Name, you must use a valid {NetworkFamily.Ipv4} or {NetworkFamily.Ipv6} address when binding and listening for connections!");
609
+
}
610
+
returnfalse;
611
+
#else
549
612
Debug.LogError($"Network listen address ({ConnectionData.Address}) is {nameof(NetworkFamily.Invalid)}!");
LogAssert.Expect(LogType.Error,$"Listen network address ({m_Server.ConnectionData.Address}) is not a valid {Networking.Transport.NetworkFamily.Ipv4} or {Networking.Transport.NetworkFamily.Ipv6} address!");
72
+
LogAssert.Expect(LogType.Error,$"Target server network address ({m_Clients[0].ConnectionData.Address}) is not a valid Fully Qualified Domain Name!");
0 commit comments