Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
// Copyright 2018 The Nakama Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package server
import (
"context"
"database/sql"
"errors"
"os"
"path/filepath"
"strings"
"sync"
"time"
"github.com/gofrs/uuid"
"github.com/heroiclabs/nakama-common/api"
"github.com/heroiclabs/nakama-common/rtapi"
"github.com/heroiclabs/nakama-common/runtime"
"github.com/heroiclabs/nakama/v3/social"
"go.uber.org/atomic"
"go.uber.org/zap"
"google.golang.org/grpc/codes"
"google.golang.org/protobuf/encoding/protojson"
)
var (
ErrRuntimeRPCNotFound = errors.New("RPC function not found")
)
const API_PREFIX = "/nakama.api.Nakama/"
const RTAPI_PREFIX = "*rtapi.Envelope_"
var API_PREFIX_LOWERCASE = strings.ToLower(API_PREFIX)
var RTAPI_PREFIX_LOWERCASE = strings.ToLower(RTAPI_PREFIX)
type (
RuntimeRpcFunction func(ctx context.Context, headers, queryParams map[string][]string, userID, username string, vars map[string]string, expiry int64, sessionID, clientIP, clientPort, lang, payload string) (string, error, codes.Code)
RuntimeBeforeRtFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, sessionID, clientIP, clientPort, lang string, envelope *rtapi.Envelope) (*rtapi.Envelope, error)
RuntimeAfterRtFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, sessionID, clientIP, clientPort, lang string, envelope *rtapi.Envelope) error
RuntimeBeforeGetAccountFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string) (error, codes.Code)
RuntimeAfterGetAccountFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.Account) error
RuntimeBeforeUpdateAccountFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.UpdateAccountRequest) (*api.UpdateAccountRequest, error, codes.Code)
RuntimeAfterUpdateAccountFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.UpdateAccountRequest) error
RuntimeBeforeSessionRefreshFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.SessionRefreshRequest) (*api.SessionRefreshRequest, error, codes.Code)
RuntimeAfterSessionRefreshFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.Session, in *api.SessionRefreshRequest) error
RuntimeBeforeSessionLogoutFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.SessionLogoutRequest) (*api.SessionLogoutRequest, error, codes.Code)
RuntimeAfterSessionLogoutFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.SessionLogoutRequest) error
RuntimeBeforeAuthenticateAppleFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AuthenticateAppleRequest) (*api.AuthenticateAppleRequest, error, codes.Code)
RuntimeAfterAuthenticateAppleFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.Session, in *api.AuthenticateAppleRequest) error
RuntimeBeforeAuthenticateCustomFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AuthenticateCustomRequest) (*api.AuthenticateCustomRequest, error, codes.Code)
RuntimeAfterAuthenticateCustomFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.Session, in *api.AuthenticateCustomRequest) error
RuntimeBeforeAuthenticateDeviceFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AuthenticateDeviceRequest) (*api.AuthenticateDeviceRequest, error, codes.Code)
RuntimeAfterAuthenticateDeviceFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.Session, in *api.AuthenticateDeviceRequest) error
RuntimeBeforeAuthenticateEmailFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AuthenticateEmailRequest) (*api.AuthenticateEmailRequest, error, codes.Code)
RuntimeAfterAuthenticateEmailFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.Session, in *api.AuthenticateEmailRequest) error
RuntimeBeforeAuthenticateFacebookFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AuthenticateFacebookRequest) (*api.AuthenticateFacebookRequest, error, codes.Code)
RuntimeAfterAuthenticateFacebookFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.Session, in *api.AuthenticateFacebookRequest) error
RuntimeBeforeAuthenticateFacebookInstantGameFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AuthenticateFacebookInstantGameRequest) (*api.AuthenticateFacebookInstantGameRequest, error, codes.Code)
RuntimeAfterAuthenticateFacebookInstantGameFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.Session, in *api.AuthenticateFacebookInstantGameRequest) error
RuntimeBeforeAuthenticateGameCenterFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AuthenticateGameCenterRequest) (*api.AuthenticateGameCenterRequest, error, codes.Code)
RuntimeAfterAuthenticateGameCenterFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.Session, in *api.AuthenticateGameCenterRequest) error
RuntimeBeforeAuthenticateGoogleFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AuthenticateGoogleRequest) (*api.AuthenticateGoogleRequest, error, codes.Code)
RuntimeAfterAuthenticateGoogleFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.Session, in *api.AuthenticateGoogleRequest) error
RuntimeBeforeAuthenticateSteamFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AuthenticateSteamRequest) (*api.AuthenticateSteamRequest, error, codes.Code)
RuntimeAfterAuthenticateSteamFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.Session, in *api.AuthenticateSteamRequest) error
RuntimeBeforeListChannelMessagesFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ListChannelMessagesRequest) (*api.ListChannelMessagesRequest, error, codes.Code)
RuntimeAfterListChannelMessagesFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.ChannelMessageList, in *api.ListChannelMessagesRequest) error
RuntimeBeforeListFriendsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ListFriendsRequest) (*api.ListFriendsRequest, error, codes.Code)
RuntimeAfterListFriendsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.FriendList) error
RuntimeBeforeAddFriendsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AddFriendsRequest) (*api.AddFriendsRequest, error, codes.Code)
RuntimeAfterAddFriendsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AddFriendsRequest) error
RuntimeBeforeDeleteFriendsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteFriendsRequest) (*api.DeleteFriendsRequest, error, codes.Code)
RuntimeAfterDeleteFriendsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteFriendsRequest) error
RuntimeBeforeBlockFriendsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.BlockFriendsRequest) (*api.BlockFriendsRequest, error, codes.Code)
RuntimeAfterBlockFriendsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.BlockFriendsRequest) error
RuntimeBeforeImportFacebookFriendsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ImportFacebookFriendsRequest) (*api.ImportFacebookFriendsRequest, error, codes.Code)
RuntimeAfterImportFacebookFriendsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ImportFacebookFriendsRequest) error
RuntimeBeforeImportSteamFriendsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ImportSteamFriendsRequest) (*api.ImportSteamFriendsRequest, error, codes.Code)
RuntimeAfterImportSteamFriendsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ImportSteamFriendsRequest) error
RuntimeBeforeCreateGroupFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.CreateGroupRequest) (*api.CreateGroupRequest, error, codes.Code)
RuntimeAfterCreateGroupFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.Group, in *api.CreateGroupRequest) error
RuntimeBeforeUpdateGroupFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.UpdateGroupRequest) (*api.UpdateGroupRequest, error, codes.Code)
RuntimeAfterUpdateGroupFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.UpdateGroupRequest) error
RuntimeBeforeDeleteGroupFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteGroupRequest) (*api.DeleteGroupRequest, error, codes.Code)
RuntimeAfterDeleteGroupFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteGroupRequest) error
RuntimeBeforeJoinGroupFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.JoinGroupRequest) (*api.JoinGroupRequest, error, codes.Code)
RuntimeAfterJoinGroupFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.JoinGroupRequest) error
RuntimeBeforeLeaveGroupFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.LeaveGroupRequest) (*api.LeaveGroupRequest, error, codes.Code)
RuntimeAfterLeaveGroupFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.LeaveGroupRequest) error
RuntimeBeforeAddGroupUsersFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AddGroupUsersRequest) (*api.AddGroupUsersRequest, error, codes.Code)
RuntimeAfterAddGroupUsersFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AddGroupUsersRequest) error
RuntimeBeforeBanGroupUsersFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.BanGroupUsersRequest) (*api.BanGroupUsersRequest, error, codes.Code)
RuntimeAfterBanGroupUsersFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.BanGroupUsersRequest) error
RuntimeBeforeKickGroupUsersFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.KickGroupUsersRequest) (*api.KickGroupUsersRequest, error, codes.Code)
RuntimeAfterKickGroupUsersFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.KickGroupUsersRequest) error
RuntimeBeforePromoteGroupUsersFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.PromoteGroupUsersRequest) (*api.PromoteGroupUsersRequest, error, codes.Code)
RuntimeAfterPromoteGroupUsersFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.PromoteGroupUsersRequest) error
RuntimeBeforeDemoteGroupUsersFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DemoteGroupUsersRequest) (*api.DemoteGroupUsersRequest, error, codes.Code)
RuntimeAfterDemoteGroupUsersFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DemoteGroupUsersRequest) error
RuntimeBeforeListGroupUsersFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ListGroupUsersRequest) (*api.ListGroupUsersRequest, error, codes.Code)
RuntimeAfterListGroupUsersFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.GroupUserList, in *api.ListGroupUsersRequest) error
RuntimeBeforeListUserGroupsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ListUserGroupsRequest) (*api.ListUserGroupsRequest, error, codes.Code)
RuntimeAfterListUserGroupsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.UserGroupList, in *api.ListUserGroupsRequest) error
RuntimeBeforeListGroupsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ListGroupsRequest) (*api.ListGroupsRequest, error, codes.Code)
RuntimeAfterListGroupsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.GroupList, in *api.ListGroupsRequest) error
RuntimeBeforeDeleteLeaderboardRecordFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteLeaderboardRecordRequest) (*api.DeleteLeaderboardRecordRequest, error, codes.Code)
RuntimeAfterDeleteLeaderboardRecordFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteLeaderboardRecordRequest) error
RuntimeBeforeListLeaderboardRecordsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ListLeaderboardRecordsRequest) (*api.ListLeaderboardRecordsRequest, error, codes.Code)
RuntimeAfterListLeaderboardRecordsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.LeaderboardRecordList, in *api.ListLeaderboardRecordsRequest) error
RuntimeBeforeWriteLeaderboardRecordFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.WriteLeaderboardRecordRequest) (*api.WriteLeaderboardRecordRequest, error, codes.Code)
RuntimeAfterWriteLeaderboardRecordFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.LeaderboardRecord, in *api.WriteLeaderboardRecordRequest) error
RuntimeBeforeListLeaderboardRecordsAroundOwnerFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ListLeaderboardRecordsAroundOwnerRequest) (*api.ListLeaderboardRecordsAroundOwnerRequest, error, codes.Code)
RuntimeAfterListLeaderboardRecordsAroundOwnerFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.LeaderboardRecordList, in *api.ListLeaderboardRecordsAroundOwnerRequest) error
RuntimeBeforeLinkAppleFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountApple) (*api.AccountApple, error, codes.Code)
RuntimeAfterLinkAppleFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountApple) error
RuntimeBeforeLinkCustomFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountCustom) (*api.AccountCustom, error, codes.Code)
RuntimeAfterLinkCustomFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountCustom) error
RuntimeBeforeLinkDeviceFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountDevice) (*api.AccountDevice, error, codes.Code)
RuntimeAfterLinkDeviceFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountDevice) error
RuntimeBeforeLinkEmailFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountEmail) (*api.AccountEmail, error, codes.Code)
RuntimeAfterLinkEmailFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountEmail) error
RuntimeBeforeLinkFacebookFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.LinkFacebookRequest) (*api.LinkFacebookRequest, error, codes.Code)
RuntimeAfterLinkFacebookFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.LinkFacebookRequest) error
RuntimeBeforeLinkFacebookInstantGameFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountFacebookInstantGame) (*api.AccountFacebookInstantGame, error, codes.Code)
RuntimeAfterLinkFacebookInstantGameFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountFacebookInstantGame) error
RuntimeBeforeLinkGameCenterFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountGameCenter) (*api.AccountGameCenter, error, codes.Code)
RuntimeAfterLinkGameCenterFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountGameCenter) error
RuntimeBeforeLinkGoogleFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountGoogle) (*api.AccountGoogle, error, codes.Code)
RuntimeAfterLinkGoogleFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountGoogle) error
RuntimeBeforeLinkSteamFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.LinkSteamRequest) (*api.LinkSteamRequest, error, codes.Code)
RuntimeAfterLinkSteamFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.LinkSteamRequest) error
RuntimeBeforeListMatchesFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ListMatchesRequest) (*api.ListMatchesRequest, error, codes.Code)
RuntimeAfterListMatchesFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.MatchList, in *api.ListMatchesRequest) error
RuntimeBeforeListNotificationsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ListNotificationsRequest) (*api.ListNotificationsRequest, error, codes.Code)
RuntimeAfterListNotificationsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.NotificationList, in *api.ListNotificationsRequest) error
RuntimeBeforeDeleteNotificationFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteNotificationsRequest) (*api.DeleteNotificationsRequest, error, codes.Code)
RuntimeAfterDeleteNotificationFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteNotificationsRequest) error
RuntimeBeforeListStorageObjectsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ListStorageObjectsRequest) (*api.ListStorageObjectsRequest, error, codes.Code)
RuntimeAfterListStorageObjectsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.StorageObjectList, in *api.ListStorageObjectsRequest) error
RuntimeBeforeReadStorageObjectsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ReadStorageObjectsRequest) (*api.ReadStorageObjectsRequest, error, codes.Code)
RuntimeAfterReadStorageObjectsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.StorageObjects, in *api.ReadStorageObjectsRequest) error
RuntimeBeforeWriteStorageObjectsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.WriteStorageObjectsRequest) (*api.WriteStorageObjectsRequest, error, codes.Code)
RuntimeAfterWriteStorageObjectsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.StorageObjectAcks, in *api.WriteStorageObjectsRequest) error
RuntimeBeforeDeleteStorageObjectsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteStorageObjectsRequest) (*api.DeleteStorageObjectsRequest, error, codes.Code)
RuntimeAfterDeleteStorageObjectsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteStorageObjectsRequest) error
RuntimeBeforeJoinTournamentFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.JoinTournamentRequest) (*api.JoinTournamentRequest, error, codes.Code)
RuntimeAfterJoinTournamentFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.JoinTournamentRequest) error
RuntimeBeforeListTournamentRecordsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ListTournamentRecordsRequest) (*api.ListTournamentRecordsRequest, error, codes.Code)
RuntimeAfterListTournamentRecordsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.TournamentRecordList, in *api.ListTournamentRecordsRequest) error
RuntimeBeforeListTournamentsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ListTournamentsRequest) (*api.ListTournamentsRequest, error, codes.Code)
RuntimeAfterListTournamentsFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.TournamentList, in *api.ListTournamentsRequest) error
RuntimeBeforeWriteTournamentRecordFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.WriteTournamentRecordRequest) (*api.WriteTournamentRecordRequest, error, codes.Code)
RuntimeAfterWriteTournamentRecordFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.LeaderboardRecord, in *api.WriteTournamentRecordRequest) error
RuntimeBeforeListTournamentRecordsAroundOwnerFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ListTournamentRecordsAroundOwnerRequest) (*api.ListTournamentRecordsAroundOwnerRequest, error, codes.Code)
RuntimeAfterListTournamentRecordsAroundOwnerFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.TournamentRecordList, in *api.ListTournamentRecordsAroundOwnerRequest) error
RuntimeBeforeUnlinkAppleFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountApple) (*api.AccountApple, error, codes.Code)
RuntimeAfterUnlinkAppleFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountApple) error
RuntimeBeforeUnlinkCustomFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountCustom) (*api.AccountCustom, error, codes.Code)
RuntimeAfterUnlinkCustomFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountCustom) error
RuntimeBeforeUnlinkDeviceFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountDevice) (*api.AccountDevice, error, codes.Code)
RuntimeAfterUnlinkDeviceFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountDevice) error
RuntimeBeforeUnlinkEmailFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountEmail) (*api.AccountEmail, error, codes.Code)
RuntimeAfterUnlinkEmailFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountEmail) error
RuntimeBeforeUnlinkFacebookFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountFacebook) (*api.AccountFacebook, error, codes.Code)
RuntimeAfterUnlinkFacebookFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountFacebook) error
RuntimeBeforeUnlinkFacebookInstantGameFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountFacebookInstantGame) (*api.AccountFacebookInstantGame, error, codes.Code)
RuntimeAfterUnlinkFacebookInstantGameFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountFacebookInstantGame) error
RuntimeBeforeUnlinkGameCenterFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountGameCenter) (*api.AccountGameCenter, error, codes.Code)
RuntimeAfterUnlinkGameCenterFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountGameCenter) error
RuntimeBeforeUnlinkGoogleFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountGoogle) (*api.AccountGoogle, error, codes.Code)
RuntimeAfterUnlinkGoogleFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountGoogle) error
RuntimeBeforeUnlinkSteamFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountSteam) (*api.AccountSteam, error, codes.Code)
RuntimeAfterUnlinkSteamFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.AccountSteam) error
RuntimeBeforeGetUsersFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.GetUsersRequest) (*api.GetUsersRequest, error, codes.Code)
RuntimeAfterGetUsersFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.Users, in *api.GetUsersRequest) error
RuntimeBeforeEventFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.Event) (*api.Event, error, codes.Code)
RuntimeAfterEventFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.Event) error
RuntimeBeforeValidatePurchaseAppleFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ValidatePurchaseAppleRequest) (*api.ValidatePurchaseAppleRequest, error, codes.Code)
RuntimeAfterValidatePurchaseAppleFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.ValidatePurchaseResponse, in *api.ValidatePurchaseAppleRequest) error
RuntimeBeforeValidatePurchaseGoogleFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ValidatePurchaseGoogleRequest) (*api.ValidatePurchaseGoogleRequest, error, codes.Code)
RuntimeAfterValidatePurchaseGoogleFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.ValidatePurchaseResponse, in *api.ValidatePurchaseGoogleRequest) error
RuntimeBeforeValidatePurchaseHuaweiFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ValidatePurchaseHuaweiRequest) (*api.ValidatePurchaseHuaweiRequest, error, codes.Code)
RuntimeAfterValidatePurchaseHuaweiFunction func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.ValidatePurchaseResponse, in *api.ValidatePurchaseHuaweiRequest) error
RuntimeMatchmakerMatchedFunction func(ctx context.Context, entries []*MatchmakerEntry) (string, bool, error)
RuntimeMatchCreateFunction func(ctx context.Context, logger *zap.Logger, id uuid.UUID, node string, stopped *atomic.Bool, name string) (RuntimeMatchCore, error)
RuntimeMatchDeferMessageFunction func(msg *DeferredMessage) error
RuntimeTournamentEndFunction func(ctx context.Context, tournament *api.Tournament, end, reset int64) error
RuntimeTournamentResetFunction func(ctx context.Context, tournament *api.Tournament, end, reset int64) error
RuntimeLeaderboardResetFunction func(ctx context.Context, leaderboard *api.Leaderboard, reset int64) error
RuntimeEventFunction func(ctx context.Context, logger runtime.Logger, evt *api.Event)
RuntimeEventCustomFunction func(ctx context.Context, evt *api.Event)
RuntimeEventSessionStartFunction func(userID, username string, vars map[string]string, expiry int64, sessionID, clientIP, clientPort, lang string, evtTimeSec int64)
RuntimeEventSessionEndFunction func(userID, username string, vars map[string]string, expiry int64, sessionID, clientIP, clientPort, lang string, evtTimeSec int64, reason string)
)
type RuntimeExecutionMode int
const (
RuntimeExecutionModeEvent RuntimeExecutionMode = iota
RuntimeExecutionModeRunOnce
RuntimeExecutionModeRPC
RuntimeExecutionModeBefore
RuntimeExecutionModeAfter
RuntimeExecutionModeMatch
RuntimeExecutionModeMatchmaker
RuntimeExecutionModeMatchCreate
RuntimeExecutionModeTournamentEnd
RuntimeExecutionModeTournamentReset
RuntimeExecutionModeLeaderboardReset
)
func (e RuntimeExecutionMode) String() string {
switch e {
case RuntimeExecutionModeEvent:
return "event"
case RuntimeExecutionModeRunOnce:
return "run_once"
case RuntimeExecutionModeRPC:
return "rpc"
case RuntimeExecutionModeBefore:
return "before"
case RuntimeExecutionModeAfter:
return "after"
case RuntimeExecutionModeMatch:
return "match"
case RuntimeExecutionModeMatchmaker:
return "matchmaker"
case RuntimeExecutionModeMatchCreate:
return "match_create"
case RuntimeExecutionModeTournamentEnd:
return "tournament_end"
case RuntimeExecutionModeTournamentReset:
return "tournament_reset"
case RuntimeExecutionModeLeaderboardReset:
return "leaderboard_reset"
}
return ""
}
type RuntimeMatchCore interface {
MatchInit(presenceList *MatchPresenceList, deferMessageFn RuntimeMatchDeferMessageFunction, params map[string]interface{}) (interface{}, int, error)
MatchJoinAttempt(tick int64, state interface{}, userID, sessionID uuid.UUID, username string, sessionExpiry int64, vars map[string]string, clientIP, clientPort, node string, metadata map[string]string) (interface{}, bool, string, error)
MatchJoin(tick int64, state interface{}, joins []*MatchPresence) (interface{}, error)
MatchLeave(tick int64, state interface{}, leaves []*MatchPresence) (interface{}, error)
MatchLoop(tick int64, state interface{}, inputCh <-chan *MatchDataMessage) (interface{}, error)
MatchTerminate(tick int64, state interface{}, graceSeconds int) (interface{}, error)
MatchSignal(tick int64, state interface{}, data string) (interface{}, string, error)
GetState(state interface{}) (string, error)
Label() string
TickRate() int
HandlerName() string
CreateTime() int64
Cancel()
Cleanup()
}
type RuntimeEventFunctions struct {
sessionStartFunction RuntimeEventSessionStartFunction
sessionEndFunction RuntimeEventSessionEndFunction
eventFunction RuntimeEventCustomFunction
}
type moduleInfo struct {
path string
modTime time.Time
}
type RuntimeInfo struct {
GoRpcFunctions []string
LuaRpcFunctions []string
JavaScriptRpcFunctions []string
GoModules []*moduleInfo
LuaModules []*moduleInfo
JavaScriptModules []*moduleInfo
}
type RuntimeBeforeReqFunctions struct {
beforeGetAccountFunction RuntimeBeforeGetAccountFunction
beforeUpdateAccountFunction RuntimeBeforeUpdateAccountFunction
beforeSessionRefreshFunction RuntimeBeforeSessionRefreshFunction
beforeSessionLogoutFunction RuntimeBeforeSessionLogoutFunction
beforeAuthenticateAppleFunction RuntimeBeforeAuthenticateAppleFunction
beforeAuthenticateCustomFunction RuntimeBeforeAuthenticateCustomFunction
beforeAuthenticateDeviceFunction RuntimeBeforeAuthenticateDeviceFunction
beforeAuthenticateEmailFunction RuntimeBeforeAuthenticateEmailFunction
beforeAuthenticateFacebookFunction RuntimeBeforeAuthenticateFacebookFunction
beforeAuthenticateFacebookInstantGameFunction RuntimeBeforeAuthenticateFacebookInstantGameFunction
beforeAuthenticateGameCenterFunction RuntimeBeforeAuthenticateGameCenterFunction
beforeAuthenticateGoogleFunction RuntimeBeforeAuthenticateGoogleFunction
beforeAuthenticateSteamFunction RuntimeBeforeAuthenticateSteamFunction
beforeListChannelMessagesFunction RuntimeBeforeListChannelMessagesFunction
beforeListFriendsFunction RuntimeBeforeListFriendsFunction
beforeAddFriendsFunction RuntimeBeforeAddFriendsFunction
beforeDeleteFriendsFunction RuntimeBeforeDeleteFriendsFunction
beforeBlockFriendsFunction RuntimeBeforeBlockFriendsFunction
beforeImportFacebookFriendsFunction RuntimeBeforeImportFacebookFriendsFunction
beforeImportSteamFriendsFunction RuntimeBeforeImportSteamFriendsFunction
beforeCreateGroupFunction RuntimeBeforeCreateGroupFunction
beforeUpdateGroupFunction RuntimeBeforeUpdateGroupFunction
beforeDeleteGroupFunction RuntimeBeforeDeleteGroupFunction
beforeJoinGroupFunction RuntimeBeforeJoinGroupFunction
beforeLeaveGroupFunction RuntimeBeforeLeaveGroupFunction
beforeAddGroupUsersFunction RuntimeBeforeAddGroupUsersFunction
beforeBanGroupUsersFunction RuntimeBeforeBanGroupUsersFunction
beforeKickGroupUsersFunction RuntimeBeforeKickGroupUsersFunction
beforePromoteGroupUsersFunction RuntimeBeforePromoteGroupUsersFunction
beforeDemoteGroupUsersFunction RuntimeBeforeDemoteGroupUsersFunction
beforeListGroupUsersFunction RuntimeBeforeListGroupUsersFunction
beforeListUserGroupsFunction RuntimeBeforeListUserGroupsFunction
beforeListGroupsFunction RuntimeBeforeListGroupsFunction
beforeDeleteLeaderboardRecordFunction RuntimeBeforeDeleteLeaderboardRecordFunction
beforeListLeaderboardRecordsFunction RuntimeBeforeListLeaderboardRecordsFunction
beforeWriteLeaderboardRecordFunction RuntimeBeforeWriteLeaderboardRecordFunction
beforeListLeaderboardRecordsAroundOwnerFunction RuntimeBeforeListLeaderboardRecordsAroundOwnerFunction
beforeLinkAppleFunction RuntimeBeforeLinkAppleFunction
beforeLinkCustomFunction RuntimeBeforeLinkCustomFunction
beforeLinkDeviceFunction RuntimeBeforeLinkDeviceFunction
beforeLinkEmailFunction RuntimeBeforeLinkEmailFunction
beforeLinkFacebookFunction RuntimeBeforeLinkFacebookFunction
beforeLinkFacebookInstantGameFunction RuntimeBeforeLinkFacebookInstantGameFunction
beforeLinkGameCenterFunction RuntimeBeforeLinkGameCenterFunction
beforeLinkGoogleFunction RuntimeBeforeLinkGoogleFunction
beforeLinkSteamFunction RuntimeBeforeLinkSteamFunction
beforeListMatchesFunction RuntimeBeforeListMatchesFunction
beforeListNotificationsFunction RuntimeBeforeListNotificationsFunction
beforeDeleteNotificationFunction RuntimeBeforeDeleteNotificationFunction
beforeListStorageObjectsFunction RuntimeBeforeListStorageObjectsFunction
beforeReadStorageObjectsFunction RuntimeBeforeReadStorageObjectsFunction
beforeWriteStorageObjectsFunction RuntimeBeforeWriteStorageObjectsFunction
beforeDeleteStorageObjectsFunction RuntimeBeforeDeleteStorageObjectsFunction
beforeJoinTournamentFunction RuntimeBeforeJoinTournamentFunction
beforeListTournamentRecordsFunction RuntimeBeforeListTournamentRecordsFunction
beforeListTournamentsFunction RuntimeBeforeListTournamentsFunction
beforeWriteTournamentRecordFunction RuntimeBeforeWriteTournamentRecordFunction
beforeListTournamentRecordsAroundOwnerFunction RuntimeBeforeListTournamentRecordsAroundOwnerFunction
beforeUnlinkAppleFunction RuntimeBeforeUnlinkAppleFunction
beforeUnlinkCustomFunction RuntimeBeforeUnlinkCustomFunction
beforeUnlinkDeviceFunction RuntimeBeforeUnlinkDeviceFunction
beforeUnlinkEmailFunction RuntimeBeforeUnlinkEmailFunction
beforeUnlinkFacebookFunction RuntimeBeforeUnlinkFacebookFunction
beforeUnlinkFacebookInstantGameFunction RuntimeBeforeUnlinkFacebookInstantGameFunction
beforeUnlinkGameCenterFunction RuntimeBeforeUnlinkGameCenterFunction
beforeUnlinkGoogleFunction RuntimeBeforeUnlinkGoogleFunction
beforeUnlinkSteamFunction RuntimeBeforeUnlinkSteamFunction
beforeGetUsersFunction RuntimeBeforeGetUsersFunction
beforeEventFunction RuntimeBeforeEventFunction
beforeValidatePurchaseAppleFunction RuntimeBeforeValidatePurchaseAppleFunction
beforeValidatePurchaseGoogleFunction RuntimeBeforeValidatePurchaseGoogleFunction
beforeValidatePurchaseHuaweiFunction RuntimeBeforeValidatePurchaseHuaweiFunction
}
type RuntimeAfterReqFunctions struct {
afterGetAccountFunction RuntimeAfterGetAccountFunction
afterUpdateAccountFunction RuntimeAfterUpdateAccountFunction
afterSessionRefreshFunction RuntimeAfterSessionRefreshFunction
afterSessionLogoutFunction RuntimeAfterSessionLogoutFunction
afterAuthenticateAppleFunction RuntimeAfterAuthenticateAppleFunction
afterAuthenticateCustomFunction RuntimeAfterAuthenticateCustomFunction
afterAuthenticateDeviceFunction RuntimeAfterAuthenticateDeviceFunction
afterAuthenticateEmailFunction RuntimeAfterAuthenticateEmailFunction
afterAuthenticateFacebookFunction RuntimeAfterAuthenticateFacebookFunction
afterAuthenticateFacebookInstantGameFunction RuntimeAfterAuthenticateFacebookInstantGameFunction
afterAuthenticateGameCenterFunction RuntimeAfterAuthenticateGameCenterFunction
afterAuthenticateGoogleFunction RuntimeAfterAuthenticateGoogleFunction
afterAuthenticateSteamFunction RuntimeAfterAuthenticateSteamFunction
afterListChannelMessagesFunction RuntimeAfterListChannelMessagesFunction
afterListFriendsFunction RuntimeAfterListFriendsFunction
afterAddFriendsFunction RuntimeAfterAddFriendsFunction
afterDeleteFriendsFunction RuntimeAfterDeleteFriendsFunction
afterBlockFriendsFunction RuntimeAfterBlockFriendsFunction
afterImportFacebookFriendsFunction RuntimeAfterImportFacebookFriendsFunction
afterImportSteamFriendsFunction RuntimeAfterImportSteamFriendsFunction
afterCreateGroupFunction RuntimeAfterCreateGroupFunction
afterUpdateGroupFunction RuntimeAfterUpdateGroupFunction
afterDeleteGroupFunction RuntimeAfterDeleteGroupFunction
afterJoinGroupFunction RuntimeAfterJoinGroupFunction
afterLeaveGroupFunction RuntimeAfterLeaveGroupFunction
afterAddGroupUsersFunction RuntimeAfterAddGroupUsersFunction
afterBanGroupUsersFunction RuntimeAfterBanGroupUsersFunction
afterKickGroupUsersFunction RuntimeAfterKickGroupUsersFunction
afterPromoteGroupUsersFunction RuntimeAfterPromoteGroupUsersFunction
afterDemoteGroupUsersFunction RuntimeAfterDemoteGroupUsersFunction
afterListGroupUsersFunction RuntimeAfterListGroupUsersFunction
afterListUserGroupsFunction RuntimeAfterListUserGroupsFunction
afterListGroupsFunction RuntimeAfterListGroupsFunction
afterDeleteLeaderboardRecordFunction RuntimeAfterDeleteLeaderboardRecordFunction
afterListLeaderboardRecordsFunction RuntimeAfterListLeaderboardRecordsFunction
afterWriteLeaderboardRecordFunction RuntimeAfterWriteLeaderboardRecordFunction
afterListLeaderboardRecordsAroundOwnerFunction RuntimeAfterListLeaderboardRecordsAroundOwnerFunction
afterLinkAppleFunction RuntimeAfterLinkAppleFunction
afterLinkCustomFunction RuntimeAfterLinkCustomFunction
afterLinkDeviceFunction RuntimeAfterLinkDeviceFunction
afterLinkEmailFunction RuntimeAfterLinkEmailFunction
afterLinkFacebookFunction RuntimeAfterLinkFacebookFunction
afterLinkFacebookInstantGameFunction RuntimeAfterLinkFacebookInstantGameFunction
afterLinkGameCenterFunction RuntimeAfterLinkGameCenterFunction
afterLinkGoogleFunction RuntimeAfterLinkGoogleFunction
afterLinkSteamFunction RuntimeAfterLinkSteamFunction
afterListMatchesFunction RuntimeAfterListMatchesFunction
afterListNotificationsFunction RuntimeAfterListNotificationsFunction
afterDeleteNotificationFunction RuntimeAfterDeleteNotificationFunction
afterListStorageObjectsFunction RuntimeAfterListStorageObjectsFunction
afterReadStorageObjectsFunction RuntimeAfterReadStorageObjectsFunction
afterWriteStorageObjectsFunction RuntimeAfterWriteStorageObjectsFunction
afterDeleteStorageObjectsFunction RuntimeAfterDeleteStorageObjectsFunction
afterJoinTournamentFunction RuntimeAfterJoinTournamentFunction
afterListTournamentRecordsFunction RuntimeAfterListTournamentRecordsFunction
afterListTournamentsFunction RuntimeAfterListTournamentsFunction
afterWriteTournamentRecordFunction RuntimeAfterWriteTournamentRecordFunction
afterListTournamentRecordsAroundOwnerFunction RuntimeAfterListTournamentRecordsAroundOwnerFunction
afterUnlinkAppleFunction RuntimeAfterUnlinkAppleFunction
afterUnlinkCustomFunction RuntimeAfterUnlinkCustomFunction
afterUnlinkDeviceFunction RuntimeAfterUnlinkDeviceFunction
afterUnlinkEmailFunction RuntimeAfterUnlinkEmailFunction
afterUnlinkFacebookFunction RuntimeAfterUnlinkFacebookFunction
afterUnlinkFacebookInstantGameFunction RuntimeAfterUnlinkFacebookInstantGameFunction
afterUnlinkGameCenterFunction RuntimeAfterUnlinkGameCenterFunction
afterUnlinkGoogleFunction RuntimeAfterUnlinkGoogleFunction
afterUnlinkSteamFunction RuntimeAfterUnlinkSteamFunction
afterGetUsersFunction RuntimeAfterGetUsersFunction
afterEventFunction RuntimeAfterEventFunction
afterValidatePurchaseAppleFunction RuntimeAfterValidatePurchaseAppleFunction
afterValidatePurchaseGoogleFunction RuntimeAfterValidatePurchaseGoogleFunction
afterValidatePurchaseHuaweiFunction RuntimeAfterValidatePurchaseHuaweiFunction
}
type Runtime struct {
matchCreateFunction RuntimeMatchCreateFunction
rpcFunctions map[string]RuntimeRpcFunction
beforeRtFunctions map[string]RuntimeBeforeRtFunction
afterRtFunctions map[string]RuntimeAfterRtFunction
beforeReqFunctions *RuntimeBeforeReqFunctions
afterReqFunctions *RuntimeAfterReqFunctions
matchmakerMatchedFunction RuntimeMatchmakerMatchedFunction
tournamentEndFunction RuntimeTournamentEndFunction
tournamentResetFunction RuntimeTournamentResetFunction
leaderboardResetFunction RuntimeLeaderboardResetFunction
eventFunctions *RuntimeEventFunctions
consoleInfo *RuntimeInfo
}
type MatchNamesListFunction func() []string
type MatchProvider struct {
sync.RWMutex
providers []RuntimeMatchCreateFunction
providerNames []string
}
func (mp *MatchProvider) RegisterCreateFn(name string, fn RuntimeMatchCreateFunction) {
mp.Lock()
newProviders := make([]RuntimeMatchCreateFunction, len(mp.providers)+1, len(mp.providers)+1)
copy(newProviders, mp.providers)
newProviders[len(mp.providers)] = fn
mp.providers = newProviders
newProviderNames := make([]string, len(mp.providerNames)+1, len(mp.providerNames)+1)
copy(newProviderNames, mp.providerNames)
newProviderNames[len(mp.providerNames)] = name
mp.providerNames = newProviderNames
mp.Unlock()
}
func (mp *MatchProvider) CreateMatch(ctx context.Context, logger *zap.Logger, id uuid.UUID, node string, stopped *atomic.Bool, name string) (RuntimeMatchCore, error) {
mp.RLock()
providers := mp.providers
mp.RUnlock()
for _, p := range providers {
core, err := p(ctx, logger, id, node, stopped, name)
if err != nil {
return nil, err
}
if core != nil {
return core, nil
}
}
return nil, nil
}
func NewMatchProvider() *MatchProvider {
return &MatchProvider{
providers: make([]RuntimeMatchCreateFunction, 0),
providerNames: make([]string, 0),
}
}
func GetRuntimePaths(logger *zap.Logger, rootPath string) ([]string, error) {
if err := os.MkdirAll(rootPath, os.ModePerm); err != nil {
return nil, err
}
paths := make([]string, 0, 5)
if err := filepath.Walk(rootPath, func(path string, f os.FileInfo, err error) error {
if err != nil {
logger.Error("Error listing runtime path", zap.String("path", path), zap.Error(err))
return err
}
// Ignore directories.
if !f.IsDir() {
paths = append(paths, path)
}
return nil
}); err != nil {
logger.Error("Failed to list runtime path", zap.Error(err))
return nil, err
}
return paths, nil
}
func CheckRuntime(logger *zap.Logger, config Config) error {
// Get all paths inside the configured runtime.
paths, err := GetRuntimePaths(logger, config.GetRuntime().Path)
if err != nil {
return err
}
// Check any Go runtime modules.
err = CheckRuntimeProviderGo(logger, config.GetRuntime().Path, paths)
if err != nil {
return err
}
// Check any Lua runtime modules.
err = CheckRuntimeProviderLua(logger, config, paths)
if err != nil {
return err
}
// Check any JavaScript runtime modules.
err = CheckRuntimeProviderJavascript(logger, config)
if err != nil {
return err
}
return nil
}
func NewRuntime(ctx context.Context, logger, startupLogger *zap.Logger, db *sql.DB, protojsonMarshaler *protojson.MarshalOptions, protojsonUnmarshaler *protojson.UnmarshalOptions, config Config, socialClient *social.Client, leaderboardCache LeaderboardCache, leaderboardRankCache LeaderboardRankCache, leaderboardScheduler LeaderboardScheduler, sessionRegistry SessionRegistry, sessionCache SessionCache, matchRegistry MatchRegistry, tracker Tracker, metrics Metrics, streamManager StreamManager, router MessageRouter) (*Runtime, *RuntimeInfo, error) {
runtimeConfig := config.GetRuntime()
startupLogger.Info("Initialising runtime", zap.String("path", runtimeConfig.Path))
paths, err := GetRuntimePaths(startupLogger, runtimeConfig.Path)
if err != nil {
return nil, nil, err
}
startupLogger.Info("Initialising runtime event queue processor")
eventQueue := NewRuntimeEventQueue(logger, config, metrics)
startupLogger.Info("Runtime event queue processor started", zap.Int("size", config.GetRuntime().EventQueueSize), zap.Int("workers", config.GetRuntime().EventQueueWorkers))
matchProvider := NewMatchProvider()
goModules, goRPCFunctions, goBeforeRtFunctions, goAfterRtFunctions, goBeforeReqFunctions, goAfterReqFunctions, goMatchmakerMatchedFunction, goTournamentEndFunction, goTournamentResetFunction, goLeaderboardResetFunction, allEventFunctions, goMatchNamesListFn, err := NewRuntimeProviderGo(ctx, logger, startupLogger, db, protojsonMarshaler, config, socialClient, leaderboardCache, leaderboardRankCache, leaderboardScheduler, sessionRegistry, sessionCache, matchRegistry, tracker, metrics, streamManager, router, runtimeConfig.Path, paths, eventQueue, matchProvider)
if err != nil {
startupLogger.Error("Error initialising Go runtime provider", zap.Error(err))
return nil, nil, err
}
luaModules, luaRPCFunctions, luaBeforeRtFunctions, luaAfterRtFunctions, luaBeforeReqFunctions, luaAfterReqFunctions, luaMatchmakerMatchedFunction, luaTournamentEndFunction, luaTournamentResetFunction, luaLeaderboardResetFunction, err := NewRuntimeProviderLua(logger, startupLogger, db, protojsonMarshaler, protojsonUnmarshaler, config, socialClient, leaderboardCache, leaderboardRankCache, leaderboardScheduler, sessionRegistry, sessionCache, matchRegistry, tracker, metrics, streamManager, router, allEventFunctions.eventFunction, runtimeConfig.Path, paths, matchProvider)
if err != nil {
startupLogger.Error("Error initialising Lua runtime provider", zap.Error(err))
return nil, nil, err
}
jsModules, jsRPCFunctions, jsBeforeRtFunctions, jsAfterRtFunctions, jsBeforeReqFunctions, jsAfterReqFunctions, jsMatchmakerMatchedFunction, jsTournamentEndFunction, jsTournamentResetFunction, jsLeaderboardResetFunction, err := NewRuntimeProviderJS(logger, startupLogger, db, protojsonMarshaler, protojsonUnmarshaler, config, socialClient, leaderboardCache, leaderboardRankCache, leaderboardScheduler, sessionRegistry, sessionCache, matchRegistry, tracker, metrics, streamManager, router, allEventFunctions.eventFunction, runtimeConfig.Path, runtimeConfig.JsEntrypoint, matchProvider)
if err != nil {
startupLogger.Error("Error initialising JavaScript runtime provider", zap.Error(err))
return nil, nil, err
}
allModules := make([]string, 0, len(jsModules)+len(luaModules)+len(goModules))
for _, module := range jsModules {
allModules = append(allModules, module)
}
for _, module := range luaModules {
allModules = append(allModules, module)
}
for _, module := range goModules {
allModules = append(allModules, module)
}
startupLogger.Info("Found runtime modules", zap.Int("count", len(allModules)), zap.Strings("modules", allModules))
if allEventFunctions.eventFunction != nil {
startupLogger.Info("Registered event function invocation for custom events")
}
if allEventFunctions.sessionStartFunction != nil {
startupLogger.Info("Registered event function invocation", zap.String("id", "session_start"))
}
if allEventFunctions.sessionEndFunction != nil {
startupLogger.Info("Registered event function invocation", zap.String("id", "session_end"))
}
allRPCFunctions := make(map[string]RuntimeRpcFunction, len(goRPCFunctions)+len(luaRPCFunctions)+len(jsRPCFunctions))
jsRpcIDs := make(map[string]bool, len(jsRPCFunctions))
for id, fn := range jsRPCFunctions {
allRPCFunctions[id] = fn
jsRpcIDs[id] = true
startupLogger.Info("Registered JavaScript runtime RPC function invocation", zap.String("id", id))
}
luaRpcIDs := make(map[string]bool, len(luaRPCFunctions))
for id, fn := range luaRPCFunctions {
allRPCFunctions[id] = fn
delete(jsRpcIDs, id)
luaRpcIDs[id] = true
startupLogger.Info("Registered Lua runtime RPC function invocation", zap.String("id", id))
}
goRpcIDs := make(map[string]bool, len(goRPCFunctions))
for id, fn := range goRPCFunctions {
allRPCFunctions[id] = fn
delete(luaRpcIDs, id)
goRpcIDs[id] = true
startupLogger.Info("Registered Go runtime RPC function invocation", zap.String("id", id))
}
allBeforeRtFunctions := make(map[string]RuntimeBeforeRtFunction, len(jsBeforeRtFunctions)+len(luaBeforeRtFunctions)+len(goBeforeRtFunctions))
for id, fn := range jsBeforeRtFunctions {
allBeforeRtFunctions[id] = fn
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", strings.TrimPrefix(strings.TrimPrefix(id, API_PREFIX), RTAPI_PREFIX)))
}
for id, fn := range luaBeforeRtFunctions {
allBeforeRtFunctions[id] = fn
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", strings.TrimPrefix(strings.TrimPrefix(id, API_PREFIX), RTAPI_PREFIX)))
}
for id, fn := range goBeforeRtFunctions {
allBeforeRtFunctions[id] = fn
startupLogger.Info("Registered Go runtime Before function invocation", zap.String("id", strings.TrimPrefix(strings.TrimPrefix(id, API_PREFIX), RTAPI_PREFIX)))
}
allAfterRtFunctions := make(map[string]RuntimeAfterRtFunction, len(jsAfterRtFunctions)+len(luaAfterRtFunctions)+len(goAfterRtFunctions))
for id, fn := range jsAfterRtFunctions {
allAfterRtFunctions[id] = fn
startupLogger.Info("Registered JavaScript runtime After function invocation", zap.String("id", strings.TrimPrefix(strings.TrimPrefix(id, API_PREFIX), RTAPI_PREFIX)))
}
for id, fn := range luaAfterRtFunctions {
allAfterRtFunctions[id] = fn
startupLogger.Info("Registered Lua runtime After function invocation", zap.String("id", strings.TrimPrefix(strings.TrimPrefix(id, API_PREFIX), RTAPI_PREFIX)))
}
for id, fn := range goAfterRtFunctions {
allAfterRtFunctions[id] = fn
startupLogger.Info("Registered Go runtime After function invocation", zap.String("id", strings.TrimPrefix(strings.TrimPrefix(id, API_PREFIX), RTAPI_PREFIX)))
}
allBeforeReqFunctions := jsBeforeReqFunctions
// Register JavaScript Before Req functions
if allBeforeReqFunctions.beforeGetAccountFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "getaccount"))
}
if allBeforeReqFunctions.beforeUpdateAccountFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "updateaccount"))
}
if allBeforeReqFunctions.beforeSessionRefreshFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "sessionrefresh"))
}
if allBeforeReqFunctions.beforeSessionLogoutFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "sessionlogout"))
}
if allBeforeReqFunctions.beforeAuthenticateAppleFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "authenticateapple"))
}
if allBeforeReqFunctions.beforeAuthenticateCustomFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "authenticatecustom"))
}
if allBeforeReqFunctions.beforeAuthenticateDeviceFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "authenticatedevice"))
}
if allBeforeReqFunctions.beforeAuthenticateEmailFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "authenticateemail"))
}
if allBeforeReqFunctions.beforeAuthenticateFacebookFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "authenticatefacebook"))
}
if allBeforeReqFunctions.beforeAuthenticateFacebookInstantGameFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "authenticatefacebookinstantgame"))
}
if allBeforeReqFunctions.beforeAuthenticateGameCenterFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "authenticategamecenter"))
}
if allBeforeReqFunctions.beforeAuthenticateGoogleFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "authenticategoogle"))
}
if allBeforeReqFunctions.beforeAuthenticateSteamFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "authenticatesteam"))
}
if allBeforeReqFunctions.beforeListChannelMessagesFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "listchannelmessages"))
}
if allBeforeReqFunctions.beforeListFriendsFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "listfriends"))
}
if allBeforeReqFunctions.beforeAddFriendsFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "addfriends"))
}
if allBeforeReqFunctions.beforeDeleteFriendsFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "deletefriends"))
}
if allBeforeReqFunctions.beforeBlockFriendsFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "blockfriends"))
}
if allBeforeReqFunctions.beforeImportFacebookFriendsFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "importfacebookfriends"))
}
if allBeforeReqFunctions.beforeImportSteamFriendsFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "importsteamfriends"))
}
if allBeforeReqFunctions.beforeCreateGroupFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "creategroup"))
}
if allBeforeReqFunctions.beforeUpdateGroupFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "updategroup"))
}
if allBeforeReqFunctions.beforeDeleteGroupFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "deletegroup"))
}
if allBeforeReqFunctions.beforeJoinGroupFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "joingroup"))
}
if allBeforeReqFunctions.beforeLeaveGroupFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "leavegroup"))
}
if allBeforeReqFunctions.beforeAddGroupUsersFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "addgroupusers"))
}
if allBeforeReqFunctions.beforeBanGroupUsersFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "bangroupusers"))
}
if allBeforeReqFunctions.beforeKickGroupUsersFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "kickgroupusers"))
}
if allBeforeReqFunctions.beforePromoteGroupUsersFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "promotegroupusers"))
}
if allBeforeReqFunctions.beforeDemoteGroupUsersFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "demotegroupusers"))
}
if allBeforeReqFunctions.beforeListGroupUsersFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "listgroupusers"))
}
if allBeforeReqFunctions.beforeListUserGroupsFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "listusergroups"))
}
if allBeforeReqFunctions.beforeListGroupsFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "listgroups"))
}
if allBeforeReqFunctions.beforeDeleteLeaderboardRecordFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "deleteleaderboardrecord"))
}
if allBeforeReqFunctions.beforeListLeaderboardRecordsFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "listleaderboardrecords"))
}
if allBeforeReqFunctions.beforeWriteLeaderboardRecordFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "writeleaderboardrecord"))
}
if allBeforeReqFunctions.beforeListLeaderboardRecordsAroundOwnerFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "listleaderboardrecordsaroundowner"))
}
if allBeforeReqFunctions.beforeLinkAppleFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "linkapple"))
}
if allBeforeReqFunctions.beforeLinkCustomFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "linkcustom"))
}
if allBeforeReqFunctions.beforeLinkDeviceFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "linkdevice"))
}
if allBeforeReqFunctions.beforeLinkEmailFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "linkemail"))
}
if allBeforeReqFunctions.beforeLinkFacebookFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "linkfacebook"))
}
if allBeforeReqFunctions.beforeLinkFacebookInstantGameFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "linkfacebookinstantgame"))
}
if allBeforeReqFunctions.beforeLinkGameCenterFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "linkgamecenter"))
}
if allBeforeReqFunctions.beforeLinkGoogleFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "linkgoogle"))
}
if allBeforeReqFunctions.beforeLinkSteamFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "linksteam"))
}
if allBeforeReqFunctions.beforeListMatchesFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "listmatches"))
}
if allBeforeReqFunctions.beforeListNotificationsFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "listnotifications"))
}
if allBeforeReqFunctions.beforeDeleteNotificationFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "deletenotification"))
}
if allBeforeReqFunctions.beforeListStorageObjectsFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "liststorageobjects"))
}
if allBeforeReqFunctions.beforeReadStorageObjectsFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "readstorageobjects"))
}
if allBeforeReqFunctions.beforeWriteStorageObjectsFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "writestorageobjects"))
}
if allBeforeReqFunctions.beforeDeleteStorageObjectsFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "deletestorageobjects"))
}
if allBeforeReqFunctions.beforeJoinTournamentFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "jointournament"))
}
if allBeforeReqFunctions.beforeListTournamentRecordsFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "listtournamentrecords"))
}
if allBeforeReqFunctions.beforeListTournamentsFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "listtournaments"))
}
if allBeforeReqFunctions.beforeWriteTournamentRecordFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "writetournamentrecord"))
}
if allBeforeReqFunctions.beforeListTournamentRecordsAroundOwnerFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "listtournamentrecordsaroundowner"))
}
if allBeforeReqFunctions.beforeUnlinkAppleFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "unlinkapple"))
}
if allBeforeReqFunctions.beforeUnlinkCustomFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "unlinkcustom"))
}
if allBeforeReqFunctions.beforeUnlinkDeviceFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "unlinkdevice"))
}
if allBeforeReqFunctions.beforeUnlinkEmailFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "unlinkemail"))
}
if allBeforeReqFunctions.beforeUnlinkFacebookFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "unlinkfacebook"))
}
if allBeforeReqFunctions.beforeUnlinkFacebookInstantGameFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "unlinkfacebookinstantgame"))
}
if allBeforeReqFunctions.beforeUnlinkGameCenterFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "unlinkgamecenter"))
}
if allBeforeReqFunctions.beforeUnlinkGoogleFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "unlinkgoogle"))
}
if allBeforeReqFunctions.beforeUnlinkSteamFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "unlinksteam"))
}
if allBeforeReqFunctions.beforeGetUsersFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "getusers"))
}
if allBeforeReqFunctions.beforeValidatePurchaseAppleFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "validatepurchaseapple"))
}
if allBeforeReqFunctions.beforeValidatePurchaseGoogleFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "validatepurchasegoogle"))
}
if allBeforeReqFunctions.beforeValidatePurchaseHuaweiFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "validatepurchasehuawei"))
}
if allBeforeReqFunctions.beforeEventFunction != nil {
startupLogger.Info("Registered JavaScript runtime Before custom events function invocation")
}
// Register Lua Before Req functions
if luaBeforeReqFunctions.beforeGetAccountFunction != nil {
allBeforeReqFunctions.beforeGetAccountFunction = luaBeforeReqFunctions.beforeGetAccountFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "getaccount"))
}
if luaBeforeReqFunctions.beforeUpdateAccountFunction != nil {
allBeforeReqFunctions.beforeUpdateAccountFunction = luaBeforeReqFunctions.beforeUpdateAccountFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "updateaccount"))
}
if luaBeforeReqFunctions.beforeSessionRefreshFunction != nil {
allBeforeReqFunctions.beforeSessionRefreshFunction = luaBeforeReqFunctions.beforeSessionRefreshFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "sessionrefresh"))
}
if luaBeforeReqFunctions.beforeSessionLogoutFunction != nil {
allBeforeReqFunctions.beforeSessionLogoutFunction = luaBeforeReqFunctions.beforeSessionLogoutFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "sessionlogout"))
}
if luaBeforeReqFunctions.beforeAuthenticateAppleFunction != nil {
allBeforeReqFunctions.beforeAuthenticateAppleFunction = luaBeforeReqFunctions.beforeAuthenticateAppleFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "authenticateapple"))
}
if luaBeforeReqFunctions.beforeAuthenticateCustomFunction != nil {
allBeforeReqFunctions.beforeAuthenticateCustomFunction = luaBeforeReqFunctions.beforeAuthenticateCustomFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "authenticatecustom"))
}
if luaBeforeReqFunctions.beforeAuthenticateDeviceFunction != nil {
allBeforeReqFunctions.beforeAuthenticateDeviceFunction = luaBeforeReqFunctions.beforeAuthenticateDeviceFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "authenticatedevice"))
}
if luaBeforeReqFunctions.beforeAuthenticateEmailFunction != nil {
allBeforeReqFunctions.beforeAuthenticateEmailFunction = luaBeforeReqFunctions.beforeAuthenticateEmailFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "authenticateemail"))
}
if luaBeforeReqFunctions.beforeAuthenticateFacebookFunction != nil {
allBeforeReqFunctions.beforeAuthenticateFacebookFunction = luaBeforeReqFunctions.beforeAuthenticateFacebookFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "authenticatefacebook"))
}
if luaBeforeReqFunctions.beforeAuthenticateFacebookInstantGameFunction != nil {
allBeforeReqFunctions.beforeAuthenticateFacebookInstantGameFunction = luaBeforeReqFunctions.beforeAuthenticateFacebookInstantGameFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "authenticatefacebookinstantgame"))
}
if luaBeforeReqFunctions.beforeAuthenticateGameCenterFunction != nil {
allBeforeReqFunctions.beforeAuthenticateGameCenterFunction = luaBeforeReqFunctions.beforeAuthenticateGameCenterFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "authenticategamecenter"))
}
if luaBeforeReqFunctions.beforeAuthenticateGoogleFunction != nil {
allBeforeReqFunctions.beforeAuthenticateGoogleFunction = luaBeforeReqFunctions.beforeAuthenticateGoogleFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "authenticategoogle"))
}
if luaBeforeReqFunctions.beforeAuthenticateSteamFunction != nil {
allBeforeReqFunctions.beforeAuthenticateSteamFunction = luaBeforeReqFunctions.beforeAuthenticateSteamFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "authenticatesteam"))
}
if luaBeforeReqFunctions.beforeListChannelMessagesFunction != nil {
allBeforeReqFunctions.beforeListChannelMessagesFunction = luaBeforeReqFunctions.beforeListChannelMessagesFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "listchannelmessages"))
}
if luaBeforeReqFunctions.beforeListFriendsFunction != nil {
allBeforeReqFunctions.beforeListFriendsFunction = luaBeforeReqFunctions.beforeListFriendsFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "listfriends"))
}
if luaBeforeReqFunctions.beforeAddFriendsFunction != nil {
allBeforeReqFunctions.beforeAddFriendsFunction = luaBeforeReqFunctions.beforeAddFriendsFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "addfriends"))
}
if luaBeforeReqFunctions.beforeDeleteFriendsFunction != nil {
allBeforeReqFunctions.beforeDeleteFriendsFunction = luaBeforeReqFunctions.beforeDeleteFriendsFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "deletefriends"))
}
if luaBeforeReqFunctions.beforeBlockFriendsFunction != nil {
allBeforeReqFunctions.beforeBlockFriendsFunction = luaBeforeReqFunctions.beforeBlockFriendsFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "blockfriends"))
}
if luaBeforeReqFunctions.beforeImportFacebookFriendsFunction != nil {
allBeforeReqFunctions.beforeImportFacebookFriendsFunction = luaBeforeReqFunctions.beforeImportFacebookFriendsFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "importfacebookfriends"))
}
if luaBeforeReqFunctions.beforeImportSteamFriendsFunction != nil {
allBeforeReqFunctions.beforeImportSteamFriendsFunction = luaBeforeReqFunctions.beforeImportSteamFriendsFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "importsteamfriends"))
}
if luaBeforeReqFunctions.beforeCreateGroupFunction != nil {
allBeforeReqFunctions.beforeCreateGroupFunction = luaBeforeReqFunctions.beforeCreateGroupFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "creategroup"))
}
if luaBeforeReqFunctions.beforeUpdateGroupFunction != nil {
allBeforeReqFunctions.beforeUpdateGroupFunction = luaBeforeReqFunctions.beforeUpdateGroupFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "updategroup"))
}
if luaBeforeReqFunctions.beforeDeleteGroupFunction != nil {
allBeforeReqFunctions.beforeDeleteGroupFunction = luaBeforeReqFunctions.beforeDeleteGroupFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "deletegroup"))
}
if luaBeforeReqFunctions.beforeJoinGroupFunction != nil {
allBeforeReqFunctions.beforeJoinGroupFunction = luaBeforeReqFunctions.beforeJoinGroupFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "joingroup"))
}
if luaBeforeReqFunctions.beforeLeaveGroupFunction != nil {
allBeforeReqFunctions.beforeLeaveGroupFunction = luaBeforeReqFunctions.beforeLeaveGroupFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "leavegroup"))
}
if luaBeforeReqFunctions.beforeAddGroupUsersFunction != nil {
allBeforeReqFunctions.beforeAddGroupUsersFunction = luaBeforeReqFunctions.beforeAddGroupUsersFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "addgroupusers"))
}
if luaBeforeReqFunctions.beforeBanGroupUsersFunction != nil {
allBeforeReqFunctions.beforeBanGroupUsersFunction = luaBeforeReqFunctions.beforeBanGroupUsersFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "bangroupusers"))
}
if luaBeforeReqFunctions.beforeKickGroupUsersFunction != nil {
allBeforeReqFunctions.beforeKickGroupUsersFunction = luaBeforeReqFunctions.beforeKickGroupUsersFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "kickgroupusers"))
}
if luaBeforeReqFunctions.beforePromoteGroupUsersFunction != nil {
allBeforeReqFunctions.beforePromoteGroupUsersFunction = luaBeforeReqFunctions.beforePromoteGroupUsersFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "promotegroupusers"))
}
if luaBeforeReqFunctions.beforeListGroupUsersFunction != nil {
allBeforeReqFunctions.beforeListGroupUsersFunction = luaBeforeReqFunctions.beforeListGroupUsersFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "listgroupusers"))
}
if luaBeforeReqFunctions.beforeListUserGroupsFunction != nil {
allBeforeReqFunctions.beforeListUserGroupsFunction = luaBeforeReqFunctions.beforeListUserGroupsFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "listusergroups"))
}
if luaBeforeReqFunctions.beforeListGroupsFunction != nil {
allBeforeReqFunctions.beforeListGroupsFunction = luaBeforeReqFunctions.beforeListGroupsFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "listgroups"))
}
if luaBeforeReqFunctions.beforeDeleteLeaderboardRecordFunction != nil {
allBeforeReqFunctions.beforeDeleteLeaderboardRecordFunction = luaBeforeReqFunctions.beforeDeleteLeaderboardRecordFunction
startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "deleteleaderboardrecord"))
}
if luaBeforeReqFunctions.beforeListLeaderboardRecordsFunction != nil {
allBeforeReqFunctions.beforeListLeaderboardRecordsFunction = luaBeforeReqFunctions.beforeListLeaderboardRecordsFunction