Setting Up the Session Module on the Server

Overview

The Session module can be set up on TCP and UDP servers.

Setup

To expose built-in commands to the client, you can use the diarkisexec package for setup.

Add the following to the main function of your server. Below is an example of setting up a UDP server. The setup function of diarkisexec must be executed before calling diarkisexec.StartDiarkis().

For more details, refer to the API reference for diarkisexec.

package main

import "github.com/Diarkis/diarkis/diarkisexec"

func main() {
	logConfigPath := "/configs/shared/log.json"
	meshConfigPath := ""

	diarkisexec.SetupDiarkis(logConfigPath, meshConfigPath, &diarkisexec.Modules{
		Session:    &diarkisexec.Options{ConfigPath: "/configs/shared/session.json", ExposeCommands: true},
	})
	diarkisexec.SetupDiarkisUDPServer("/configs/udp/main.json")
	diarkisexec.StartDiarkis()
}

It is recommended to use the server template for easily setting up the server. Diarkis Server Template

最終更新