Documentation
¶
Index ¶
- Constants
- Variables
- func FromFile(path string, def interface{}) (interface{}, error)
- func FromReader(reader io.Reader, def interface{}) (interface{}, error)
- func GenerateConfigComment(t interface{}) ([]byte, error)
- func GenerateConfigUpdate(cfgCur, cfgDef interface{}, comment bool) ([]byte, error)
- type Bandwidth
- type Basic
- type CPU
- type CandidateCfg
- type DocField
- type Duration
- type EdgeCfg
- type LocatorCfg
- type Memory
- type MinioConfig
- type Netflow
- type Network
- type ProviderConfig
- type Puller
- type SchedulerCfg
- type Storage
Constants ¶
const ( // RetrievalPricingDefault configures the node to use the default retrieval pricing policy. RetrievalPricingDefaultMode = "default" // RetrievalPricingExternal configures the node to use the external retrieval pricing script // configured by the user. RetrievalPricingExternalMode = "external" )
Variables ¶
var Doc = map[string][]DocField{ "Bandwidth": []DocField{ { Name: "BandwidthMB", Type: "int64", Comment: `unit is MiB/s, 0 means no limit`, }, { Name: "BandwidthUp", Type: "int64", Comment: `upload file bandwidth, unit is MiB/s, 0 means no limit`, }, { Name: "BandwidthDown", Type: "int64", Comment: `download file bandwidth, unit is MiB/s, 0 means no limit`, }, }, "Basic": []DocField{ { Name: "Token", Type: "string", Comment: ``, }, }, "CPU": []DocField{ { Name: "Cores", Type: "int", Comment: ``, }, }, "CandidateCfg": []DocField{ { Name: "MetadataPath", Type: "string", Comment: `metadata path`, }, { Name: "AssetsPaths", Type: "[]string", Comment: `assets path`, }, { Name: "WebRedirect", Type: "string", Comment: ``, }, { Name: "ExternalURL", Type: "string", Comment: ``, }, { Name: "AcmeUrl", Type: "string", Comment: `AcmeUrl automatically issue certificates for L1 node`, }, { Name: "IsPrivate", Type: "bool", Comment: `Let the scheduler know that this node does not do tasks`, }, }, "EdgeCfg": []DocField{ { Name: "Network", Type: "Network", Comment: ``, }, { Name: "AreaID", Type: "string", Comment: `area id`, }, { Name: "Secret", Type: "string", Comment: `used auth when connect to scheduler`, }, { Name: "InsecureSkipVerify", Type: "bool", Comment: `InsecureSkipVerify http3 client skip tls verify`, }, { Name: "CertificatePath", Type: "string", Comment: `used for http3 server be used if InsecureSkipVerify is true`, }, { Name: "PrivateKeyPath", Type: "string", Comment: `used for http3 server be used if InsecureSkipVerify is true`, }, { Name: "CaCertificatePath", Type: "string", Comment: `self sign certificate, use for client`, }, { Name: "TCPSrvAddr", Type: "string", Comment: ``, }, { Name: "IPFSAPIURL", Type: "string", Comment: ``, }, { Name: "ValidateDuration", Type: "int", Comment: `seconds`, }, { Name: "MaxSizeOfUploadFile", Type: "int", Comment: ``, }, { Name: "Puller", Type: "Puller", Comment: ``, }, { Name: "Bandwidth", Type: "Bandwidth", Comment: ``, }, { Name: "Netflow", Type: "Netflow", Comment: ``, }, { Name: "Storage", Type: "Storage", Comment: ``, }, { Name: "Memory", Type: "Memory", Comment: ``, }, { Name: "CPU", Type: "CPU", Comment: ``, }, { Name: "Basic", Type: "Basic", Comment: ``, }, }, "LocatorCfg": []DocField{ { Name: "ListenAddress", Type: "string", Comment: `host address and port the edge node api will listen on`, }, { Name: "Timeout", Type: "string", Comment: `used when 'ListenAddress' is unspecified. must be a valid duration recognized by golang's time.ParseDuration function`, }, { Name: "GeoDBPath", Type: "string", Comment: `geodb path`, }, { Name: "InsecureSkipVerify", Type: "bool", Comment: `InsecureSkipVerify http3 client skip tls verify`, }, { Name: "CertificatePath", Type: "string", Comment: `used for http3 server be used if InsecureSkipVerify is false`, }, { Name: "PrivateKeyPath", Type: "string", Comment: `used for http3 server be used if InsecureSkipVerify is false`, }, { Name: "CaCertificatePath", Type: "string", Comment: `self sign certificate, use for client`, }, { Name: "EtcdAddresses", Type: "[]string", Comment: `etcd server addresses`, }, { Name: "DNSServerAddress", Type: "string", Comment: ``, }, { Name: "DNSRecords", Type: "map[string]string", Comment: ``, }, { Name: "DefaultAreas", Type: "[]string", Comment: ``, }, }, "Memory": []DocField{ { Name: "MemoryGB", Type: "int64", Comment: ``, }, }, "MinioConfig": []DocField{ { Name: "Endpoint", Type: "string", Comment: ``, }, { Name: "AccessKeyID", Type: "string", Comment: ``, }, { Name: "SecretAccessKey", Type: "string", Comment: ``, }, }, "Netflow": []DocField{ { Name: "NetflowUp", Type: "int64", Comment: `upload network flow limit, unit is GB, 0 means no limit`, }, { Name: "NetflowDown", Type: "int64", Comment: `download network flow limit, unit is GB, 0 means no limit`, }, }, "Network": []DocField{ { Name: "ListenAddress", Type: "string", Comment: `host address and port the edge node api will listen on`, }, { Name: "Timeout", Type: "string", Comment: `used when 'ListenAddress' is unspecified. must be a valid duration recognized by golang's time.ParseDuration function`, }, { Name: "LocatorURL", Type: "string", Comment: `the url of locator`, }, }, "Puller": []DocField{ { Name: "PullBlockTimeout", Type: "int", Comment: `PullBlockTimeout get block timeout`, }, { Name: "PullBlockRetry", Type: "int", Comment: `PullBlockRetry retry when get block failed`, }, { Name: "PullBlockParallel", Type: "int", Comment: `PullBlockParallel the number of goroutine to pull block`, }, }, "SchedulerCfg": []DocField{ { Name: "ExternalURL", Type: "string", Comment: `host external address and port`, }, { Name: "ListenAddress", Type: "string", Comment: `host address and port the edge node api will listen on`, }, { Name: "DatabaseAddress", Type: "string", Comment: `database address`, }, { Name: "GeoDBPath", Type: "string", Comment: `geodb path`, }, { Name: "AreaID", Type: "string", Comment: `area id`, }, { Name: "InsecureSkipVerify", Type: "bool", Comment: `InsecureSkipVerify skip tls verify`, }, { Name: "CertificatePath", Type: "string", Comment: `used for http3 server be used if InsecureSkipVerify is true`, }, { Name: "PrivateKeyPath", Type: "string", Comment: `used for http3 server be used if InsecureSkipVerify is true`, }, { Name: "CaCertificatePath", Type: "string", Comment: `self sign certificate, use for client`, }, { Name: "EnableValidation", Type: "bool", Comment: `config to enabled node validation, default: true`, }, { Name: "EtcdAddresses", Type: "[]string", Comment: `etcd server addresses`, }, { Name: "CandidateReplicas", Type: "int", Comment: `Number of candidate node replicas (does not contain 'seed')`, }, { Name: "ValidatorRatio", Type: "float64", Comment: `Proportion of validator in candidate nodes (0 ~ 1)`, }, { Name: "ValidatorBaseBwDn", Type: "int", Comment: `The base downstream bandwidth per validator window (unit : MiB)`, }, { Name: "ValidationProfit", Type: "float64", Comment: `Increased profit after node validation passes`, }, { Name: "WorkloadProfit", Type: "float64", Comment: `Increased profit after node workload passes`, }, { Name: "ElectionCycle", Type: "int", Comment: `ElectionCycle cycle (Unit:Day)`, }, { Name: "NodeScoreLevel", Type: "map[string][]int", Comment: `Node score level scale The key of map is the rank name, and the value of map is a int array containing two elements, the first element of which is the minimum value of score, and the second element is the maximum value of score. (scores out of 100)`, }, { Name: "LevelSelectWeight", Type: "map[string]int", Comment: `Node level weight The key of the map is the name of the level, and the value of the map is an int, indicating how many select weight this level can get (the more select weight, the greater the probability of the node being selected)`, }, { Name: "UserFreeStorageSize", Type: "int64", Comment: ``, }, { Name: "UserVipStorageSize", Type: "int64", Comment: ``, }, { Name: "LotusRPCAddress", Type: "string", Comment: ``, }, { Name: "LotusToken", Type: "string", Comment: ``, }, { Name: "EdgeDownloadRatio", Type: "float64", Comment: `The ratio of edge nodes returned to the user for download`, }, { Name: "AssetPullTaskLimit", Type: "int", Comment: `Maximum number of concurrent asset pulls`, }, { Name: "NatDetectConcurrency", Type: "int", Comment: ``, }, { Name: "UploadAssetReplicaCount", Type: "int", Comment: `Default number of backups for user uploaded files`, }, { Name: "UploadAssetExpiration", Type: "int", Comment: `Default expiration time for user uploaded files`, }, { Name: "MaxCountOfVisitShareLink", Type: "int", Comment: `Non vip user`, }, { Name: "Weight", Type: "int", Comment: `if the area has several scheduler, node will connect to the scheduler which weight is bigger`, }, { Name: "MaxAPIKey", Type: "int", Comment: ``, }, { Name: "IPWhitelist", Type: "[]string", Comment: ``, }, { Name: "MaxNumberOfRegistrations", Type: "int", Comment: ``, }, { Name: "IPLimit", Type: "int", Comment: ``, }, { Name: "StorageCandidates", Type: "[]string", Comment: ``, }, { Name: "L2ValidatorCount", Type: "int", Comment: ``, }, { Name: "AndroidSymbol", Type: "string", Comment: ``, }, { Name: "IOSSymbol", Type: "string", Comment: ``, }, { Name: "WindowsSymbol", Type: "string", Comment: ``, }, { Name: "MacosSymbol", Type: "string", Comment: ``, }, }, "Storage": []DocField{ { Name: "StorageGB", Type: "int64", Comment: ``, }, { Name: "Path", Type: "string", Comment: ``, }, }, }
var MaxTraversalLinks uint64 = 32 * (1 << 20)
MaxTraversalLinks configures the maximum number of links to traverse in a DAG while calculating CommP and traversing a DAG with graphsync; invokes a budget on DAG depth and density.
Functions ¶
func FromFile ¶
FromFile loads config from a specified file overriding defaults specified in the def parameter. If file does not exist or is empty defaults are assumed.
func FromReader ¶
FromReader loads config from a reader instance.
func GenerateConfigComment ¶
GenerateConfigComment generates a commented version of the specified configuration, with comments describing each configuration field.
func GenerateConfigUpdate ¶
GenerateConfigUpdate generates an updated configuration based on the current configuration and the specified defaults. If 'comment' is true, the updated configuration will contain comments describing each configuration field.
Types ¶
type CandidateCfg ¶
type CandidateCfg struct {
EdgeCfg
// metadata path
MetadataPath string
// assets path
AssetsPaths []string
MinioConfig
WebRedirect string
ExternalURL string
// AcmeUrl automatically issue certificates for L1 node
AcmeUrl string
// Let the scheduler know that this node does not do tasks
IsPrivate bool
ProviderConfig
}
CandidateCfg candidate node config
func DefaultCandidateCfg ¶
func DefaultCandidateCfg() *CandidateCfg
DefaultCandidateCfg returns the default candidate config
type Duration ¶
Duration is a cgo type for time.Duration for decoding and encoding from/to TOML
func (Duration) MarshalText ¶
MarshalText implements interface for TOML encoding
func (*Duration) UnmarshalText ¶
UnmarshalText implements interface for TOML decoding
type EdgeCfg ¶
type EdgeCfg struct {
Network Network
// area id
AreaID string
// used auth when connect to scheduler
Secret string
// InsecureSkipVerify http3 client skip tls verify
InsecureSkipVerify bool
// used for http3 server
// be used if InsecureSkipVerify is true
CertificatePath string
// used for http3 server
// be used if InsecureSkipVerify is true
PrivateKeyPath string
// self sign certificate, use for client
CaCertificatePath string
TCPSrvAddr string
IPFSAPIURL string
// seconds
ValidateDuration int
MaxSizeOfUploadFile int64
Puller Puller
Bandwidth Bandwidth
Netflow Netflow
Storage Storage
Memory Memory
CPU CPU
Basic Basic
}
EdgeCfg edge node config
type LocatorCfg ¶
type LocatorCfg struct {
// host address and port the edge node api will listen on
ListenAddress string
// used when 'ListenAddress' is unspecified. must be a valid duration recognized by golang's time.ParseDuration function
Timeout string
// geodb path
GeoDBPath string
// InsecureSkipVerify http3 client skip tls verify
InsecureSkipVerify bool
// used for http3 server
// be used if InsecureSkipVerify is false
CertificatePath string
// used for http3 server
// be used if InsecureSkipVerify is false
PrivateKeyPath string
// self sign certificate, use for client
CaCertificatePath string
// etcd server addresses
EtcdAddresses []string
DNSServerAddress string
DNSRecords map[string]string
DefaultAreas []string
WebGeoAPI string
}
LocatorCfg locator config
func DefaultLocatorCfg ¶
func DefaultLocatorCfg() *LocatorCfg
DefaultLocatorCfg returns the default locator config
type MinioConfig ¶ added in v0.1.11
type ProviderConfig ¶ added in v0.1.21
type ProviderConfig struct {
// IngressHostName specifies the ingress hostname associated with the resource
IngressHostName string
// CertificatePath is the path to the security certificate file
IngressCertificatePath string
// CertificateKeyPath is the path to the key file for the security certificate
IngressCertificateKeyPath string
// IngressClassName specifies the class of the ingress resource
IngressClassName string
// KubeConfigPath specifies the path to the Kubernetes configuration file
KubeConfigPath string
}
type SchedulerCfg ¶
type SchedulerCfg struct {
// host external address and port
ExternalURL string
// host address and port the edge node api will listen on
ListenAddress string
// database address
DatabaseAddress string
// geodb path
GeoDBPath string
// area id
AreaID string
// InsecureSkipVerify skip tls verify
InsecureSkipVerify bool
// used for http3 server
// be used if InsecureSkipVerify is true
CertificatePath string
// used for http3 server
// be used if InsecureSkipVerify is true
PrivateKeyPath string
// self sign certificate, use for client
CaCertificatePath string
// config to enabled node validation, default: true
EnableValidation bool
// etcd server addresses
EtcdAddresses []string
// Number of candidate node replicas (does not contain 'seed')
CandidateReplicas int
// Proportion of validator in candidate nodes (0 ~ 1)
ValidatorRatio float64
// The base downstream bandwidth per validator window (unit : MiB)
ValidatorBaseBwDn int
// Increased profit after node validation passes
ValidationProfit float64
// Increased profit after node workload passes
WorkloadProfit float64
// ElectionCycle cycle (Unit:Day)
ElectionCycle int
// Node score level scale
// The key of map is the rank name, and the value of map is a int array containing two elements,
// the first element of which is the minimum value of score,
// and the second element is the maximum value of score. (scores out of 100)
NodeScoreLevel map[string][]int
// Node level weight
// The key of the map is the name of the level, and the value of the map is an int,
// indicating how many select weight this level can get (the more select weight, the greater the probability of the node being selected)
LevelSelectWeight map[string]int
UserFreeStorageSize int64
UserVipStorageSize int64
LotusRPCAddress string
LotusToken string
// The ratio of edge nodes returned to the user for download
EdgeDownloadRatio float64
// Maximum number of concurrent asset pulls
AssetPullTaskLimit int
NatDetectConcurrency int
MaxCountOfVisitShareLink int
// if the area has several scheduler, node will connect to the scheduler which weight is bigger
Weight int
MaxAPIKey int
IPWhitelist []string
MaxNumberOfRegistrations int
IPLimit int
L2ValidatorCount int
AndroidSymbol string
IOSSymbol string
WindowsSymbol string
MacosSymbol string
}
SchedulerCfg scheduler config
func DefaultSchedulerCfg ¶
func DefaultSchedulerCfg() *SchedulerCfg
DefaultSchedulerCfg returns the default scheduler config