common/config/config.go

(开头部分) 17KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package config

import (
	"fmt"
	"time"

	"github.com/spf13/pflag"
	"github.com/spf13/viper"
	"github.com/syndtr/goleveldb/leveldb/errors"
)

// default settings
const (
	// NodeModeNormal NODE_MODE_NORMAL node mode for normal
	NodeModeNormal = "Normal"
	// NodeModeFastSync NODE_MODE_FAST_SYNC node mode for fast
	NodeModeFastSync        = "FastSync"
	DefaultNetPort          = 47101             // p2p port
	DefaultNetKeyPath       = "./data/netkeys/" // node private key path
	DefaultNetIsNat         = true              // use NAT
	DefaultNetIsSecure      = true              // use encrypted secure transport
	DefaultNetIsHidden      = false
	DefaultMaxStreamLimits  = 1024
	DefaultMaxMessageSize   = 128
	DefaultTimeout          = 3
	DefaultIsAuthentication = false
	DefautltAuthTimeout     = 30
	// limitation size for same ip
	DefaultStreamIPLimitSize     = 10
	DefaultMaxBroadcastPeers     = 20
	DefaultMaxBroadcastCorePeers = 10
	DefaultIsStorePeers          = false
	DefaultP2PDataPath           = "./data/p2p"
)

// LogConfig is the log config of node
type LogConfig struct {
	Module         string `yaml:"module,omitempty"`
	Filepath       string `yaml:"filepath,omitempty"`
	Filename       string `yaml:"filename,omitempty"`
	Fmt            string `yaml:"fmt,omitempty"`
	Console        bool   `yaml:"console,omitempty"`
	Level          string `yaml:"level,omitempty"`
	Async          bool   `yaml:"async,omitempty"`
	RotateInterval int    `yaml:"rotateinterval,omitempty"`
	RotateBackups  int    `yaml:"rotatebackups,omitempty"`
}

// TCPServerConfig is the tcp port of the node
type TCPServerConfig struct {
	Port                  string `yaml:"port,omitempty"`
	HTTPSPort             string `yaml:"httpsPort,omitempty"`
	MetricPort            string `yaml:"metricPort,omitempty"`
	MaxMsgSize            int    `yaml:"maxmsgsize,omitempty"`
	TLS                   bool   `yaml:"tls,omitempty"`
	TLSPath               string `yaml:"tlsPath,omitempty"`
	MServerURL            string `yaml:"mServerUrl,omitempty"`
	MServerName           string `yaml:"mServerName,omitempty"`
	CachePeriod           int64  `yaml:"cachePeriod,omitempty"`
	InitialWindowSize     int32  `yaml:"initialWindowSize,omitempty"`
后面还有 392 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。