common

package
v0.0.0-...-e33f7fc Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyPress          = C.KeyPress
	KeyRelease        = C.KeyRelease
	ButtonPress       = C.ButtonPress
	ButtonRelease     = C.ButtonRelease
	MotionNotify      = C.MotionNotify
	ButtonPressMask   = C.ButtonPressMask
	ButtonReleaseMask = C.ButtonReleaseMask
	PointerMotionMask = C.PointerMotionMask
	GrabModeAsync     = C.GrabModeAsync
	None              = C.None
	CurrentTime       = C.CurrentTime
	True              = C.True
	False             = C.False
)

Variables

This section is empty.

Functions

func AddressToBytes

func AddressToBytes(address Address) [4]byte

func CheckError

func CheckError(err error)

func DefaultScreen

func DefaultScreen(display *Display) int

func EncodeMessage

func EncodeMessage(msg Message) []byte

func FakeKeyEvent

func FakeKeyEvent(display *Display, keycode uint, eventType int, delay int)

func GetCursorPosition

func GetCursorPosition(event *XEvent) (int, int)

func GetKeyCode

func GetKeyCode(event *XEvent) uint

func GetXEventType

func GetXEventType(event *XEvent) int

func ReadAuthorizedKeys

func ReadAuthorizedKeys(autorizedKeysPath string) (map[string]RSAPubKey, []string)

func XGrabKeyboard

func XGrabKeyboard(display *Display, window Window)

func XGrabPointer

func XGrabPointer(display *Display, window Window)

func XKeycodeToKeysym

func XKeycodeToKeysym(display *Display, keycode uint) uint64

func XKeysymToKeycode

func XKeysymToKeycode(display *Display, keysym uint64) uint

func XKeysymToString

func XKeysymToString(keysym uint64) string

func XNextEvent

func XNextEvent(display *Display, event *XEvent)

func XStringToKeysym

func XStringToKeysym(keyString string) uint64

func XSync

func XSync(display *Display)

func XTestFakeButtonEvent

func XTestFakeButtonEvent(display *Display, keycode uint, eventType int, delay int)

func XTestFakeMotionEvent

func XTestFakeMotionEvent(display *Display, screen int, x, y int, delay uint64)

func XTestFakeRelativeMotionEvent

func XTestFakeRelativeMotionEvent(display *Display, x, y int, delay uint64)

func XTestGrabControl

func XTestGrabControl(display *Display, onOff int)

Types

type AESCrypto

type AESCrypto struct {
	Key AESKey
}

func (*AESCrypto) CreateEncodedSecret

func (aesCrypto *AESCrypto) CreateEncodedSecret(password Secret) Secret

func (*AESCrypto) Decrypt

func (aesCrypto *AESCrypto) Decrypt(encryptedMsg []byte) Message

func (*AESCrypto) Encrypt

func (aesCrypto *AESCrypto) Encrypt(msg Message) []byte

func (*AESCrypto) ReadSecret

func (aesCrypto *AESCrypto) ReadSecret(encodedPwd Secret)

type AESKey

type AESKey []byte

type Address

type Address string

func BytesToAddress

func BytesToAddress(addressBytes [4]byte) Address

type Device

type Device string

type Display

type Display C.Display

func XOpenDisplay

func XOpenDisplay() *Display

type EncryptionType

type EncryptionType byte
const (
	AES EncryptionType = iota
	RSA
)

type Event

type Event byte
const (
	ButtonDown Event = iota
	ButtonUp
	ButtonClick
	MouseRelativeMove
	MouseAbsoluteMove
	MouseWheelScrollUp
	MouseWheelScrollDown
	ServiceInit
	ServiceHeartBeat
)

type EventEntity

type EventEntity byte
const (
	MouseLeftButton EventEntity = iota
	MouseRightButton
	MouseMiddleButton
	MouseOptButton1
	MouseOptButton2
	MouseWheel
	MouseCursor
	KeyVolumeMute
	KeyVolumeUp
	KeyVolumeDown
	KeyMediaStop
	KeyMediaPause
	KeyMediaNext
	KeyMediaPrevious
	KeyEsc
	KeyWinCmd
	KeyLWinCmd
	KeyRWinCmd
	KeyAlt
	KeyLAlt
	KeyRAlt
	KeyCtrl
	KeyLCtrl
	KeyRCtrl
	KeyShift
	KeyLShift
	KeyRShift
	KeyTab
	KeyCaps
	KeyAltGr
	KeyEnter
	KeySpace
	KeyBackspace
	KeyDelete
	KeyArrowUp
	KeyArrowDown
	KeyArrowLeft
	KeyArrowRight
	KeyInsert
	KeyPrintScreen
	KeyScrollLock
	KeyPause
	KeyHome
	KeyEnd
	KeyPageUp
	KeyPageDown
	KeyF1
	KeyF2
	KeyF3
	KeyF4
	KeyF5
	KeyF6
	KeyF7
	KeyF8
	KeyF9
	KeyF10
	KeyF11
	KeyF12
	KeyTilde
	Key0
	Key1
	Key2
	Key3
	Key4
	Key5
	Key6
	Key7
	Key8
	Key9
	KeyA
	KeyB
	KeyC
	KeyD
	KeyE
	KeyF
	KeyG
	KeyH
	KeyI
	KeyJ
	KeyK
	KeyL
	KeyM
	KeyN
	KeyO
	KeyP
	KeyQ
	KeyR
	KeyS
	KeyT
	KeyU
	KeyV
	KeyW
	KeyX
	KeyY
	KeyZ
	KeyLeftBracket
	KeyBackSlash
	KeyRightBracket
	KeyMinus
	KeyEqual
	KeyApostrophe
	KeySemicolon
	KeyComma
	KeyPeriod
	KeySlash
	KeyNumLock
	KeyNumPad0
	KeyNumPad1
	KeyNumPad2
	KeyNumPad3
	KeyNumPad4
	KeyNumPad5
	KeyNumPad6
	KeyNumPad7
	KeyNumPad8
	KeyNumPad9
	KeyNumPadEnter
	KeyNumPadMul
	KeyNumPadDiv
	KeyNumPadAdd
	KeyNumPadSub
	KeyNumPadDecimal
	Client
	Server
)

ISO keyboard layout is implemented for now

type Input

type Input struct {
	Display *Display
	// contains filtered or unexported fields
}

func (*Input) ButtonAction

func (input *Input) ButtonAction(button EventEntity, event Event)

func (*Input) GetCursorPos

func (input *Input) GetCursorPos() (int, int)

func (*Input) Init

func (input *Input) Init()

func (*Input) InputFromClient

func (input *Input) InputFromClient(message Message)

func (*Input) KeyboardButtonAction

func (input *Input) KeyboardButtonAction(button EventEntity, event Event)

func (*Input) MouseButtonAction

func (input *Input) MouseButtonAction(button EventEntity, event Event)

func (*Input) MouseMove

func (input *Input) MouseMove(x, y int)

func (*Input) MouseScroll

func (input *Input) MouseScroll(lines int)

func (*Input) SetCursorPos

func (input *Input) SetCursorPos(x, y int) uintptr

type InternalMsg

type InternalMsg struct {
	EventEntity EventEntity
	Event       Event
	ExtraInfo   [4]int
}

type Message

type Message struct {
	SenderAddress    [4]byte
	SenderId         string
	SenderPlatform   Platform
	ReceiverAddress  [4]byte
	ReceiverId       string
	ReceiverPlatform Platform
	Event            Event
	EventEntity      EventEntity
	ExtraInfo        [4]int
}

func DecodeMessage

func DecodeMessage(msg []byte) Message

type Output

type Output struct {
	Com chan InternalMsg
	// contains filtered or unexported fields
}

func (*Output) Init

func (output *Output) Init()

func (*Output) OutputToServer

func (output *Output) OutputToServer()

type Platform

type Platform int
const (
	Linux Platform = iota
	Windows
	Darwin
)

type RSACrypto

type RSACrypto struct {
	PublicKeyComment string

	TargetPublicKey RSAPubKey
	// contains filtered or unexported fields
}

func (*RSACrypto) CreateEncodedSecret

func (rsaCrypto *RSACrypto) CreateEncodedSecret()

func (*RSACrypto) DecodeMessage

func (rsaCrypto *RSACrypto) DecodeMessage(encodedMsg []byte, signiture []byte) Message

func (*RSACrypto) Decrypt

func (rsaCrypto *RSACrypto) Decrypt(msg []byte) Message

func (*RSACrypto) EncodeMessage

func (rsaCrypto *RSACrypto) EncodeMessage(msg Message) ([]byte, []byte)

func (*RSACrypto) Encrypt

func (rsaCrypto *RSACrypto) Encrypt(msg Message) []byte

func (*RSACrypto) ReadSecret

func (rsaCrypto *RSACrypto) ReadSecret(publicKeyPath string, privateKeyPath string)

type RSAPriKey

type RSAPriKey rsa.PrivateKey

type RSAPubKey

type RSAPubKey rsa.PublicKey

type Screen

type Screen C.Screen

type Secret

type Secret string

type Window

type Window C.Window

func XDefaultRootWindow

func XDefaultRootWindow(display *Display) Window

type XEvent

type XEvent C.XEvent

Jump to

Keyboard shortcuts

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