config

package
v0.0.0-...-1364d92 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const AllNodesRun string = "AllNodesRun"
View Source
const Backlog string = "Backlog"
View Source
const Bias string = "Bias"
View Source
const ChokerStrategy string = "ChokerStrategy"
View Source
const InPeers string = "InPeers"
View Source
const Interval string = "Interval"
View Source
const LeaderPercent string = "LeaderPercent"
View Source
const MinNodes string = "MinNodes"
View Source
const Multi string = "Multi"
View Source
const Optimistics string = "Optimistics"
View Source
const OutPeers string = "OutPeers"

*

  • Constant values to pass to "config.NewConst".
View Source
const PieceSize string = "PieceSize"
View Source
const Pieces string = "Pieces"
View Source
const Random string = "Random"
View Source
const Seeds string = "Seeds"
View Source
const StoragePieces string = "StoragePieces"
View Source
const TitForTat string = "TitForTat"

Choker strategies

View Source
const Uploads string = "Uploads"

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	// BitTorrent
	OutPeers int `json:"outPeers"` // maximum number of outbound peers
	InPeers  int `json:"inPeers"`  // maximum number of inbound peers

	MinNodes int `json:"minNodes"` // minimum number of nodes in a Torrent
	Seeds    int `json:"seeds"`    // number of seed nodes

	PieceSize int `json:"pieceSize"` // the piece size
	Pieces    int `json:"pieces"`    // number of pieces in a Torrent

	Uploads int `json:"uploads"` // number of Uploads (without Optimistics)
	//   chosen by a Choker
	Optimistics int `json:"optimistics"` // number of Optimistics
	//   chosen by a Choker
	Interval int `json:"interval"` // milliseconds

	Backlog int `json:"backlog"` // number of pieces requested at a time

	// Extension
	LeaderPercent int `json:"leaderPercent"` // the percent of leaders in an AS

	// Biased Tracker extension
	Bias int `json:"bias"` // the number of connections to peers in different AS

	// Misc
	SharedCallback func()
	SharedInit     func()

	// Simulation parameters
	TransitDomains    int `json:"transitDomains"`
	TransitDomainSize int `json:"transitDomainSize"`
	StubDomains       int `json:"stubDomains"`
	StubDomainSize    int `json:"stubDomainSize"`

	TransferInterval int `json:"transferInterval"`

	CapacityNodes []NodeConf `json:"capacityNodes"`

	// Progress properties
	AllNodesRun         *WGProgress
	AllNodesRunInterval int `json:allNodesRunInterval`

	// Latency support
	Latency bool

	// Run the simulator's event queue with support for parallel events.
	Parallel bool

	// Multi-Torrent extension
	Multi         int
	StoragePieces int

	// Choker strategy(e.g. TitForTat, Random)
	ChokerStrategy string
}
var Config *Conf

func JSONConfig

func JSONConfig(path string) *Conf

func (*Conf) WithParams

func (c *Conf) WithParams(f func(c *Conf)) *Conf

Usage:

c := NewConf().
  WithParams(func(c *Conf) {
    c.OutPeers = 5
    c.MinNodes = 10
  })

type Const

type Const interface {
	Ref() interface{}
	Int() int
	String() string
}

func NewConst

func NewConst(field string) Const

*

  • Usage:
  • var c config.Const = config.NewConst(config.OutPeers)

type NodeConf

type NodeConf struct {
	Number   int `json:"number"`
	Upload   int `json:"upload"`
	Download int `json:"download"`
}

type WGProgress

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

func NewWGProgress

func NewWGProgress(start int) *WGProgress

func (*WGProgress) Add

func (p *WGProgress) Add()

func (*WGProgress) Advance

func (p *WGProgress) Advance()

func (*WGProgress) Progress

func (p *WGProgress) Progress(id string)

Jump to

Keyboard shortcuts

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