* feat: adding option to get Ip behind reverse proxy
When running behind a reverse proxy the IP endpoints will be that of the reverse proxy, not the client.
Reverse proxies like Nginx set the ip if the host in a http header, the server can read this header during the handshake and store it so it knows the IP address of the client
* feat: adding method to get request
allows users to get other headers if they need to
* caching remote address
* fix and simplify
* inlining extra var
* string interpolation
* changing request log message to info
* adding GET back in inside ReadToEndForHandshake
* updating log message
* max split 2
* returning ipv4 address
* checking if address is ipv4
* adding using
* fixing maping
5 (the previous default) covers really bad pings in return for noticeable delay. However, not every game should have this as their default. 1 being almost instant movement for minimal smoothing (could be best for VR and other uses), from testing 3 is a nice balanced result.
Tested on tanks example, parent and child turret.
Scenarios were regular localhost, then latency sim defaults (200ping, 2% loss etc) and bad connection (500 ping, 5% loss etc), along with personal experience of the settings on NT thee 3 presets should cover most peoples scenarios.
* feature: allow child NetworkBehaviour components in children
* Tanks demo: move Turret NetworkTransform to child
* NT TODO
* RequireInParents NI
* NetworkAnimatore allow in children
* call base onvalidate
* Add OnValidate to Script Template
* fix for pre-2020.3 Unity
* MirrorTest: CreateNetworked with NetworkBehaviour in children
* Tests: child networkbehaviours
---------
Co-authored-by: MrGadget1024 <9826063+MrGadget1024@users.noreply.github.com>
Changed sendIntervalCounter logic to fix the issue where if sendIntervalMultiplier = 1, NT will send every frame instead of every send interval.
This is due to sendIntervalCounter being initialised to 1 instead of 0, after NT has triggered it's send.
* feat(SimpleWebTransport): adding option to set server and client port different
When running websocket server behind reverse proxy client should connect via port 80 or 443. the reverse proxy should then forward requests to the ServerPort running on localhost.
* Update Assets/Mirror/Transports/SimpleWeb/SimpleWebTransport.cs
---------
Co-authored-by: mischa <16416509+vis2k@users.noreply.github.com>
Logically, clients can never fill in a NetworkConnectionToClient parameter.
fixes compilation failing for TargetRpc(NetworkConnectionToClient) with IL2CPP builds.
* Add tests
* Include parent class when counting syncvars
* SyncObject is unneeded
I was also testing SyncObjects and it turned out they were unaffected of this issue. I removed SyncObject from my tests but forgot to do so here.
* Remove host SyncVar hook guard test
* Update Assets/Mirror/Editor/Weaver/Processors/SyncVarAttributeProcessor.cs
* Update SyncVarAttributeProcessor.cs
* Update Assets/Mirror/Tests/Editor/SyncVarAttributeTest.cs
---------
Co-authored-by: mischa <16416509+vis2k@users.noreply.github.com>
* fix(NetworkManager): Try to avoid missing transport errors
- If none assigned, tries to use first Transport available and warns user
- If none available, throws clear error to user what to do.
* improved error msg
* Add Tests
* Fix tests relying on undefined behaviors
- GetSyncVarGameObjectOnClient()
The test relies on the behavior that GameObject SyncVar lookup will behave as client if both isServer and isClient is false.
The test is modified in a way that removes unnecessary object creation and uses a single object that is made sure it's context is client-side.
- TestSyncingAbstractNetworkBehaviour()
This test has been comparing null against null. The test is modified so it simulates each context better.
* Make cached SyncVar getters fallback on no network context
* Remove unnecessary assertions
Gone under my radar doing mindless copy & pasting
* Update Assets/Mirror/Core/NetworkBehaviour.cs
* Update Assets/Mirror/Core/NetworkBehaviour.cs
* Update Assets/Mirror/Core/NetworkBehaviour.cs
---------
Co-authored-by: mischa <16416509+vis2k@users.noreply.github.com>
* fix: kcp2k V1.35 [2023-04-05]
- fix: KcpClients now need to validate with a secure cookie in order to protect against
UDP spoofing. fixes:
https://github.com/MirrorNetworking/Mirror/issues/3286
[disclosed by IncludeSec]
- KcpClient/Server: change callbacks to protected so inheriting classes can use them too
- KcpClient/Server: change config visibility to protected
* credits
* credits
* link blog post
* 2019 compatibility
* Update Assets/Mirror/Transports/KCP/kcp2k/highlevel/KcpPeer.cs
Co-authored-by: MrGadget <9826063+MrGadget1024@users.noreply.github.com>
* Update Assets/Mirror/Transports/KCP/kcp2k/highlevel/KcpPeer.cs
Co-authored-by: MrGadget <9826063+MrGadget1024@users.noreply.github.com>
---------
Co-authored-by: MrGadget <9826063+MrGadget1024@users.noreply.github.com>
* perf(SceneInterestManagement): Only RebuildSceneObservers in Update
Don't RebuildSceneObservers in OnDestroy...that will happen in Update.
Multiple objects could be destroyed in same frame and we don't
want to rebuild for each one...let Update do it once.
* perf(MatchInterestManagement): Only RebuildMatchObservers in Update
Don't RebuildMatchObservers in OnDestroy...that will happen in Update.
Multiple objects could be destroyed in same frame and we don't
want to rebuild for each one...let Update do it once.
* perf(TeamInterestManagement): Only RebuildMatchObservers in Update
Don't TeamInterestManagement in OnDestroy...that will happen in Update.
Multiple objects could be destroyed in same frame and we don't
want to rebuild for each one...let Update do it once.
* SceneInterestManagement: Add curentScene to dirtyScenes in OnDestroy
* MatchInterestManagement - add match to dirtyMatches
* TeamInterestManagement - add team to dirtyTeams
- Moved transport and OnServerFound to base class
- Consolidated Start in base class
- Virtual OnValidate in base class
- Better public field order
- Added missing tooltip