control

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Msg

type Msg struct {
	*StateMsg
	*WordMsg
}

type Packet

type Packet struct {
	EncryptedSize int
	EncryptedData []byte
}

type Socket

type Socket struct {
	Conn net.Conn
	Data chan interface{}
	// contains filtered or unexported fields
}

func ConnectSocket

func ConnectSocket() *Socket

ConnectSocket is used by the client to connect to the socket the server created for two-way communication

func NewSocket

func NewSocket(username string) *Socket

NewSocket is used by the server command to create a new socket for communication between server and client

func (*Socket) RecvData

func (s *Socket) RecvData()

RecvData handles recieving data on the connection, decoding the message and passing the decoded data to the Data channel (for external processing)

func (*Socket) SendState

func (s *Socket) SendState(state State)

SendState sends a message to the socket of type State

func (*Socket) SendWord

func (s *Socket) SendWord(w string, c string, p rune)

SendState sends a message to the socket of type Word

type State

type State int8
const (
	SocketPath       = "/tmp/autocorrector.sock"
	Start      State = 0x01
	Resume     State = 0x02
	Pause      State = 0x03
	Stop       State = 0x04
)

type StateMsg

type StateMsg struct {
	State
}

type WordMsg

type WordMsg struct {
	Word, Correction string
	Punct            rune
}

Jump to

Keyboard shortcuts

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