ipc

package
v0.0.0-...-6175fdf Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: MIT Imports: 12 Imported by: 0

README

HOW TO RUN TEST PROGRAM ON AZURE

1. ssh into drone1:

Username: drone1 Password: dronedrone01

[COMMAND:]
ssh drone1@20.36.20.142

-----------------------------------------------------

2. ssh into drone2:

This is just to make sure drone2 is alive

Username: drone2 Password: dronedrone02

[COMMAND:]
ssh drone2@20.190.48.49

-----------------------------------------------------

3. Kill any ongoing hiv process on drone2

This will remove any process that is using our :6464 port.

[COMMAND:]
fuser 6464/tcp
kill -s 9 <process id>

-----------------------------------------------------

4. If not touched, code should be already there on drone 1's proj2 directory.

The pi_hivemind.go is the attempt for a remote version of pi.go.
The simple_program_remote is a remote version of simpledsm.go.

[COMMAND:]
go run pi_hivemind.go

[COMMAND:]
go run simple_program_remote.go

[NOTE:]
Make sure the config.json has the following information (for running with 2 drones only)
{
    "IsCBM": true,
    "Drones": [
        {
            "Address": "20.190.48.49",
            "Port": "",
            "Username": "drone2",
            "Password": "DroneDrone02"
        }
    ],
    "CBM": "20.36.20.142",
    "DroneList": null
}

-----------------------------------------------------

5. On drone2, check the log

[COMMAND:]
cd /tmp/hivemind
cat run.log

Documentation

Overview

Package hivemind implements the TreadMarks API.

This file contains the implementation of the inter-processor messaging layer. This implements a fast, reliable point-to-point communications between this node and all other nodes in the DSM

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOutboundIP

func GetOutboundIP() string

https://gist.github.com/jniltinho/9788121 function to get the public ip address we assume we are connected to external internet

func GetOutboundIPKvm

func GetOutboundIPKvm() string

GetOutboundIPKvm Function to grab outbound IP for use with KVM system

func HandleIncomingCBMConnection

func HandleIncomingCBMConnection(conn net.Conn)

Handler for incoming drone connection to CBM

func StartCBMServer

func StartCBMServer() (string, error)

Listen for TCP connections from other drones to CBM

func StartNodes

func StartNodes(inList []configs.DroneManagerConfig) (int, []configs.DroneConfig, error)

given a list of IP address, start drones on each machine also requires username:password for ssh password as hardcoded string is bad for security, but acceptable for project purposes returns number of drones successfully started returns a mapping of drone addresses to pid

Types

type Ipc

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

Ipc structure defines the properties of an Ipc instance

func Init

func Init(inList []configs.DroneConfig, cbm string) (ipcHandle Ipc, txchan chan []byte, rxchan chan []byte)

TODO return con object too

type IpcArgs

type IpcArgs struct {
	VC       []uint
	Interval int
	PageID   int
	DiffID   int
	Diff     int
	PageCopy int
	Copyset  int
}

Temporary all ints, please modify to the type you needed when use

type IpcMessage

type IpcMessage struct {
	MessageId int
	SourceId  int
	DestId    int
	Args      IpcArgs
}

type Peer

type Peer struct {
	Conn    net.Conn
	Address string
	Pid     uint8
}

type PeerMap

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

func InitPeerMap

func InitPeerMap() PeerMap

Initialize PeerMap

func (*PeerMap) AddPeer

func (pm *PeerMap) AddPeer(pid uint8, peer Peer)

Add peer and its connection to map

func (*PeerMap) DeepCopy

func (pm *PeerMap) DeepCopy() PeerMap

Return a copy of PeerMap Useful for iteration

func (*PeerMap) GetPeer

func (pm *PeerMap) GetPeer(pid uint8) (Peer, bool)

Return peer, and its existence

func (*PeerMap) GetPeerConn

func (pm *PeerMap) GetPeerConn(pid uint8) (net.Conn, bool)

Return conn of peer, and its existence

func (*PeerMap) Initialize

func (pm *PeerMap) Initialize()

Initialize components of PeerMap

func (*PeerMap) KeyList

func (pm *PeerMap) KeyList() []uint8

returns all the keys useful for iteration

func (*PeerMap) NumPeers

func (pm *PeerMap) NumPeers() int

Number of peers (might be handy)

func (*PeerMap) RemovePeer

func (pm *PeerMap) RemovePeer(pid uint8)

Remove peer and its connection from map

Jump to

Keyboard shortcuts

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