model

package
v0.0.0-...-dbf2142 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Games  []Game `json:"games" msgpack:"games"`
	System System `json:"system" msgpack:"system"`
}

type Edge

type Edge struct {
	To     string
	Weight float64
}

Edge represents an edge in the graph.

type FixedConfig

type FixedConfig struct {
	SuperAdminPubKey string   `json:"super_admin_pub_key" msgpack:"super_admin_pub_key"`
	ConfigPath       string   `json:"config_path" msgpack:"config_path"`
	DataPath         string   `json:"data_path" msgpack:"data_path"`
	BoostrapNodes    []string `json:"bootstrap_nodes" msgpack:"bootstrap_nodes"`
	Port             uint     `json:"port" msgpack:"port"`
}

type Game

type Game struct {
	ID                string           `json:"id" msgpack:"id"`
	Protocol          string           `json:"protocol" msgpack:"protocol"`
	Host              string           `json:"host" msgpack:"host"`
	Port              uint64           `json:"port" msgpack:"port"`
	ListenPort        uint64           `json:"listen_port" msgpack:"listen_port"`
	ExitNode          WhiteOrBlackList `json:"exit_node" msgpack:"exit_node"`
	EntryNode         WhiteOrBlackList `json:"entry_node" msgpack:"entry_node"`
	SpeedTestProtocol string           `json:"speed_test_protocol" msgpack:"speed_test_protocol"`
}

type Graph

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

Graph represents a graph with an adjacency list.

func NewGraph

func NewGraph() *Graph

NewGraph creates a new graph.

func (*Graph) AddBidirectionalEdge

func (g *Graph) AddBidirectionalEdge(from, to string, weight float64)

func (*Graph) AddEdge

func (g *Graph) AddEdge(from, to string, weight float64)

AddEdge adds or updates an edge to the graph.

func (*Graph) Flush

func (g *Graph) Flush()

func (*Graph) IterateEdges

func (g *Graph) IterateEdges(from string) []string

func (*Graph) Print

func (g *Graph) Print() string

func (*Graph) PrintRoutes

func (g *Graph) PrintRoutes(start string, end string) string

func (*Graph) RemoveBidirectionalEdge

func (g *Graph) RemoveBidirectionalEdge(from, to string)

func (*Graph) RemoveEdge

func (g *Graph) RemoveEdge(from, to string)

RemoveEdge removes an edge from the graph.

func (*Graph) RemoveNode

func (g *Graph) RemoveNode(node string)

RemoveNode removes a node and all its associated edges from the graph.

func (*Graph) ShortestPath

func (g *Graph) ShortestPath(start, target string) ([]string, float64)

type Item

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

Define a structure for items in the priority queue

type Latencies

type Latencies map[string]float64

type Node

type Node struct {
	Host                 host.Host
	Router               *dht.IpfsDHT
	CTX                  context.Context
	Store                *dbstore.Datastore
	PubSub               *pubsub.PubSub
	Config               *Config
	FixedConfig          *FixedConfig
	FlushConfigCallbacks []func(Config) error
	BootstrapNodesCheck  map[peer.ID]struct{}
}

type PriorityQueue

type PriorityQueue []*Item

A PriorityQueue implements heap.Interface and holds Items.

func (PriorityQueue) Len

func (pq PriorityQueue) Len() int

func (PriorityQueue) Less

func (pq PriorityQueue) Less(i, j int) bool

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() interface{}

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{})

func (PriorityQueue) Swap

func (pq PriorityQueue) Swap(i, j int)

type SignedConfig

type SignedConfig struct {
	Config Config `json:"config" msgpack:"config"`
	Sign   string `json:"sign" msgpack:"sign"`
}

type System

type System struct {
	ListenHost string `json:"listen_host" msgpack:"listen_host"`
}

type WhiteOrBlackList

type WhiteOrBlackList struct {
	Type      string   `json:"type" msgpack:"type"`
	WhiteList []string `json:"white_list" msgpack:"white_list"`
	BlackList []string `json:"black_list" msgpack:"black_list"`
}

Jump to

Keyboard shortcuts

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