PlayFab / MpsAgent

Azure PlayFab Multiplayer Servers LocalMultiplayerAgent project and helper libraries
https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/servers/
MIT License
51 stars 27 forks source link

added PortMappings to VmAgentInfo #173

Closed brianwp3000 closed 1 year ago

brianwp3000 commented 1 year ago

Added PortMappings to VmAgentInfo so that VmAgent can send vmStartupScript ports to ControlPlane in its heartbeats.

PortMapping is the same class that SessionHostInfo uses to start its ports--it has an external port, an internal port, the user-specified name, and the protocol (tcp/udp).

I named the field "PortMappings", which is also the same name that SessionHostInfo uses. It should be fine since they are nested at different levels. A VmAgent heartbeat will look like this (with all the other fields removed):

{
    "SessionHostHeartbeatMap": {
        "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa": {
            "PortMappings": [
                {
                    "PublicPort": 30001,
                    "NodePort": 30000,
                    "GamePort": {
                        "Name": "game",
                        "Protocol": "TCP"
                    }
                }
            ]
        }
    },
    "PortMappings": [
        {
            "PublicPort": 20001,
            "NodePort": 20001,
            "GamePort": {
                "Name": "pix",
                "Protocol": "TCP"
            }
        }
    ]
}