platform

module
v0.0.0-...-8a99b67 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2024 License: MIT

README

Platform

中台服务,包含许多公共服务

Services:

  • Auth: 用户认证服务,支持JWT token校验
  • Analytics: BI日志服务,支持thinkingData,MixPanel,localFile,ClickHouse等方式
  • Buddy: 好友服务,支持加好友/删除好友/拉黑/好友列表等功能
  • Chat: 聊天服务,支持私聊/群聊/频道聊天,暂时不支持离线消息
  • Knapsack: 背包服务,支持Item{ID, Count, Type,Expire}
  • Leaderboard: 排行榜服务,更新排行榜,获取排行榜,支持多种排行榜类型
  • Mail: 邮件服务,发送附件邮件,支持模板,过期时间,附件等功能
  • Matchmaking: 匹配服务,分配房间 基于open-match+ agones实现
  • Party: 组队服务,组队/踢人/解散队伍等功能
  • Profile: 玩家基本信息服务,创建/更新玩家基本信息
  • Room: 房间管理服务,创建/加入/离开/销毁房间,房间内提供通用 lockstep 帧同步服务

目录结构规范 :

工程目录结构参考project-layout

运行:

  • 你可以运行cmd/platform/main.go来启动所有服务, 你也可以参考cmd/platform/main.go来自定义组装服务。
  • 你可以运行cmd/{service-name}/service/main.go来启动单个服务,例如:cmd/auth/service/main.go 来启动auth服务

容器化

# fix {appname} to service name
docker buildx build -t {appname}.registry.com:latest --build-arg APP_NAME={appname} -f ./build/package/docker/Dockerfile .  --push

如何测试?

Integration Test
  • build your interactive client:
      go build -o client.exe ./cmd/{game-name}/client/main.go 
    
  • run your interactive client:
     # help
     ./{game-name}.exe help
    
    tips: http client use Postman to connect localhost:8081.
Load Test
  • install k6
  • run k6 load test
     # fix the game-name to your game name
     k6 run ./tests/{game-name}/{game-name}.js
    

服务安全:

服务类型:

每个服务包含两种类型的服务:

  • private service: 不会校验JWT token, 会走mTLS认证,适用于内部服务调用例如:gm, admin,或者其他内部服务调用。
  • public service: 会校验JWT token, 会走mTLS认证 适用于其他外部服务调用。

Directories

Path Synopsis
api
gen/analytics/api
Package v1 is a reverse proxy.
Package v1 is a reverse proxy.
gen/auth/api
Package v1 is a reverse proxy.
Package v1 is a reverse proxy.
gen/buddy/api
Package buddy is a reverse proxy.
Package buddy is a reverse proxy.
gen/chat/api
Package chat is a reverse proxy.
Package chat is a reverse proxy.
gen/knapsack/api
Package pb is a reverse proxy.
Package pb is a reverse proxy.
gen/leaderboard/api
Package leaderboard is a reverse proxy.
Package leaderboard is a reverse proxy.
gen/mail/api
Package mail is a reverse proxy.
Package mail is a reverse proxy.
gen/matchmaking/api
Package matchmaking is a reverse proxy.
Package matchmaking is a reverse proxy.
gen/party/api
Package pb is a reverse proxy.
Package pb is a reverse proxy.
gen/profile/api
Package pb is a reverse proxy.
Package pb is a reverse proxy.
cmd
services

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL