util

package
v0.0.0-...-bf66d8f Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ConversationIDLength = 12

Conversations

View Source
const ConversationTokenIDLength = 12

Conversation tokens

View Source
const ConversationTokenLength = 32
View Source
const MailboxTokenLength = 64

Mailbox

View Source
const MaxConversationDataLength = 10_000 // Not sure about this number yet, but should be good for now
View Source
const MaxConversationMembers = 100
View Source
const MaxConversationTokenDataLength = 2_000 // Not sure about this number yet, but should be good for now
View Source
const StatusError = 2
View Source
const StatusOffline = 1
View Source
const StatusOnline = 0

Variables

View Source
var FilePath = "env/"
View Source
var Log = log.New(os.Stdout, "chat-server ", log.Flags())
View Source
var Testing = false

Functions

func GenerateToken

func GenerateToken(tkLength int32) string

func Hash

func Hash(str string) []byte

Hashes using SHA256

func HashString

func HashString(str string) string

Hashes using SHA256

func IsExpired

func IsExpired(c *fiber.Ctx) bool

IsExpired checks if the token is expired

func Node64

func Node64(id int64) string

func NodeTo64

func NodeTo64(id string) int64

func Permission

func Permission(c *fiber.Ctx, perm int16) bool

Permission checks if the user has the required permission level

func RemoteId

func RemoteId(lvl uint) (string, error)

Types

type AppToken

type AppToken struct {
	Node   uint   `json:"node"` // Node ID
	Domain string `json:"domain"`
	Token  string `json:"token"`
}

func ConnectToApp

func ConnectToApp(account string, session string, app uint, cluster uint) (AppToken, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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