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 [MTT-10139] (#3440)
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 of
#3441
---------
Co-authored-by: NoelStephensUnity <[email protected]>
Copy file name to clipboardExpand all lines: com.unity.netcode.gameobjects/CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,8 @@ 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. (#3440)
14
+
13
15
### Fixed
14
16
15
17
- Fixed issue where when a client changes ownership via RPC the `NetworkBehaviour.OnOwnershipChanged` can result in identical previous and current owner identifiers. (#3434)
// If it's not valid, assure it meets FQDN standards
628
+
if(!IsValidFqdn(ConnectionData.Address))
629
+
{
630
+
// If not then log an error and return false
631
+
Debug.LogError($"Listen network address ({ConnectionData.Address}) is not a valid {NetworkFamily.Ipv4} or {NetworkFamily.Ipv6} address!");
632
+
}
633
+
else
634
+
{
635
+
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!");
636
+
}
637
+
returnfalse;
638
+
#else
570
639
Debug.LogError($"Network listen address ({ConnectionData.Address}) is {nameof(NetworkFamily.Invalid)}!");
LogAssert.Expect(LogType.Error,$"Listen network address (127.0.0.) is not a valid {Networking.Transport.NetworkFamily.Ipv4} or {Networking.Transport.NetworkFamily.Ipv6} address!");
126
+
#else
123
127
LogAssert.Expect(LogType.Error,"Network listen address (127.0.0.) is 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!");
63
+
LogAssert.Expect(LogType.Error,$"Target server network address ({m_Clients[0].ConnectionData.Address}) is not a valid Fully Qualified Domain Name!");
0 commit comments