For the complete documentation index, see llms.txt. This page is also available as Markdown.

Set Up Session Module on Server

Overview

The Session module can be set up on both 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 your server's main function. Below is an example of setting up on a UDP server. The setup function from diarkisexec must be executed before calling diarkisexec.StartDiarkis().

For more details, please 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()
}

Since you can easily start a server using the server template, it is recommended to use this first. Refer to Diarkis Server Template.

最終更新

役に立ちましたか?