Setup Session Module on 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 server's main function. Below is a sample setup for a UDP server. The setup function of diarkisexec must be executed before calling diarkisexec.StartDiarkis().

For more details, please refer to the diarkisexec API Reference.

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()
}

You can easily start up a server using the server template, so we recommend starting with that. Diarkis Server Template

Last updated