path

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const EgHeaderLen = 4

Variables

This section is empty.

Functions

func ParseDistanceMatrix added in v0.3.3

func ParseDistanceMatrix(input string) ([]mtypes.PongMsg, error)

func Solve

func Solve(filePath string, pe bool) error

Types

type ByDuration

type ByDuration []time.Duration

func (ByDuration) Len

func (a ByDuration) Len() int

func (ByDuration) Less

func (a ByDuration) Less(i, j int) bool

func (ByDuration) Swap

func (a ByDuration) Swap(i, j int)

type EgHeader

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

func NewEgHeader

func NewEgHeader(pac []byte, mtu uint16) (e EgHeader, err error)

func (EgHeader) GetDst

func (e EgHeader) GetDst() mtypes.Vertex

func (EgHeader) GetSrc

func (e EgHeader) GetSrc() mtypes.Vertex

func (EgHeader) SetDst

func (e EgHeader) SetDst(node_ID mtypes.Vertex)

func (EgHeader) SetSrc

func (e EgHeader) SetSrc(node_ID mtypes.Vertex)

type Fullroute

type Fullroute struct {
	Next mtypes.NextHopTable `yaml:"NextHopTable"`
	Dist mtypes.DistTable    `yaml:"DistanceTable"`
}

type IG

type IG struct {
	Vert map[mtypes.Vertex]bool

	SuperNodeInfoTimeout time.Duration
	RecalculateCoolDown  time.Duration
	TimeoutCheckInterval time.Duration

	NhTableExpire time.Time
	IsSuperMode   bool
	// contains filtered or unexported fields
}

IG is a graph of integers that satisfies the Graph interface.

func NewGraph

func NewGraph(num_node int, IsSuperMode bool, theconfig mtypes.GraphRecalculateSetting, ntpinfo mtypes.NTPInfo, loglevel mtypes.LoggerInfo) (*IG, error)

func (*IG) CheckAnyShouldUpdate

func (g *IG) CheckAnyShouldUpdate(withCooldown bool) bool

func (*IG) FloydWarshall

func (g *IG) FloydWarshall(again bool) (dist mtypes.DistTable, next mtypes.NextHopTable, err error)

func (*IG) GetBoardcastList

func (g *IG) GetBoardcastList(id mtypes.Vertex) (tosend map[mtypes.Vertex]bool)

func (*IG) GetBoardcastThroughList

func (g *IG) GetBoardcastThroughList(self_id mtypes.Vertex, in_id mtypes.Vertex, src_id mtypes.Vertex) (tosend map[mtypes.Vertex]bool, errs []error)

func (*IG) GetCurrentTime

func (g *IG) GetCurrentTime() time.Time

func (*IG) GetDtst

func (g *IG) GetDtst() mtypes.DistTable

func (*IG) GetEdges

func (g *IG) GetEdges(isOld bool, withAC bool) (edges map[mtypes.Vertex]map[mtypes.Vertex]float64)

func (*IG) GetNHTable

func (g *IG) GetNHTable(recalculate bool) mtypes.NextHopTable

func (*IG) GetWeightType

func (g *IG) GetWeightType(x float64) (y float64)

func (*IG) InitNTP

func (g *IG) InitNTP()

func (*IG) Neighbors

func (g *IG) Neighbors(v mtypes.Vertex) (vs []mtypes.Vertex)

func (*IG) Next

func (g *IG) Next(u, v mtypes.Vertex) mtypes.Vertex

func (*IG) OldWeight

func (g *IG) OldWeight(u, v mtypes.Vertex, withAC bool) (ret float64)

func (*IG) Path added in v0.3.3

func (g *IG) Path(u, v mtypes.Vertex) (path []mtypes.Vertex, err error)

func (*IG) RecalculateNhTable

func (g *IG) RecalculateNhTable(checkchange bool) (changed bool)

func (*IG) RemoveAllNegativeValue

func (g *IG) RemoveAllNegativeValue()

func (*IG) RemoveVirt

func (g *IG) RemoveVirt(v mtypes.Vertex, recalculate bool, checkchange bool) (changed bool)

func (*IG) RoutineSyncTime

func (g *IG) RoutineSyncTime()

func (*IG) SetNHTable

func (g *IG) SetNHTable(nh mtypes.NextHopTable)

func (*IG) SetOldWeight

func (g *IG) SetOldWeight(u, v mtypes.Vertex, weight float64)

func (*IG) SetWeight

func (g *IG) SetWeight(u, v mtypes.Vertex, weight float64)

func (*IG) ShouldUpdate

func (g *IG) ShouldUpdate(oldval float64, newval float64, withCooldown bool) bool

func (*IG) SyncTime

func (g *IG) SyncTime(url string, timeout time.Duration)

func (*IG) SyncTimeMultiple

func (g *IG) SyncTimeMultiple(count int)

func (*IG) UpdateLatency

func (g *IG) UpdateLatency(src mtypes.Vertex, dst mtypes.Vertex, val float64, TimeToAlive float64, SuperAdditionalCost float64, recalculate bool, checkchange bool) (changed bool)

func (*IG) UpdateLatencyMulti

func (g *IG) UpdateLatencyMulti(pong_info []mtypes.PongMsg, recalculate bool, checkchange bool) (changed bool)

func (*IG) Vertices

func (g *IG) Vertices() map[mtypes.Vertex]bool

func (*IG) Weight

func (g *IG) Weight(u, v mtypes.Vertex, withAC bool) (ret float64)

type Latency

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

type Usage

type Usage uint8
const (
	MessageInitiationType Usage = iota
	MessageResponseType
	MessageCookieReplyType
	MessageTransportType

	NormalPacket

	Register     //Send to server
	ServerUpdate //Comes from server

	PingPacket //Comes from other peer
	PongPacket //Send to everyone, include server
	QueryPeer
	BroadcastPeer
)

func (Usage) IsControl added in v0.3.3

func (v Usage) IsControl() bool

func (Usage) IsControl_Edge2Edge added in v0.3.3

func (v Usage) IsControl_Edge2Edge() bool

func (Usage) IsControl_Edge2Super added in v0.3.3

func (v Usage) IsControl_Edge2Super() bool

func (Usage) IsControl_Super2Edge added in v0.3.3

func (v Usage) IsControl_Super2Edge() bool

func (Usage) IsNormal added in v0.3.3

func (v Usage) IsNormal() bool

func (Usage) IsValid_EgType added in v0.3.5

func (v Usage) IsValid_EgType() bool

func (Usage) ToString added in v0.3.5

func (v Usage) ToString() string

Jump to

Keyboard shortcuts

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