client

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxMsgLen = 2000
)

Constants for the client's operation.

Variables

This section is empty.

Functions

func New

func New(actions <-chan UserAction, events chan<- DisplayEvent) (*client, error)

New creates a new instance of the client.

Types

type ChatSession

type ChatSession struct {
	PrivKey    string
	PubKey     string
	Nick       string
	CustomNick bool
}

type DisplayEvent

type DisplayEvent struct {
	Type         string
	Timestamp    string
	Nick         string
	Content      string
	FullPubKey   string
	ShortPubKey  string
	IsOwnMessage bool
	RelayURL     string
	ID           string
	Chat         string
	Payload      any
}

DisplayEvent represents an event sent from the client to the TUI for display.

type RelayInfo

type RelayInfo struct {
	URL       string
	Latency   time.Duration
	Connected bool
}

RelayInfo holds status information about a single relay connection.

type StateUpdate

type StateUpdate struct {
	Views           []View
	ActiveViewIndex int
	Nick            string
}

StateUpdate is a specific payload for a DisplayEvent to update the TUI's state.

type UserAction

type UserAction struct {
	Type    string
	Payload string
}

UserAction represents an action initiated by the user from the TUI.

type View

type View struct {
	Name     string   `json:"name"`
	IsGroup  bool     `json:"is_group"`
	Children []string `json:"children"`
	PoW      int      `json:"pow,omitempty"`
}

Jump to

Keyboard shortcuts

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