params

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: GPL-3.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	VersionMajor = 0  // Major version component of the current release
	VersionMinor = 3  // Minor version component of the current release
	VersionPatch = 4  // Patch version component of the current release
	VersionMeta  = "" // Version metadata to append to the version string
)

version parts

Variables

View Source
var (

	// ServerAPIAddress server api address
	ServerAPIAddress string
)
View Source
var Version = func() string {
	return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
}()

Version holds the textual version string.

View Source
var VersionWithMeta = func() string {
	v := Version
	if VersionMeta != "" {
		v += "-" + VersionMeta
	}
	return v
}()

VersionWithMeta holds the textual version string including the metadata.

Functions

func ArchiveVersion

func ArchiveVersion(gitCommit string) string

ArchiveVersion holds the textual version string used for Geth archives. e.g. "1.8.11-dea1ce05" for stable releases, or

"1.8.13-unstable-21c059b6" for unstable releases

func CheckConfig

func CheckConfig(isServer bool) (err error)

CheckConfig check config

func GetAPIPort

func GetAPIPort() int

GetAPIPort get api service port

func GetIdentifier

func GetIdentifier() string

GetIdentifier get identifier (to distiguish in dcrm accept)

func HasAdmin

func HasAdmin() bool

HasAdmin has admin

func IsAdmin

func IsAdmin(account string) bool

IsAdmin is admin

func IsDcrmEnabled added in v0.3.0

func IsDcrmEnabled() bool

IsDcrmEnabled is dcrm enabled (for dcrm sign)

func IsDcrmInitiator added in v0.3.0

func IsDcrmInitiator(account string) bool

IsDcrmInitiator is initiator of dcrm sign

func MustRegisterAccount added in v0.3.4

func MustRegisterAccount() bool

MustRegisterAccount flag

func SetConfig

func SetConfig(config *ServerConfig)

SetConfig set config items

func VersionWithCommit

func VersionWithCommit(gitCommit, gitDate string) string

VersionWithCommit add git commit and data to version.

Types

type APIServerConfig

type APIServerConfig struct {
	Port           int
	AllowedOrigins []string
}

APIServerConfig api service config

type DcrmConfig

type DcrmConfig struct {
	Disable       bool
	GroupID       *string
	NeededOracles *uint32
	TotalOracles  *uint32
	Mode          uint32 // 0:managed 1:private (default 0)
	Initiators    []string
	DefaultNode   *DcrmNodeConfig
	OtherNodes    []*DcrmNodeConfig
}

DcrmConfig dcrm related config

func (*DcrmConfig) CheckConfig

func (c *DcrmConfig) CheckConfig(isServer bool) (err error)

CheckConfig check dcrm config

type DcrmNodeConfig added in v0.3.0

type DcrmNodeConfig struct {
	RPCAddress   *string
	SignGroups   []string `toml:",omitempty" json:",omitempty"`
	KeystoreFile *string  `json:"-"`
	PasswordFile *string  `json:"-"`
}

DcrmNodeConfig dcrm node config

func (*DcrmNodeConfig) CheckConfig added in v0.3.0

func (c *DcrmNodeConfig) CheckConfig(isServer bool) (err error)

CheckConfig check dcrm node config

type ExtraConfig added in v0.3.4

type ExtraConfig struct {
	MinReserveFee string
}

ExtraConfig extra config

func GetExtraConfig added in v0.3.4

func GetExtraConfig() *ExtraConfig

GetExtraConfig get extra config

func (*ExtraConfig) CheckConfig added in v0.3.4

func (c *ExtraConfig) CheckConfig() (err error)

CheckConfig extra config

type MongoDBConfig

type MongoDBConfig struct {
	DBURL    string
	DBName   string
	UserName string `json:"-"`
	Password string `json:"-"`
}

MongoDBConfig mongodb config

type OracleConfig

type OracleConfig struct {
	ServerAPIAddress string
}

OracleConfig oracle config

func (*OracleConfig) CheckConfig

func (c *OracleConfig) CheckConfig() (err error)

CheckConfig check oracle config

type ServerConfig

type ServerConfig struct {
	Identifier          string
	MustRegisterAccount bool             `toml:",omitempty" json:",omitempty"`
	MongoDB             *MongoDBConfig   `toml:",omitempty" json:",omitempty"`
	APIServer           *APIServerConfig `toml:",omitempty" json:",omitempty"`
	SrcChain            *tokens.ChainConfig
	SrcGateway          *tokens.GatewayConfig
	DestChain           *tokens.ChainConfig
	DestGateway         *tokens.GatewayConfig
	Dcrm                *DcrmConfig            `toml:",omitempty" json:",omitempty"`
	Oracle              *OracleConfig          `toml:",omitempty" json:",omitempty"`
	BtcExtra            *tokens.BtcExtraConfig `toml:",omitempty" json:",omitempty"`
	Extra               *ExtraConfig           `toml:",omitempty" json:",omitempty"`
	Admins              []string               `toml:",omitempty" json:",omitempty"`
}

ServerConfig config items (decode from toml file)

func GetConfig

func GetConfig() *ServerConfig

GetConfig get config items structure

func LoadConfig

func LoadConfig(configFile string, isServer bool) *ServerConfig

LoadConfig load config

Jump to

Keyboard shortcuts

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