ここでは Diarkis Server Template に含まれているディレクトリについてそれぞれ説明します。
以下が Diarkis Server Template をインストールすると展開されるディレクトリになります。
───┬─ servers/ ─┬──── http/main.go [HTTP server main]
│ │
│ ├──── udp/main.go [UDP server main]
│ │
│ ├──── tcp/main.go [TCP server main]
│ │
│ ├──── connector/main.go [Connector server main]
│ │
│ └──── ws/main.go [WebSocket server main]
│
├─ mars/ ───────── main.go
│
│
├─ healthcheck/ ── main.go
│
│
├─ configs/ ─┬──── shared/ [Shared configuration directory] ────────────────────┬─ field.json
│ │ ├─ group.json
│ ├──── http/ [HTTP configuration directory] ──────── main.json ├─ log.json
│ │ ├─ matching.json
│ ├──── udp/ [UDP configuration directory] ──────── main.json └─ mesh.json
│ │
│ ├──── tcp/ [TCP configuration directory] ──────── main.json
│ │
│ ├──── connector [Connector configuration directory] ─── main.json
│ │
│ └──── ws/ [WebSocket configuration directory] ─── main.json
│
├─ cmds/ [Custom client command directory] ────────────────┬── main.go [Entry point for all cmds]
│ │
├─ ws_cmds/ [Custom client command directory for WebSocket] │
│ │
│ ├── http ──────────────────────────────────────┬─── main.go
├─ lib/ [Shared library directory] ├── room ──────────────────────────── main.go └─── matching.go
│ ├── group ──────────────────────────── main.go
├─ bin/ [Built server binary directory] ├── field ──────────────────────────── main.go
│ └── custom ──────────────────────────── main.go
│
├─ build.yml [Build configuration file for diarkis-cli]
│
└─ go.mod [Go module file for the project]
サーバ・エントリ
Diarkis サーバは通信プロトコルごとにそれぞれサーバが独立しています。サーバの種類は以下です:
- UDP/RUP
- TCP
- HTTP
- WS (WebSocket)
それぞれのサーバの main.go ファイルが格納されています。サーバの起動はそれぞれの main.go をビルドしたバイナリを起動します。
MARS サーバ
MARS サーバは Diarkis が持つ特有のサーバで Diarkis サーバ・クラスタに必ず1つ必要なサーバです。MARS サーバはコードを編集する必要はなく diarkis-cli を使ってビルドするだけで使うことができます。
Health Check
Diarkis サーバ・クラスタを Kubernetes 上にデプロイする場合ヘルスチェックをサーバ・ポッドごとに動かす必要があります。MARS サーバ同様にコードの編集の必要はなく diarkis-cli を使ってビルドして使うことになります。
Configurations
サーバの設定ファイルを格納しているディレクトリです。
カスタム・コマンド
Diarkis サーバは自由にカスタム・コマンドを実装することができます。
カスタム・コマンドはサーバとクライアントで RPC スタイルでコミュニケーションを取るための機能です。
カスタム・コマンドのディレクトリは2つに分かれており、以下の通りです:
- cmds/ for UDP, TCP, and HTTP
- ws_cmds/ for WebSocket.
Build.yml ファイル
build.yml は diarkis-cli を使ってビルドする際の設定になります。詳細はこちらを参照ください。