params

package
v1.0.62 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: GPL-3.0 Imports: 3 Imported by: 5

Documentation

Overview

Copyright 2020 The CortexTheseus Authors This file is part of the CortexTheseus library.

The CortexTheseus library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The CortexTheseus library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the CortexTheseus library. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	PER_UPLOAD_BYTES = params.PER_UPLOAD_BYTES
	UploadGas        = params.UploadGas
)
View Source
const (
	Bucket    = 1024
	Group     = 32
	SyncBatch = 4096
	Delay     = 6
	//Scope     = 4
	//TIER         = 3
	//LEAFS        = 32768
	LimitSeeding = 2048
	NEED         = 10
)
View Source
const (
	QueryTimeInterval              = 1
	ExpansionFactor        float64 = 1.2
	DefaultSeedInterval            = 600
	TorrentWaitingTime             = 1800
	DownloadWaitingTime            = 2700
	DefaultBytesLimitation         = 512 * 1024
	DefaultTmpPath                 = ".tmp"
	Version                        = "3"
)
View Source
const (
	ProtocolName         = "nas"
	ProtocolVersion      = uint64(4)
	NumberOfMessageCodes = 128
	ProtocolVersionStr   = "4.0"

	DefaultMaxMessageSize = uint32(1024)

	StatusCode = 0
	QueryCode  = 1
	MsgCode    = 2
	PollCode   = 3
	VoteCode   = 4

	PeerStateCycle = time.Second * 300

	ExpirationCycle   = time.Second
	TransmissionCycle = 300 * time.Millisecond
	HandshakeTimeout  = 60 * time.Second
)
View Source
const (
	FULL    = "full"
	DEFAULT = "default"
	LAZY    = "lazy"
	DEV     = "dev"
	AUTO    = "auto"
)
View Source
const (
	ClientVersion = "-COLA09-"
)

Variables

View Source
var (
	MainnetGenesisHash = common.HexToHash("0x21d6ce908e2d1464bd74bbdbf7249845493cc1ba10460758169b978e187762c1")

	TrustedCheckpoints = map[common.Hash]*TrustedCheckpoint{
		MainnetGenesisHash: MainnetTrustedCheckpoint,
	}

	MainnetTrustedCheckpoint = &TrustedCheckpoint{
		Name:          "mainnet",
		TfsCheckPoint: 395964,

		TfsRoot: common.HexToHash("0xe78706dbcc1f853336a31a3e3f55dcb3d0d082fb8fd4b4b273fe859d657e5dcc"),
		Skips: []Skip{
			{From: 1039, To: 4468}, {From: 5515, To: 10888}, {From: 10888, To: 137784}, {From: 137790, To: 156609}, {From: 160264, To: 395088}, {From: 395964, To: 1261969}, {From: 1261969, To: 1988320}, {From: 1988320, To: 2107911}, {From: 2108043, To: 2270725}, {From: 2270777, To: 2754916}, {From: 2755628, To: 5320722}, {From: 5320722, To: 5605351}, {From: 5605351, To: 5707301}, {From: 5707301, To: 6967375}, {From: 6967493, To: 9764864},
		},
	}
)
View Source
var (
	MainnetTrackers = []string{
		"udp://tracker.cortexlabs.ai:5008",
	}

	GlobalTrackers = []string{
		"udp://tracker.openbittorrent.com:6969/announce",
		"udp://tracker.opentrackr.org:1337/announce",
	}

	TorrentBoostNodes = []string{
		"http://share.cortexlabs.ai:7881",
	}

	BestTrackerUrl = []string{"https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt",
		"https://cdn.jsdelivr.net/gh/ngosang/trackerslist@master/trackers_best.txt",
		"https://ngosang.github.io/trackerslist/trackers_best.txt",
	}

	ColaUrl = []string{"https://github.com/CortexFoundation/cola/releases/download/1.0.0/cola.txt"}
)
View Source
var BadFiles = map[string]bool{
	"3edcb8a793887d92db12d53124955681d5c20a43": true,
}
View Source
var ColaFiles = map[string]bool{
	"aea5584d0cd3865e90c80eace3bfcb062473d966": true,
	"3f1f6c007e8da3e16f7c3378a20a746e70f1c2b0": true,
	"1f1706fa53ce0723ba1c577418b222acbfa5a200": true,
	"1fb97d6da1761ddc051446307bd915506359a17a": true,
	"2b6ae7e31d65991e4ba575a05d635e9eb5ba30bf": true,
	"3101ac2c157ace6e4be72575758f7ba62b53e219": true,
	"3145ad19228c1cd2d051314e72f26c1ce77b7f02": true,
	"5a49fed84aaf368cbf472cc06e42f93a93d92db5": true,
	"6b75cc1354495ec763a6b295ee407ea864a0c292": true,
	"a83dc64f96494b6b6c4f5291196d0ddd2f1a0769": true,
	"ae5a301ddfe1d4be9848adf8dde9f78d7ebba919": true,
	"b2f5b0036877be22c6101bdfa5f2c7927fc35ef8": true,
	"c599d0fa8d816cf83c5018232453c6ae57db4ab3": true,
}
View Source
var DefaultConfig = Config{
	Port:            0,
	DefaultTrackers: MainnetTrackers,
	BoostNodes:      TorrentBoostNodes,
	Mode:            "default",
	DisableUTP:      true,
	DisableDHT:      true,
	DisableTCP:      false,
	DisableIPv6:     false,
	MaxSeedingNum:   LimitSeeding / 2,
	MaxActiveNum:    LimitSeeding / 2,

	Boost:        false,
	Quiet:        true,
	UploadRate:   -1,
	DownloadRate: -1,
	Metrics:      true,
	Server:       false,
	Wormhole:     false,
	Engine:       "badger",
}

DefaultConfig contains default settings for the storage.

View Source
var GoodFiles = map[string]bool{
	"aea5584d0cd3865e90c80eace3bfcb062473d966": true,
	"3145ad19228c1cd2d051314e72f26c1ce77b7f02": true,
	"c599d0fa8d816cf83c5018232453c6ae57db4ab3": true,
	"ae5a301ddfe1d4be9848adf8dde9f78d7ebba919": true,
	"3101ac2c157ace6e4be72575758f7ba62b53e219": true,
	"1fb97d6da1761ddc051446307bd915506359a17a": true,
	"a83dc64f96494b6b6c4f5291196d0ddd2f1a0769": true,
	"3f1f6c007e8da3e16f7c3378a20a746e70f1c2b0": true,
	"1f1706fa53ce0723ba1c577418b222acbfa5a200": true,

	"5a49fed84aaf368cbf472cc06e42f93a93d92db5": true,
	"b2f5b0036877be22c6101bdfa5f2c7927fc35ef8": true,
	"6b75cc1354495ec763a6b295ee407ea864a0c292": true,
	"2b6ae7e31d65991e4ba575a05d635e9eb5ba30bf": true,

	"ec6b1f5b5073c07dd35a53a3a13220c1a21e426d": false,
	"9f222b4afa685d74d82e88972922cc9108a81791": false,
	"04615009127a4829d32d22dddb45664a2aee8067": false,
	"6dfc52c480a779dd3e2c9dce9772a5131ee1f4d7": false,
	"d31d1b0f588069aa6f36de5a7025a8d73a9a49f6": false,
	"9dbde0099a270c23d5dec0acb0ac537b0fb35c27": false,
	"3df6926c165db01330574fba8c23aa7b03311356": false,
	"6b3fd83c1fb05ae5145673218b53a1411460f3e0": false,
	"b3d2f3d4f395924ca4cf5bd1843d49de043c959c": false,
	"ad3d77101866c0c7520aa41a5c41eee92500f809": false,
	"67b315aac2fbdbaf97ac8d40df0b9c435b65c4aa": false,
	"b08e2c6103157ab99040cdc9ddfee05e93763f6c": false,

	"de58609743e5cd0cb18798d91a196f418ac25016": true,
}

Functions

func IsActive

func IsActive(hash string) bool

func IsBad

func IsBad(hash string) bool

func IsGood

func IsGood(hash string) bool

func IsGreat

func IsGreat(hash string) bool

Types

type Config

type Config struct {
	// Host is the host interface on which to start the storage server. If this
	// field is empty, no storage will be started.
	Port            int      `toml:",omitempty"`
	DataDir         string   `toml:",omitempty"`
	RpcURI          string   `toml:",omitempty"`
	IpcPath         string   `toml:",omitempty"`
	DisableUTP      bool     `toml:",omitempty"`
	DisableTCP      bool     `toml:",omitempty"`
	DisableDHT      bool     `toml:",omitempty"`
	DisableIPv6     bool     `toml:",omitempty"`
	DefaultTrackers []string `toml:",omitempty"`
	BoostNodes      []string `toml:",omitempty"`
	Mode            string   `toml:",omitempty"`
	MaxSeedingNum   int      `toml:",omitempty"`
	MaxActiveNum    int      `toml:",omitempty"`
	//FullSeed        bool     `toml:",omitempty"`
	Boost        bool   `toml:",omitempty"`
	Quiet        bool   `toml:",omitempty"`
	UploadRate   int    `toml:",omitempty"`
	DownloadRate int    `toml:",omitempty"`
	Metrics      bool   `toml:",omitempty"`
	Server       bool   `toml:",omitempty"`
	Wormhole     bool   `toml:",omitempty"`
	Engine       string `toml:",omitempty"`
}

Config ...

type Skip

type Skip struct {
	From uint64
	To   uint64
}

type TrustedCheckpoint

type TrustedCheckpoint struct {
	Name string `json:"-"`
	//	TfsBlocks     uint64      `json:"tfsBlocks"`
	TfsCheckPoint uint64 `json:"tfsCheckPoint"`
	//	TfsFiles      uint64      `json:"tfsFiles"`
	TfsRoot common.Hash `json:"tfsRoot"`
	Skips   []Skip
}

Jump to

Keyboard shortcuts

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