fairnode

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CLEAN_OLD_NODE_TERM    = 3 // per min
	CHECK_ACTIVE_NODE_TERM = 3 // per sec
	//MIN_LEAGUE_NUM         = 1
	SEND_BLOCK_TIME_OUT  = 10 * 5 // 200ms * 10 * 5 -> max : 10sec
	LEAGUE_WAIE_TIME_OUT = 5 * 5  // 200ms * 5 * 5 -> max : 5sec
)

crypto.HexToECDSA("09bfa4fac90f9daade1722027f6350518c0c2a69728793f8753b2d166ada1a9c") - for test private key 0x10Ca4B84feF9Fce8910cb58aCf77255a1A8b61fD - for test addresss

View Source
const (
	LeagueSelectCount = 5 // node count for making league
)

Variables

View Source
var (
	Version       = "1.0.5"
	DefaultConfig = Config{
		UseSRV:   false,
		DBhost:   "localhost",
		DBport:   "27017",
		DBuser:   "",
		SSL_path: "",
		DBoption: "",

		KeyPath: filepath.Join(os.Getenv("HOME"), ".fairnode", "key"),

		Port:    "60002",
		SubPort: "60100",
		Debug:   false,
		Version: Version,
	}
)

Functions

func GetPriveKey

func GetPriveKey(keypath, keypass string) (*ecdsa.PrivateKey, error)

func ParseIP

func ParseIP(p string) (string, error)

func SelectedNode

func SelectedNode(self string, nodes []types.HeartBeat, max int) []string

func SetFairConfig

func SetFairConfig(ctx *cli.Context, keypass, dbpass string)

Types

type Config

type Config struct {
	FairNodeDir string

	// DB setting
	UseSRV   bool
	DBhost   string
	DBport   string
	DBuser   string
	DBpass   string
	DBoption string

	SSL_path string // for connection mongodb using ssl cert

	//key
	KeyPath string
	KeyPass string

	Port    string // 네트워크 포트, for node
	SubPort string // fairnode to fairnode port
	ChainID *big.Int
	Debug   bool
	Version string

	Memorydb bool
}

func (*Config) GetInfo

func (c *Config) GetInfo() (useSRV bool, host, port, user, pass, ssl, option string, chainID *big.Int)

type Fairnode

type Fairnode struct {
	// contains filtered or unexported fields
}

func NewFairnode

func NewFairnode() (*Fairnode, error)

func (*Fairnode) Database

func (fn *Fairnode) Database() fairdb.FairnodeDB

func (*Fairnode) GetAddress

func (fn *Fairnode) GetAddress() common.Address

func (*Fairnode) GetPublicKey

func (fn *Fairnode) GetPublicKey() ecdsa.PublicKey

func (*Fairnode) IsLeader

func (fn *Fairnode) IsLeader() bool

func (*Fairnode) LeagueSet

func (fn *Fairnode) LeagueSet() map[common.Hash]*league

func (*Fairnode) Leagues

func (fn *Fairnode) Leagues() map[common.Hash]*fs.Leagues

func (*Fairnode) RoleCheckChannel

func (fn *Fairnode) RoleCheckChannel() chan fs.FnType

func (*Fairnode) SignHash

func (fn *Fairnode) SignHash(hash []byte) ([]byte, error)

func (*Fairnode) Start

func (fn *Fairnode) Start() error

func (*Fairnode) Stop

func (fn *Fairnode) Stop()

func (*Fairnode) SyncMessageChannel

func (fn *Fairnode) SyncMessageChannel() chan []fs.Leagues

Directories

Path Synopsis
fntype
this type for mongodb stored type
this type for mongodb stored type
Package mock_fairnode is a generated GoMock package.
Package mock_fairnode is a generated GoMock package.

Jump to

Keyboard shortcuts

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