server

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 25 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	MessagePath   = "message"
	BootstrapPath = "bootstrap"
)

Variables

This section is empty.

Functions

func CreateHeader

func CreateHeader(c *Conversation, headerName string) (*fyne.Container, error)

Types

type Conversation

type Conversation struct {
	ConversationAlias string
	ConversationID    string
	Messages          []*Message
	Render            *ConversationRender

	// Self
	SelfToken      string
	SelfPublicKey  any
	SelfPrivateKey any

	// Internal
	KeyType     string
	Established bool
	Ended       bool

	// Remote
	RemoteAddress   string
	RemoteToken     string
	RemotePublicKey any
}

func NewConversationHandle

func NewConversationHandle(
	sAddress, rAddress, keyType, conversationAlias, remoteToken, selfToken, convoID string,
	receiverPublicKey, senderPrivateKey, senderPublicKey any,
	w fyne.Window, rh *RouteHandler) ([]byte, *Conversation, error)

func (*Conversation) PackMessage

func (h *Conversation) PackMessage(message string, end bool) ([]byte, error)

func (*Conversation) RenderMessages

func (c *Conversation) RenderMessages(w fyne.Window, rh *RouteHandler)

func (*Conversation) UnpackMessage

func (h *Conversation) UnpackMessage(eMessage, sig []byte) (*Message, error)

type ConversationRender

type ConversationRender struct {
	Fullscreen *fyne.Container
	Messages   *fyne.Container
	Header     *fyne.Container
}

func (*ConversationRender) AddMessage

func (cr *ConversationRender) AddMessage(msg Message) error

func (*ConversationRender) EndConversation

func (cr *ConversationRender) EndConversation()

func (*ConversationRender) UpdateHeader

func (cr *ConversationRender) UpdateHeader(c *Conversation, headerName string) error

type Message

type Message struct {
	Text         string `json:"text"`
	Time         int    `json:"time"`
	Token        string `json:"token"`
	FinalMessage bool   `json:"final_message"`
	Self         bool   `json:"_"`
}

type MessageWrapper

type MessageWrapper struct {
	Message   []byte `json:"message"`
	Signature []byte `json:"signature"`
	ID        string `json:"id"`
}

type RouteHandler

type RouteHandler struct {
	Conversations      map[string]*Conversation
	ConversationScreen *fyne.Container
	Receiver           *tor.OnionService
	Sender             http.Client
	Tor                *tor.Tor
	URL                string
	// contains filtered or unexported fields
}

func NewRouteHandler

func NewRouteHandler() (*RouteHandler, error)

func (*RouteHandler) Bootstrap

func (rh *RouteHandler) Bootstrap(c echo.Context) error

func (*RouteHandler) BootstrapConversation

func (rh *RouteHandler) BootstrapConversation(token string, privateKey, publicKey, remotePublicKey any, alias string, w fyne.Window) error

func (*RouteHandler) Close

func (rh *RouteHandler) Close()

func (*RouteHandler) DeleteConversation

func (rh *RouteHandler) DeleteConversation(id string)

func (*RouteHandler) GenerateConversation

func (rh *RouteHandler) GenerateConversation(privateKey, publicKey, remotePublicKey any, keyType, alias string, w fyne.Window) (string, error)

func (*RouteHandler) Message

func (rh *RouteHandler) Message(c echo.Context) error

func (*RouteHandler) SendMessage

func (rh *RouteHandler) SendMessage(packedMessage []byte, url, path string) error

type StartConversation

type StartConversation struct {
	Address string `json:"address"`
	Token   string `json:"token"`
}

type StartConversationWrapper

type StartConversationWrapper struct {
	EncryptionType string `json:"encryption_type"`
	ID             string `json:"id"`
	Auth           []byte `json:"auth"`
	Signature      []byte `json:"signature"`
}

Jump to

Keyboard shortcuts

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