client

package module
v0.0.0-...-83f3738 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: GPL-3.0, LGPL-3.0 Imports: 19 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 ClientConfigFile = "client.cfg"

Variables

This section is empty.

Functions

func CreateDefaultFile

func CreateDefaultFile() error

func PseudoMain

func PseudoMain()

Types

type BaseData

type BaseData struct {
	Allowed      map[int][]rune          // which letters are allowed in which key position
	Allowed2     map[rune][]int          // which letters are allowed in which key position
	Bigrams      map[string]float64      // occurrence of a bigram per 1M words
	Scores       map[int]map[int]float64 // score of a bigram
	Letter_freq  map[string]int          // occurrence of a letter per 1M words
	Letters      []rune                  // order of most common letter
	Keys         []int                   // order of most valuable position
	Key_diff     int                     // difference between number of positions and letters
	MaxLetters   int                     // the number of letters for a layout
	BigramMatrix *mat.Dense              // occurrence of a bigram, but as matrix
	LetterOrder  map[rune]int            // arbitrary but given order of the letters
	BigramRunes  map[rune]map[rune]float64
}

func ConvertLetterData

func ConvertLetterData(msg perm.LetterMessage) *BaseData

func (*BaseData) Calculate

func (data *BaseData) Calculate(layout map[rune]int) float64

Scores is already a big matrix. place bigram freqs in a corresponding matrix. a single matrix multiplication computes the sum then dot product then sum the resulting matrix faster than Calculate2

func (*BaseData) Calculate2

func (data *BaseData) Calculate2(layout map[rune]int) float64

check if this actually calculates the correct results. or if the other one is bad about 20k for this vs 6M for the other slowest currently. maybe inefficient handling of matrix objects.

func (*BaseData) Calculate3

func (data *BaseData) Calculate3(layout map[rune]int) float64

fastest yet, slightly faster than Calculate()

func (*BaseData) ConvertAllowed

func (data *BaseData) ConvertAllowed() map[rune][]int

func (*BaseData) GeneratePermutations

func (data *BaseData) GeneratePermutations(
	accumulated map[rune]int,
	subTask *perm.SubTask,
	calcFunc func(map[rune]int) float64)

Generates layout permutations don't run the channel that receives the permutations simultaneously won't be single core otherwise

func (*BaseData) GetNextKey

func (data *BaseData) GetNextKey(acc map[rune]int) (int, error)

func (*BaseData) Get_next_key

func (data *BaseData) Get_next_key(acc map[rune]int) (int, error)

part of this can be done before permutations lol not working

func (*BaseData) Get_next_key2

func (data *BaseData) Get_next_key2(acc map[int]rune) (int, error)

func (*BaseData) Get_remaining

func (data *BaseData) Get_remaining(acc map[rune]int) []int

func (*BaseData) Get_remaining2

func (data *BaseData) Get_remaining2(acc map[int]rune) []int

func (*BaseData) Letter_key_diff

func (data *BaseData) Letter_key_diff() int

discrepancy between number of letters and key positions

func (*BaseData) MakeBigramMatrix

func (data *BaseData) MakeBigramMatrix() *mat.Dense

func (*BaseData) MakeBigramRunes

func (data *BaseData) MakeBigramRunes() map[rune]map[rune]float64

func (*BaseData) MakeScoreMatrix

func (data *BaseData) MakeScoreMatrix(layout map[rune]int) *mat.Dense

func (*BaseData) MakeSortedLetters

func (data *BaseData) MakeSortedLetters() map[rune]int

func (*BaseData) ResultHandler

func (data *BaseData) ResultHandler(
	subRes *perm.SubResult,
	results chan map[rune]int)

receive the permutated layout and calculate it

type ClientConfig

type ClientConfig struct {
	ClientID string `ini:"client_id"`
	Address  string `ini:"address"`
	Port     int    `ini:"port"`
	Threads  int    `ini:"threads"`
}

func ParseConfig

func ParseConfig() (ClientConfig, error)

func (*ClientConfig) FullAddress

func (conf *ClientConfig) FullAddress() string

func (*ClientConfig) HelloMessage

func (conf *ClientConfig) HelloMessage() perm.HelloMessage

func (*ClientConfig) SetDefaultClientID

func (conf *ClientConfig) SetDefaultClientID()

type ForcedShutdown

type ForcedShutdown bool

type Server

type Server *sock.HostConnection

type Tasks

type Tasks *TasksState

type TasksState

type TasksState struct {
	sync.RWMutex
	TaskLimit   int // maximum amount of tasks that can be active
	PrevLimit   int
	ActiveTasks int // current active tasks

	TaskFinished   chan bool // notify every time task counter or limit changes
	NewLimit       chan bool
	TaskSize       []int
	Timestamp      int64 // when most recent task finished
	CompletedTasks int
	Computations   int
	RecentResults  []perm.Task
	ZeroTasks      int
	// contains filtered or unexported fields
}

func (*TasksState) FinishTask

func (state *TasksState) FinishTask()

func (*TasksState) IsActive

func (state *TasksState) IsActive() bool

func (*TasksState) IsEmpty

func (state *TasksState) IsEmpty() bool

func (*TasksState) IsPaused

func (state *TasksState) IsPaused() bool

func (*TasksState) NewResults

func (t *TasksState) NewResults(task perm.Task)

func (*TasksState) NewTask

func (state *TasksState) NewTask(chunk []int)

func (*TasksState) Pause

func (state *TasksState) Pause()

func (*TasksState) Rate

func (t *TasksState) Rate() float64

func (*TasksState) RecordTimestamp

func (state *TasksState) RecordTimestamp(timestamp int64) int64

func (*TasksState) Resume

func (state *TasksState) Resume()

func (*TasksState) ResumeTasks

func (state *TasksState) ResumeTasks()

func (*TasksState) Saturated

func (state *TasksState) Saturated() bool

func (*TasksState) SetLimit

func (state *TasksState) SetLimit(limit int)

func (*TasksState) StartTask

func (state *TasksState) StartTask()

type UIModel

type UIModel struct {
	Connection *sock.GlobalConnection
	Counter    int
	Stats      perm.StatsTables
	Server     *sock.HostConnection
	TasksState *TasksState
	HostChan   chan sock.HostConnection
	TextInput  textinput.Model
	// contains filtered or unexported fields
}

func CreateModel

func CreateModel(
	gc *sock.GlobalConnection,
	hostChan chan sock.HostConnection) UIModel

func (UIModel) Init

func (m UIModel) Init() tea.Cmd

func (UIModel) Update

func (m UIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (UIModel) View

func (m UIModel) View() tea.View

Jump to

Keyboard shortcuts

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