params

package
v0.3.9 Latest Latest
Warning

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

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

Documentation

Overview

Package params provides common version info and config items.

Index

Constants

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

version parts

Variables

View Source
var (

	// IsSwapServer if true then it's swap server, otherwise it's swap oracle
	IsSwapServer bool

	// 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 CheckConfig

func CheckConfig(isServer bool) (err error)

CheckConfig check config

func EnableCheckBlockFork added in v0.3.9

func EnableCheckBlockFork() bool

EnableCheckBlockFork enable check block fork

func GetAPIPort

func GetAPIPort() int

GetAPIPort get api service port

func GetDataDir added in v0.3.7

func GetDataDir() string

GetDataDir get data dir

func GetIdentifier

func GetIdentifier() string

GetIdentifier get identifier (to distiguish in dcrm accept)

func GetReplaceIdentifier added in v0.3.7

func GetReplaceIdentifier() string

GetReplaceIdentifier 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 IsDebugMode added in v0.3.9

func IsDebugMode() bool

IsDebugMode is debug mode, add more debugging log infos

func IsNullSwapoutNativeMemo added in v0.3.9

func IsNullSwapoutNativeMemo() bool

IsNullSwapoutNativeMemo set no unlock memo in building swapout tx

func IsSwapoutToStringAddress added in v0.3.9

func IsSwapoutToStringAddress() bool

IsSwapoutToStringAddress swapout to string address (eg. btc)

func MustRegisterAccount added in v0.3.4

func MustRegisterAccount() bool

MustRegisterAccount flag

func SetConfig

func SetConfig(config *BridgeConfig)

SetConfig set bridge config

func SetDataDir

func SetDataDir(dir string)

SetDataDir set data dir

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 BridgeConfig added in v0.3.9

type BridgeConfig struct {
	Identifier  string
	SrcChain    *tokens.ChainConfig
	SrcGateway  *tokens.GatewayConfig
	DestChain   *tokens.ChainConfig
	DestGateway *tokens.GatewayConfig
	Server      *ServerConfig          `toml:",omitempty" json:",omitempty"`
	Oracle      *OracleConfig          `toml:",omitempty" json:",omitempty"`
	BtcExtra    *tokens.BtcExtraConfig `toml:",omitempty" json:",omitempty"`
	Extra       *ExtraConfig           `toml:",omitempty" json:",omitempty"`
	Dcrm        *DcrmConfig            `toml:",omitempty" json:",omitempty"`
}

BridgeConfig config items (decode from toml file)

func GetConfig

func GetConfig() *BridgeConfig

GetConfig get bridge config

func LoadConfig

func LoadConfig(configFile string, isServer bool) *BridgeConfig

LoadConfig load config

type DcrmConfig

type DcrmConfig struct {
	Disable       bool
	APIPrefix     string
	RPCTimeout    uint64
	SignTimeout   uint64
	GroupID       *string
	NeededOracles *uint32
	TotalOracles  *uint32
	Mode          uint32 // 0:managed 1:private (default 0)
	Initiators    []string
	DefaultNode   *DcrmNodeConfig
	OtherNodes    []*DcrmNodeConfig `toml:",omitempty" json:",omitempty"`
}

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 {
	IsDebugMode              bool `toml:",omitempty" json:",omitempty"`
	MustRegisterAccount      bool
	IsSwapoutToStringAddress bool `toml:",omitempty" json:",omitempty"`
	EnableCheckBlockFork     bool
	IsNullSwapoutNativeMemo  bool `toml:",omitempty" json:",omitempty"`
}

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   `toml:",omitempty" json:",omitempty"`
	DBURLs   []string `toml:",omitempty" json:",omitempty"`
	DBName   string
	UserName string `json:"-"`
	Password string `json:"-"`
}

MongoDBConfig mongodb config

func (*MongoDBConfig) CheckConfig added in v0.3.9

func (c *MongoDBConfig) CheckConfig() error

CheckConfig check mongodb config

type OracleConfig

type OracleConfig struct {
	ServerAPIAddress      string
	GetAcceptListInterval uint64
}

OracleConfig oracle config

func GetOracleConfig added in v0.3.9

func GetOracleConfig() *OracleConfig

GetOracleConfig get oracle config

func (*OracleConfig) CheckConfig

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

CheckConfig check oracle config

type ServerConfig

type ServerConfig struct {
	MongoDB   *MongoDBConfig   `toml:",omitempty" json:",omitempty"`
	APIServer *APIServerConfig `toml:",omitempty" json:",omitempty"`
	Admins    []string         `toml:",omitempty" json:",omitempty"`
}

ServerConfig swap server config

func GetServerConfig added in v0.3.9

func GetServerConfig() *ServerConfig

GetServerConfig get server config

func (*ServerConfig) CheckConfig added in v0.3.9

func (c *ServerConfig) CheckConfig() error

CheckConfig check swap server config

Jump to

Keyboard shortcuts

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