Version: v0.0.0-...-6d29b5c Latest Latest

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

Go to latest
Published: Mar 30, 2020 License: MIT Imports: 7 Imported by: 0




View Source
const Nsd int = 2
View Source
const Ntd int = 2
View Source
const RouterCacheSize int = 50
View Source
const Wts int = 100
View Source
const Wtsd int = 2
View Source
const Wtt int = 100

Constants used in the stub-generation algorithm:

Wtt  = avg. weight of transit-transit connections
Wttd = Wtt delta, that is the weight is in [Wtt - Wttd, Wtt + Wttd]

Ntd     = nodes transit domain delta (see Wttd)
minNt   = minimum number of nodes in transit domain
edgeNtf = edge factor for a transit domain, that is the number of edges
  is f * N log N

minLatency = minimum latency for intra-domain connections
maxLatency = maximum latency for intra-domain connections

Nsd     = ...
minNs   = ...
edgeNsf = ...

mhsp = percent of multi-home stub *connections*

The constant values are currently arbirary, but they can be chosen to respect
the invariants in the paper.
View Source
const Wttd int = 2


This section is empty.


This section is empty.


type Cache

type Cache interface {
	Put(key, value interface{})
	Get(key interface{}) (interface{}, bool)

type Connection

type Connection interface {
	Latency() int
	Router() Router

func NewStaticConnection

func NewStaticConnection(latency int, router Router) Connection

type LRUCache

type LRUCache struct {
	// contains filtered or unexported fields

A Cache using the Least Recently Used policy. It is implemented by using a list and a map pointing to list elements.

func NewLRUCache

func NewLRUCache(size int) (*LRUCache, error)

func (*LRUCache) Get

func (c *LRUCache) Get(key interface{}) (interface{}, bool)

func (*LRUCache) Put

func (c *LRUCache) Put(key, value interface{})

type Network

type Network struct {
	Routers []Router
	// contains filtered or unexported fields

func NewInternetwork

func NewInternetwork(T, Nt, S, Ns int) *Network

Generates a 2-level transit-stub topology following the paper: Zegura E., Calvert K. and Bhattacharjee S. How to model an internetwork. In INFOCOM’96 (1996)

T  = number of tranasit domains
Nt = avg. nodes per transit domain
S  = number of stub domains
Ns = avg. nodes per stub domain

The transit domains represent the backbone, whereas a stub is attached to a
node in the backbone.

The graph is generated as follows:
1. Generate transit domain graph
2. Generate graph from tranasit domain
3. Add stubs
4. Generate multi-homed stubs

func NewRandomUniformNetwork

func NewRandomUniformNetwork(nodes, edges, minLatency, maxLatency int) *Network
Generates a connected graph.

Reference: http://economics.mit.edu/files/4622

func (*Network) RandomRouter

func (n *Network) RandomRouter() Router

type NetworkSimulation

type NetworkSimulation struct {
	// contains filtered or unexported fields

A NetworkSimulation is a Simulation with a Network attached.

func NewNetworkSimulation

func NewNetworkSimulation(s *Simulation, n *Network) *NetworkSimulation

func (*NetworkSimulation) Network

func (s *NetworkSimulation) Network() *Network

func (*NetworkSimulation) SendPacket

func (s *NetworkSimulation) SendPacket(p Packet)

type Packet

type Packet interface {
	Src() Router
	Dest() Router
	Payload() interface{}

func NewPacket

func NewPacket(src, dest Router, payload interface{}) Packet

type Router

type Router interface {

	Connect(Connection) error
	Connections() []Connection

	Domain() string

A Router is a Receiver which schedules new events at other routers according to a routing algorithm. We use the Bellman-Ford alogrithm to determine the shortest paths.

func NewShortestPathRouter

func NewShortestPathRouter(domain string) Router

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL