models

package
v0.0.0-...-7efe5ce Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2019 License: GPL-3.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DEFAULT_TIMEOUT     = 3
	UDP_DIAGRAM_VERSION = 1
)

Functions

This section is empty.

Types

type CallbackParams

type CallbackParams struct {
	RemoteAddr net.Addr
	Diagram    IDiagram
	Data       []byte
}

func (CallbackParams) GetData

func (c CallbackParams) GetData() []byte

func (CallbackParams) GetDiagram

func (c CallbackParams) GetDiagram() IDiagram

func (CallbackParams) GetRemoteAddr

func (c CallbackParams) GetRemoteAddr() net.Addr

type ICallbackParams

type ICallbackParams interface {
	GetRemoteAddr() net.Addr
	GetDiagram() IDiagram
	GetData() []byte
}

type IDashboardProvider

type IDashboardProvider interface {
	DashboardData() interface{} // [][]string for table, []string for list
	DashboardType() string
	DashboardTitle() string
	DashboardTableHasColumnTitles() bool
}

type IDiagram

type IDiagram interface {
	GetID() string
	GetNodeID() string
	GetTimestamp() int64
	GetDCategory() string
	GetDType() string
	GetVersion() int
}

type INetwork

type INetwork interface {
	RemoveCallback(category string)
	RegisterCallback(category string, callback func(ICallbackParams))
	Send(ip net.IP, port int, bytes []byte, nodeId string)
	Start()
}

type INodeProvider

type INodeProvider interface {
	PeekNodes() []*node.RemoteNode

	// Get nodes by distance limited with <param>max</param>
	GetNearbyNodes(max int) []*node.RemoteNode
	GetLocalNode() *node.LocalNode
	Start()
}

type ISyncProvider

type ISyncProvider interface {
	SendSyncRequest(network INetwork, localNode *node.LocalNode, remoteNode *node.RemoteNode) bool
}

type NetworkDiagram

type NetworkDiagram struct {
	ID        string
	NodeID    string
	Timestamp int64
	DCategory string
	DType     string
	Version   int
}

func (NetworkDiagram) GetDCategory

func (d NetworkDiagram) GetDCategory() string

func (NetworkDiagram) GetDType

func (d NetworkDiagram) GetDType() string

func (NetworkDiagram) GetID

func (d NetworkDiagram) GetID() string

func (NetworkDiagram) GetNodeID

func (d NetworkDiagram) GetNodeID() string

func (NetworkDiagram) GetTimestamp

func (d NetworkDiagram) GetTimestamp() int64

func (NetworkDiagram) GetVersion

func (d NetworkDiagram) GetVersion() int

type SyncStrategy

type SyncStrategy int
const (
	SYNC_STRATEGY_CLOSER SyncStrategy = iota
	SYNC_STRATEGY_ALL
)

type SyncType

type SyncType int
const (
	SYNC_TYPE_BLOCK SyncType = iota
	SYNC_TYPE_FILE
	SYNC_TYPE_CONFIG
	SYNC_TYPE_RAW
)

type TCPDiagram

type TCPDiagram struct {
	NetworkDiagram
}

func NewTCPDiagram

func NewTCPDiagram() *TCPDiagram

type UDPCallbackParams

type UDPCallbackParams struct {
	CallbackParams
}

func (UDPCallbackParams) GetUDPDiagram

func (u UDPCallbackParams) GetUDPDiagram() UDPDiagram

func (UDPCallbackParams) GetUDPRemoteAddr

func (u UDPCallbackParams) GetUDPRemoteAddr() *net.UDPAddr

type UDPDiagram

type UDPDiagram struct {
	NetworkDiagram
	Expire    int64
	LocalAddr string
	LocalPort int
}

Jump to

Keyboard shortcuts

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