dali

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package dali contains implementations of the dali tool

Index

Constants

View Source
const (
	HelpCmd string = "help"
)

Variables

View Source
var CmdHandlers = map[string]func(*Node, dict.StringMap) error{
	HelpCmd: cmdHelp,
	// contains filtered or unexported fields
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Path    string `json:"-"`
	Name    string
	Timeout int
	Logs    []Event
}

User's configuration (name, timeout, logs)

func (*Config) AddLog added in v0.1.3

func (c *Config) AddLog(event Event)

Add event log to config

func (*Config) Save added in v0.1.2

func (c *Config) Save() error

Save the config to file

type DiscoveryMessage

type DiscoveryMessage struct {
	Type         string // query, announce
	Name         string // peer name (for announce)
	Addr         string
	TransferPort uint16 // transfer port (for announce)
}

func (*DiscoveryMessage) ToBytes

func (m *DiscoveryMessage) ToBytes() []byte

Serialize DiscoveryMessage to JSON bytes

type Event

type Event [7]string

Timestamp, Type, Result, FilePath, FileSize, SenderName, ReceiverName

func (Event) Tuple

func (e Event) Tuple() (timestamp, eventType, result, filePath, fileSize, senderName, receiverName string)

Destructure event parts

type Node

type Node struct {
	*Config
	Addr string
}

Representation of machine

func LoadNode

func LoadNode(command string) (*Node, error)

Load user node

func (Node) String

func (n Node) String() string

String representationof Node

type Peer

type Peer struct {
	Name string
	Addr string
}

type TransferMessage

type TransferMessage struct {
	Type     string // offer, accept, reject, complete
	Sender   string // sender name (for offer)
	Filename string // file name (for offer)
	Size     uint64 // file size (for offer)
}

func (*TransferMessage) ToBytes

func (m *TransferMessage) ToBytes() []byte

Serialize TransferMessage to JSON bytes with newline

Jump to

Keyboard shortcuts

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