common

package module
v0.0.0-...-c2fc5db Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgIDSenderInitRequest          = "SenderInitRequest"
	MsgIDSenderInitReply            = "SenderInitReply"
	MsgIDSenderNewReceiverConnected = "SenderNewReceiverConnected"
	MsgIDReceiverInitRequest        = "ReceiverInitRequest"
	MsgIDReceiverInitReply          = "ReceiverInitReply"
	MsgIDWrite                      = "Write"
	MsgIDWinSize                    = "WinSize"
)

Variables

View Source
var WholeList map[string]HostList

WholeList = list of all hosts list

Functions

func Init

func Init()

Init list

func LoadAll

func LoadAll(folder string)

LoadAll loads all json hosts files in a folder

func MarshalAndWriteMsg

func MarshalAndWriteMsg(writer io.Writer, aMessage interface{}) (err error)

func MarshalMsg

func MarshalMsg(aMessage interface{}) (_ []byte, err error)

func ReadAndUnmarshalMsg

func ReadAndUnmarshalMsg(reader io.Reader, aMessage interface{}) (err error)

func SaveAll

func SaveAll(list HostList, folder string)

SaveAll to json filme

func SaveList

func SaveList(list HostList, filename string)

SaveList to json filme

func UpdateFromEsx

func UpdateFromEsx(list HostList)

UpdateFromEsx from esx glpi scan, load all files

Types

type Host

type Host struct {
	Name    string `json:"name"`
	Connect struct {
		Service     string `json:"service"`
		Address     string `json:"address"`
		Port        int    `json:"port"`
		Credentials struct {
			Key      string `json:"key,omitempty"`
			Login    string `json:"login,omitempty"`
			Password string `json:"password,omitempty"`
		} `json:"credentials"`
	} `json:"connect"`
	Type        string   `json:"type"`
	Parent      string   `json:"parent"`
	Os          string   `json:"os"`
	Ips         []string `json:"ips"`
	Comment     string   `json:"comment"`
	Project     string   `json:"project"`
	Domain      string   `json:"domain"`
	Status      string   `json:"status"`
	Ignore      bool     `json:"ignore"`
	Activeusers []string `json:"activeusers"`
	CPU         struct {
		Type  string `json:"type"`
		Count int    `json:"count"`
	} `json:"cpu"`
	RAM   string `json:"ram"`
	Disks []struct {
		Type     string `json:"type"`
		Capacity string `json:"capacity"`
	} `json:"disks"`
	Ports      []int `json:"ports"`
	Containers []struct {
		Name     string   `json:"name"`
		Services []string `json:"services"`
		Ports    []int    `json:"ports"`
	} `json:"containers"`
	Crontabs []struct {
		User      string `json:"user"`
		Frequency string `json:"frequency"`
		Script    string `json:"script"`
	} `json:"crontabs"`
	Firewall    string `json:"firewall"`
	Lastconnect string `json:"lastconnect"`
}

Host desc

type HostList

type HostList struct {
	Name   string `json:"name"`
	Domain string `json:"domain"`
	Hosts  []Host `json:"hosts"`
}

HostList is holding hosts list

func LoadSingleFile

func LoadSingleFile(filename string) HostList

LoadSingleFile from json file

type MsgAll

type MsgAll struct {
	Type ProtocolMessageIDType
	Data []byte
}

Message used to encapsulate the rest of the bessages bellow

type MsgTTYReceiverInitReply

type MsgTTYReceiverInitReply struct {
}

type MsgTTYReceiverInitRequest

type MsgTTYReceiverInitRequest struct {
	ChallengeReply string
}

type MsgTTYSenderInitReply

type MsgTTYSenderInitReply struct {
	ReceiverURLWebReadWrite string
}

type MsgTTYSenderInitRequest

type MsgTTYSenderInitRequest struct {
	Salt              string
	PasswordVerifierA string
	Source            RemoteEnvInfo
}

These messages are used between the server and the sender/receiver

type MsgTTYSenderNewReceiverConnected

type MsgTTYSenderNewReceiverConnected struct {
	Name string
}

type MsgTTYWinSize

type MsgTTYWinSize struct {
	Cols int
	Rows int
}

type MsgTTYWrite

type MsgTTYWrite struct {
	Data []byte
	Size int
}

These messages are not intended for the server, so they are just forwarded by it to the remote side.

type ProtocolMessageIDType

type ProtocolMessageIDType string

type ReceiverSessionInfo

type ReceiverSessionInfo struct {
}

type RemoteEnvInfo

type RemoteEnvInfo struct {
	Username string
	Hostname string
	Os       string
	Ip       string
	Cpu      string
	Cores    string
	Ram      string
	Disk     string
}

type SenderSessionInfo

type SenderSessionInfo struct {
	Salt              string
	PasswordVerifierA string
	Source            RemoteEnvInfo
}

type ServerSessionInfo

type ServerSessionInfo struct {
	URLWebReadWrite string
}

type TTYProtocolConn

type TTYProtocolConn struct {
	// contains filtered or unexported fields
}

TTYProtocolConn is the interface used to communicate with the sending (master) side of the TTY session

func NewTTYProtocolConn

func NewTTYProtocolConn(conn io.ReadWriteCloser) *TTYProtocolConn

func (*TTYProtocolConn) Close

func (protoConn *TTYProtocolConn) Close() error

func (*TTYProtocolConn) InitReceiverServerConn

func (protoConn *TTYProtocolConn) InitReceiverServerConn(receiverInfo ReceiverSessionInfo) (serverInfo ServerSessionInfo, err error)

func (*TTYProtocolConn) InitSender

func (protoConn *TTYProtocolConn) InitSender(senderInfo SenderSessionInfo) (serverInfo ServerSessionInfo, err error)

Function to be called on the sender side, and which blocks until the protocol has been initialised

func (*TTYProtocolConn) InitServer

func (protoConn *TTYProtocolConn) InitServer(serverInfo ServerSessionInfo) (senderInfo SenderSessionInfo, err error)

func (*TTYProtocolConn) InitServerReceiverConn

func (protoConn *TTYProtocolConn) InitServerReceiverConn(serverInfo ServerSessionInfo) (receiverInfo ReceiverSessionInfo, err error)

func (*TTYProtocolConn) ReadMessage

func (protoConn *TTYProtocolConn) ReadMessage() (msg MsgAll, err error)

func (*TTYProtocolConn) SetWinSize

func (protoConn *TTYProtocolConn) SetWinSize(cols, rows int) error

func (*TTYProtocolConn) Write

func (protoConn *TTYProtocolConn) Write(buff []byte) (int, error)

Function to send data from one the sender to the server and the other way around.

func (*TTYProtocolConn) WriteRawData

func (protoConn *TTYProtocolConn) WriteRawData(buff []byte) (int, error)

Jump to

Keyboard shortcuts

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