Loading CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr - Lua runtime token generator function now returns a second value representing the token's expiry. - Add local cache for in-memory storage to the Lua runtime. - Graceful server shutdown and match termination. - Expose incoming request data in runtime after hooks. ### Changed - Improved Postgres compatibility on TIMESTAMPTZ types. Loading runtime/runtime.go +126 −114 File changed.Preview size limit exceeded, changes collapsed. Show changes server/api_account.go +3 −8 Original line number Diff line number Diff line Loading @@ -44,16 +44,11 @@ func (s *ApiServer) GetAccount(ctx context.Context, in *empty.Empty) (*api.Accou // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) result, err, code := fn(s.logger, userID.String(), ctx.Value(ctxUsernameKey{}).(string), ctx.Value(ctxExpiryKey{}).(int64), clientIP, clientPort, in) err, code := fn(s.logger, userID.String(), ctx.Value(ctxUsernameKey{}).(string), ctx.Value(ctxExpiryKey{}).(int64), clientIP, clientPort) if err != nil { return nil, status.Error(code, err.Error()) } if result == nil { // If result is nil, requested resource is disabled. s.logger.Warn("Intercepted a disabled resource.", zap.Any("resource", fullMethod), zap.String("uid", userID.String())) return nil, status.Error(codes.NotFound, "Requested resource was not found.") } in = result // Empty input never overridden. // Stats measurement end boundary. span.End() Loading Loading @@ -143,7 +138,7 @@ func (s *ApiServer) UpdateAccount(ctx context.Context, in *api.UpdateAccountRequ // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) fn(s.logger, userID.String(), ctx.Value(ctxUsernameKey{}).(string), ctx.Value(ctxExpiryKey{}).(int64), clientIP, clientPort, &empty.Empty{}) fn(s.logger, userID.String(), ctx.Value(ctxUsernameKey{}).(string), ctx.Value(ctxExpiryKey{}).(int64), clientIP, clientPort, in) // Stats measurement end boundary. span.End() Loading server/api_authenticate.go +7 −7 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ func (s *ApiServer) AuthenticateCustom(ctx context.Context, in *api.Authenticate // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session, in) // Stats measurement end boundary. span.End() Loading Loading @@ -178,7 +178,7 @@ func (s *ApiServer) AuthenticateDevice(ctx context.Context, in *api.Authenticate // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session, in) // Stats measurement end boundary. span.End() Loading Loading @@ -260,7 +260,7 @@ func (s *ApiServer) AuthenticateEmail(ctx context.Context, in *api.AuthenticateE // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session, in) // Stats measurement end boundary. span.End() Loading Loading @@ -336,7 +336,7 @@ func (s *ApiServer) AuthenticateFacebook(ctx context.Context, in *api.Authentica // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session, in) // Stats measurement end boundary. span.End() Loading Loading @@ -419,7 +419,7 @@ func (s *ApiServer) AuthenticateGameCenter(ctx context.Context, in *api.Authenti // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session, in) // Stats measurement end boundary. span.End() Loading Loading @@ -490,7 +490,7 @@ func (s *ApiServer) AuthenticateGoogle(ctx context.Context, in *api.Authenticate // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session, in) // Stats measurement end boundary. span.End() Loading Loading @@ -565,7 +565,7 @@ func (s *ApiServer) AuthenticateSteam(ctx context.Context, in *api.AuthenticateS // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session, in) // Stats measurement end boundary. span.End() Loading server/api_channel.go +1 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,7 @@ func (s *ApiServer) ListChannelMessages(ctx context.Context, in *api.ListChannel // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) fn(s.logger, userID.String(), ctx.Value(ctxUsernameKey{}).(string), ctx.Value(ctxExpiryKey{}).(int64), clientIP, clientPort, messageList) fn(s.logger, userID.String(), ctx.Value(ctxUsernameKey{}).(string), ctx.Value(ctxExpiryKey{}).(int64), clientIP, clientPort, messageList, in) // Stats measurement end boundary. span.End() Loading Loading
CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr - Lua runtime token generator function now returns a second value representing the token's expiry. - Add local cache for in-memory storage to the Lua runtime. - Graceful server shutdown and match termination. - Expose incoming request data in runtime after hooks. ### Changed - Improved Postgres compatibility on TIMESTAMPTZ types. Loading
runtime/runtime.go +126 −114 File changed.Preview size limit exceeded, changes collapsed. Show changes
server/api_account.go +3 −8 Original line number Diff line number Diff line Loading @@ -44,16 +44,11 @@ func (s *ApiServer) GetAccount(ctx context.Context, in *empty.Empty) (*api.Accou // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) result, err, code := fn(s.logger, userID.String(), ctx.Value(ctxUsernameKey{}).(string), ctx.Value(ctxExpiryKey{}).(int64), clientIP, clientPort, in) err, code := fn(s.logger, userID.String(), ctx.Value(ctxUsernameKey{}).(string), ctx.Value(ctxExpiryKey{}).(int64), clientIP, clientPort) if err != nil { return nil, status.Error(code, err.Error()) } if result == nil { // If result is nil, requested resource is disabled. s.logger.Warn("Intercepted a disabled resource.", zap.Any("resource", fullMethod), zap.String("uid", userID.String())) return nil, status.Error(codes.NotFound, "Requested resource was not found.") } in = result // Empty input never overridden. // Stats measurement end boundary. span.End() Loading Loading @@ -143,7 +138,7 @@ func (s *ApiServer) UpdateAccount(ctx context.Context, in *api.UpdateAccountRequ // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) fn(s.logger, userID.String(), ctx.Value(ctxUsernameKey{}).(string), ctx.Value(ctxExpiryKey{}).(int64), clientIP, clientPort, &empty.Empty{}) fn(s.logger, userID.String(), ctx.Value(ctxUsernameKey{}).(string), ctx.Value(ctxExpiryKey{}).(int64), clientIP, clientPort, in) // Stats measurement end boundary. span.End() Loading
server/api_authenticate.go +7 −7 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ func (s *ApiServer) AuthenticateCustom(ctx context.Context, in *api.Authenticate // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session, in) // Stats measurement end boundary. span.End() Loading Loading @@ -178,7 +178,7 @@ func (s *ApiServer) AuthenticateDevice(ctx context.Context, in *api.Authenticate // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session, in) // Stats measurement end boundary. span.End() Loading Loading @@ -260,7 +260,7 @@ func (s *ApiServer) AuthenticateEmail(ctx context.Context, in *api.AuthenticateE // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session, in) // Stats measurement end boundary. span.End() Loading Loading @@ -336,7 +336,7 @@ func (s *ApiServer) AuthenticateFacebook(ctx context.Context, in *api.Authentica // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session, in) // Stats measurement end boundary. span.End() Loading Loading @@ -419,7 +419,7 @@ func (s *ApiServer) AuthenticateGameCenter(ctx context.Context, in *api.Authenti // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session, in) // Stats measurement end boundary. span.End() Loading Loading @@ -490,7 +490,7 @@ func (s *ApiServer) AuthenticateGoogle(ctx context.Context, in *api.Authenticate // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session, in) // Stats measurement end boundary. span.End() Loading Loading @@ -565,7 +565,7 @@ func (s *ApiServer) AuthenticateSteam(ctx context.Context, in *api.AuthenticateS // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session) fn(s.logger, dbUserID, dbUsername, exp, clientIP, clientPort, session, in) // Stats measurement end boundary. span.End() Loading
server/api_channel.go +1 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,7 @@ func (s *ApiServer) ListChannelMessages(ctx context.Context, in *api.ListChannel // Extract request information and execute the hook. clientIP, clientPort := extractClientAddress(s.logger, ctx) fn(s.logger, userID.String(), ctx.Value(ctxUsernameKey{}).(string), ctx.Value(ctxExpiryKey{}).(int64), clientIP, clientPort, messageList) fn(s.logger, userID.String(), ctx.Value(ctxUsernameKey{}).(string), ctx.Value(ctxExpiryKey{}).(int64), clientIP, clientPort, messageList, in) // Stats measurement end boundary. span.End() Loading