feat: implement authenticated NAT mediator (#11)
quality-gate / quality (push) Successful in 59s
quality-gate / quality (push) Successful in 59s
Closes #11
This commit is contained in:
@@ -42,6 +42,21 @@ if (!registered.IsSuccess || registered.Value is null)
|
||||
Load `publisherCredential` from the game's deployment secret boundary; never
|
||||
embed it in a client build or source control. A successful registration returns a
|
||||
`PublishedSession` containing the lease and host-presence capabilities.
|
||||
Send a periodic presence request from the host's gameplay `NetManager` using the
|
||||
server-controlled refresh interval and the fixed-size native token:
|
||||
|
||||
```csharp
|
||||
string presenceToken = NatPunchRequestTokenCodec.Encode(
|
||||
NatPunchPeerRole.HostPresence,
|
||||
session.HostPresenceHandle,
|
||||
session.HostPresenceCapability);
|
||||
gameplayNetManager.NatPunchModule.SendNatIntroduceRequest(mediator, presenceToken);
|
||||
```
|
||||
|
||||
The same codec creates `Host` tokens for host-polled invitations and `Client`
|
||||
tokens for a created join attempt. Always send them from the same LiteNetLib
|
||||
socket that will carry the direct game connection; the mediator ignores any
|
||||
caller-supplied public endpoint.
|
||||
|
||||
Lease renewal is explicit and caller-controlled:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user