Documentation ¶
Index ¶
- Constants
- Variables
- func BaseDir() string
- func GetPoolAddr(miner [32]byte, cfg *config.PlatEthConfig) (addr *common.Address, payeraddr *common.Address, err error)
- func InitEthConfig()
- func InitMinerNode(auth, port string, networkid int)
- func MinerConfFile(bas string) string
- func WalletDir(base string) string
- type Bucket
- type BucketManager
- type BucketMap
- type MinerConf
- type MinerWallet
- type MsgAck
- type MsgReq
- type Node
- func (n *Node) CheckVersion() error
- func (n *Node) CtrlService(sig chan struct{})
- func (n *Node) GetMinerCredit() *big.Int
- func (n *Node) GetNodeIns() *NodeIns
- func (n *Node) GetUserAccount(addr common.Address) *UserAccount
- func (n *Node) GetUserCount() int
- func (n *Node) GetUsers() []common.Address
- func (n *Node) Mining(sig chan struct{})
- func (n *Node) RechargeBucket(r *microchain.MicroTX) error
- func (n *Node) ReportTx(sig chan struct{})
- func (n *Node) ShowUserBucket(user string) *Bucket
- func (n *Node) Stop()
- func (n *Node) SyncMicro(user common.Address) (tx *microchain.DBMicroTx, find bool, err error)
- func (n *Node) SyncUa(user common.Address) (ua *microchain.SyncUA, find bool, err error)
- func (n *Node) UserManagement() *UserAccountMgmt
- type NodeIns
- type PathConf
- type PingTest
- type ProbeReq
- type SettingConf
- func (cf *SettingConf) AddAccessAddr(addr string) error
- func (ss *SettingConf) GetAccessAddrs() string
- func (cf *SettingConf) GetAccessAddrs2() []string
- func (cf *SettingConf) GetWebPort() int
- func (cf *SettingConf) RemoveAccessAddr(addr string) error
- func (cf *SettingConf) Save() error
- func (cf *SettingConf) SetWebPort(webPort int)
- type SetupData
- type SetupReq
- type SyncMicroTx
- type UserAccount
- type UserAccountMgmt
- func (uam *UserAccountMgmt) DBPoolMicroTxKeyDerive(key string) (user common.Address, credit *big.Int, err error)
- func (uam *UserAccountMgmt) DBPoolMicroTxKeyGet(user common.Address, credit *big.Int) string
- func (uam *UserAccountMgmt) DBUserMicroTXKeyDerive(key string) (user common.Address, credit *big.Int, err error)
- func (uam *UserAccountMgmt) DBUserMicroTXKeyGet(user common.Address, credit *big.Int) string
- func (uam *UserAccountMgmt) GetMinerCredit() *big.Int
- func (uam *UserAccountMgmt) GetUserAccount(address common.Address) *UserAccount
- func (uam *UserAccountMgmt) GetUserCount() int
- func (uam *UserAccountMgmt) GetUsers() (users []common.Address)
- func (uam *UserAccountMgmt) ShowAllReceipt(user common.Address, report int) string
- func (uam *UserAccountMgmt) ShowAllUser() string
- func (uam *UserAccountMgmt) ShowLatestReceipt(user common.Address, report int) string
- func (uam *UserAccountMgmt) ShowReceipt(user common.Address, credit string, report int) string
- func (uam *UserAccountMgmt) ShowUser(user common.Address) string
Constants ¶
View Source
const ( InitBucketSize = 1 << 24 //16M RechargePieceSize = 1 << 22 //4M MaxLostRechargeReq = 16 ConnectionBufSize = 1 << 20 )
View Source
const ( DefaultBaseDir = ".hop" WalletFile = "wallet.json" DataBase = "Receipts" LogFile = "log.hop" PidFile = "pid.hop" ConfFile = "conf.hop" WebPort = 42887 LMCMD = "cmd" )
View Source
const ( MsgDeliverMicroTx int = iota MsgSyncMicroTx MsgPingTest )
View Source
const ( DBUserMicroTXHead string = "DBUserMicroTx_%s_%s" //market pool DBUserMicroTxKey = DBUserMicroTXHead + "_%s_%s" //user credit DBPoolMicroTxHead string = "DBPoolMicroTx_%s_%s" //market pool DBPoolMicroTxKey = DBPoolMicroTxHead + "_%s_%s" //user credit DBPoolMicroTxKeyPatternEnd = "DBPoolMicroTx_0xffffffffffffffffffff" )
View Source
const BUFFER_SIZE = 1 << 20
Variables ¶
View Source
var CMDServicePort = "42776"
View Source
var (
ErrNoPacketBalance = fmt.Errorf("need to recharge for this mienr")
)
View Source
var HopVersion string = "1.1.6"
View Source
var MinerSetting = &SettingConf{EthereumConfig: &com.EthereumConfig{}}
View Source
var PathSetting = &PathConf{}
Functions ¶
func GetPoolAddr ¶
func InitEthConfig ¶
func InitEthConfig()
func InitMinerNode ¶
func MinerConfFile ¶
Types ¶
type Bucket ¶
func (*Bucket) WriteCount ¶
type BucketManager ¶
type BucketManager interface {
RechargeBucket(tx *microchain.MicroTX) error
}
type BucketMap ¶
func (*BucketMap) BucketTimer ¶
func (bm *BucketMap) BucketTimer(sig chan struct{})
type MinerConf ¶
type MinerWallet ¶
func WInst ¶
func WInst() *MinerWallet
type MsgAck ¶
type MsgReq ¶
type MsgReq struct { Typ int `json:"typ"` SMT *SyncMicroTx `json:"smt,omitempty"` TX *microchain.MicroTX `json:"tx,omitempty"` PT *PingTest `json:"pt,omitempty"` }
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) CheckVersion ¶
func (*Node) CtrlService ¶
func (n *Node) CtrlService(sig chan struct{})
func (*Node) GetMinerCredit ¶
func (*Node) GetNodeIns ¶
func (*Node) GetUserAccount ¶
func (n *Node) GetUserAccount(addr common.Address) *UserAccount
func (*Node) GetUserCount ¶
func (*Node) RechargeBucket ¶
func (n *Node) RechargeBucket(r *microchain.MicroTX) error
func (*Node) ShowUserBucket ¶
func (*Node) UserManagement ¶
func (n *Node) UserManagement() *UserAccountMgmt
type PathConf ¶
type SettingConf ¶
type SettingConf struct { BAS string *com.EthereumConfig WebPort int AccessPubKey []string }
func (*SettingConf) AddAccessAddr ¶
func (cf *SettingConf) AddAccessAddr(addr string) error
func (*SettingConf) GetAccessAddrs ¶
func (ss *SettingConf) GetAccessAddrs() string
func (*SettingConf) GetAccessAddrs2 ¶
func (cf *SettingConf) GetAccessAddrs2() []string
func (*SettingConf) GetWebPort ¶
func (cf *SettingConf) GetWebPort() int
func (*SettingConf) RemoveAccessAddr ¶
func (cf *SettingConf) RemoveAccessAddr(addr string) error
func (*SettingConf) Save ¶
func (cf *SettingConf) Save() error
func (*SettingConf) SetWebPort ¶
func (cf *SettingConf) SetWebPort(webPort int)
type SyncMicroTx ¶
func (*SyncMicroTx) String ¶
func (sm *SyncMicroTx) String() string
type UserAccount ¶
type UserAccount struct { UserAddress common.Address TokenBalance *big.Int //total recharge TrafficBalance *big.Int //recharge to traffic TotalTraffic *big.Int //used in pool UptoPoolTraffic *big.Int MinerCredit *big.Int //used in miner PoolRefused bool }
func NewUserAccount ¶
func NewUserAccount() *UserAccount
func (*UserAccount) String ¶
func (ua *UserAccount) String() string
type UserAccountMgmt ¶
type UserAccountMgmt struct {
// contains filtered or unexported fields
}
func NewUserAccMgmt ¶
func NewUserAccMgmt(db *leveldb.DB, pool common.Address) *UserAccountMgmt
func (*UserAccountMgmt) DBPoolMicroTxKeyDerive ¶
func (*UserAccountMgmt) DBPoolMicroTxKeyGet ¶
func (*UserAccountMgmt) DBUserMicroTXKeyDerive ¶
func (*UserAccountMgmt) DBUserMicroTXKeyGet ¶
func (*UserAccountMgmt) GetMinerCredit ¶
func (uam *UserAccountMgmt) GetMinerCredit() *big.Int
func (*UserAccountMgmt) GetUserAccount ¶
func (uam *UserAccountMgmt) GetUserAccount(address common.Address) *UserAccount
func (*UserAccountMgmt) GetUserCount ¶
func (uam *UserAccountMgmt) GetUserCount() int
func (*UserAccountMgmt) GetUsers ¶
func (uam *UserAccountMgmt) GetUsers() (users []common.Address)
func (*UserAccountMgmt) ShowAllReceipt ¶
func (uam *UserAccountMgmt) ShowAllReceipt(user common.Address, report int) string
func (*UserAccountMgmt) ShowAllUser ¶
func (uam *UserAccountMgmt) ShowAllUser() string
func (*UserAccountMgmt) ShowLatestReceipt ¶
func (uam *UserAccountMgmt) ShowLatestReceipt(user common.Address, report int) string
func (*UserAccountMgmt) ShowReceipt ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.