Documentation
¶
Index ¶
- Constants
- Variables
- func CanSendToHook(w *index.MinerWebHook, key string) bool
- func DecodeBinaryNumber(i string) uint64
- func DecodeHexBinaryNumber(i string) string
- func EncodeBinaryNumber(n uint64) string
- func EncodeHexBinaryNumber(v2 string) string
- func EncodeSliceBinaryNumber(dst, src []byte) []byte
- func Factorial(n uint64) (result uint64)
- func FindAndInsertMainHeader(h daemon.BlockHeader, indexDb *index.Index, ...) error
- func FindAndInsertMainHeaderOutputs(mb *index.MainBlock, indexDb *index.Index, client *client.Client, ...) error
- func GetMainBlock(id types.Hash, client *client.Client) (*block.Block, error)
- func GetSiteUrl(k siteKey, tryOnion bool) string
- func GetSiteUrlByHost(host string, tryOnion bool) string
- func LookupTransactions(...) (results []index.TransactionInputQueryResults)
- func ProbabilityEffort(effort float64) float64
- func ProbabilityMode(i ...float64) (n float64)
- func ProbabilityNShares(shares uint64, effort float64) float64
- func ProcessFullBlock(b *index.MainBlock, indexDb *index.Index) error
- func SendFoundBlock(w *index.MinerWebHook, ts int64, source *address.Address, ...) error
- func SendJsonPost(w *index.MinerWebHook, ts int64, source *address.Address, data any) error
- func SendOrphanedBlock(w *index.MinerWebHook, ts int64, source *address.Address, ...) error
- func SendPayout(w *index.MinerWebHook, ts int64, source *address.Address, payout *index.Payout) error
- func SendSideBlock(w *index.MinerWebHook, ts int64, source *address.Address, ...) error
- func SetWebHookProxy(hostPort string)
- func Shorten(value string, n int) string
- func ShortenSlice(value []byte, n int) []byte
- type JSONEvent
- type JSONWebHookDiscord
- type JSONWebHookDiscordComponentButton
- type JSONWebHookDiscordComponentRow
- type JSONWebHookDiscordEmbed
- type JSONWebHookDiscordEmbedField
- type MinerInfoBlockData
- type MinerInfoResult
- type PoolInfoResult
- type PoolInfoResultMainChain
- type PoolInfoResultMainChainConsensus
- type PoolInfoResultSideChain
- type PoolInfoResultSideChainEffort
- type PoolInfoResultSideChainEffortLastEntry
- type PoolInfoResultSideChainWindow
- type PositionChart
- func (p *PositionChart) Add(index int, value uint64)
- func (p *PositionChart) Resolution() uint64
- func (p *PositionChart) SetIdle(idleChar byte)
- func (p *PositionChart) Size() uint64
- func (p *PositionChart) String() string
- func (p *PositionChart) StringWithSeparator(index int) string
- func (p *PositionChart) StringWithoutDelimiters() string
- func (p *PositionChart) Total() (result uint64)
- type ReleaseDataJson
- type SideChainVersionEntry
- type SignedAction
- func SignedActionAddWebHook(realm, webhookType, webhookUrl string, other ...SignedActionEntry) *SignedAction
- func SignedActionRemoveWebHook(realm, webhookType, webhookUrlHash string, other ...SignedActionEntry) *SignedAction
- func SignedActionSetMinerAlias(realm, alias string) *SignedAction
- func SignedActionUnsetMinerAlias(realm string) *SignedAction
- func (a *SignedAction) Get(key string) (string, bool)
- func (a *SignedAction) String() string
- func (a *SignedAction) Verify(realm string, addr address.Interface, signature string) address.SignatureVerifyResult
- func (a *SignedAction) VerifyFallbackToZero(realm string, addr address.Interface, signature string) address.SignatureVerifyResult
- type SignedActionEntry
- type TransactionLookupResult
- type VersionInfo
Constants ¶
View Source
const ( JSONEventSideBlock = "side_block" JSONEventFoundBlock = "found_block" JSONEventOrphanedBlock = "orphaned_block" JSONEventPayout = "payout" )
View Source
const ( SiteKeyP2PoolIo = siteKey(iota) SiteKeyLocalMonero SiteKeyExploreMonero SiteKeyMoneroCom SiteKeyP2PoolObserver SiteKeyP2PoolObserverMini SiteKeyP2PoolObserverNano SiteKeyP2PoolObserverOld SiteKeyP2PoolObserverOldMini SiteKeyGitGammaspectraLive SiteKeyXmrChainNet SiteKeyMoneroHash SiteKeySethForPrivacy SiteKeyXmrVsBeast )
Variables ¶
View Source
var ( DiscordColorGreen uint64 = 5763719 DiscordColorDarkGreen uint64 = 2067276 DiscordColorOrange uint64 = 15105570 )
View Source
var WebHookClient = http.Client{ Timeout: 10 * time.Second, CheckRedirect: func(req *http.Request, via []*http.Request) error { return http.ErrUseLastResponse }, }
View Source
var WebHookHost string
View Source
var WebHookRateLimit = time.NewTicker(time.Second / 20)
View Source
var WebHookUserAgent string
View Source
var WebHookVersion = fmt.Sprintf("%d.%d", types.CurrentSoftwareVersion.Major(), types.CurrentSoftwareVersion.Minor())
Functions ¶
func CanSendToHook ¶
func CanSendToHook(w *index.MinerWebHook, key string) bool
func DecodeBinaryNumber ¶
func DecodeHexBinaryNumber ¶
func EncodeBinaryNumber ¶
func EncodeHexBinaryNumber ¶
func EncodeSliceBinaryNumber ¶
func FindAndInsertMainHeader ¶
func FindAndInsertMainHeader(h daemon.BlockHeader, indexDb *index.Index, storeFunc func(b *sidechain.PoolBlock), client *client.Client, difficultyByHeight block.GetDifficultyByHeightFunc, getByTemplateId sidechain.GetByTemplateIdFunc, getByMainId sidechain.GetByMainIdFunc, getByMainHeight sidechain.GetByMainHeightFunc, processBlock func(b *sidechain.PoolBlock) error) error
func FindAndInsertMainHeaderOutputs ¶
func FindAndInsertMainHeaderOutputs(mb *index.MainBlock, indexDb *index.Index, client *client.Client, difficultyByHeight block.GetDifficultyByHeightFunc, getByTemplateId sidechain.GetByTemplateIdFunc, getByMainId sidechain.GetByMainIdFunc, getByMainHeight sidechain.GetByMainHeightFunc, processBlock func(b *sidechain.PoolBlock) error) error
func GetSiteUrl ¶
func GetSiteUrlByHost ¶
func LookupTransactions ¶
func ProbabilityEffort ¶
func ProbabilityMode ¶
func ProbabilityNShares ¶
func SendFoundBlock ¶
func SendFoundBlock(w *index.MinerWebHook, ts int64, source *address.Address, block *index.FoundBlock, outputs index.MainCoinbaseOutputs) error
func SendJsonPost ¶
func SendOrphanedBlock ¶
func SendPayout ¶
func SendSideBlock ¶
func SetWebHookProxy ¶
func SetWebHookProxy(hostPort string)
func ShortenSlice ¶
Types ¶
type JSONEvent ¶
type JSONEvent struct {
Type string `json:"type"`
SideBlock *index.SideBlock `json:"side_block,omitempty"`
FoundBlock *index.FoundBlock `json:"found_block,omitempty"`
MainCoinbaseOutputs index.MainCoinbaseOutputs `json:"main_coinbase_outputs,omitempty"`
Payout *index.Payout `json:"payout,omitempty"`
}
type JSONWebHookDiscord ¶
type JSONWebHookDiscord struct {
Username string `json:"username,omitempty"`
AvatarUrl string `json:"avatar_url,omitempty"`
Content string `json:"content,omitempty"`
Embeds []JSONWebHookDiscordEmbed `json:"embeds,omitempty"`
Components []JSONWebHookDiscordComponentRow `json:"components,omitempty"`
TTS bool `json:"tts,omitempty"`
AllowedMentions *struct {
Parse []string `json:"parse,omitempty"`
Users []string `json:"users,omitempty"`
Roles []string `json:"roles,omitempty"`
} `json:"allowed_mentions,omitempty"`
}
type JSONWebHookDiscordComponentButton ¶
type JSONWebHookDiscordComponentButton struct {
Type int `json:"type"`
Style int `json:"style"`
Label string `json:"label,omitempty"`
Url string `json:"url,omitempty"`
}
func NewJSONWebHookDiscordComponentButton ¶
func NewJSONWebHookDiscordComponentButton(label, url string) JSONWebHookDiscordComponentButton
type JSONWebHookDiscordComponentRow ¶
type JSONWebHookDiscordComponentRow struct {
Type int `json:"type"`
Components []JSONWebHookDiscordComponentButton `json:"components"`
}
func NewJSONWebHookDiscordComponent ¶
func NewJSONWebHookDiscordComponent(b ...JSONWebHookDiscordComponentButton) JSONWebHookDiscordComponentRow
type JSONWebHookDiscordEmbed ¶
type JSONWebHookDiscordEmbed struct {
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Url string `json:"url,omitempty"`
// Timestamp Time in time.RFC3339 YYYY-MM-DDTHH:MM:SS.MSSZ format
Timestamp string `json:"timestamp,omitempty"`
Color *uint64 `json:"color,omitempty"`
Text string `json:"text,omitempty"`
} `json:"footer,omitempty"`
Image *struct {
Url string `json:"url,omitempty"`
} `json:"image,omitempty"`
Thumbnail *struct {
Url string `json:"url,omitempty"`
} `json:"thumbnail,omitempty"`
Provider *struct {
Name string `json:"name,omitempty"`
IconUrl string `json:"icon_url,omitempty"`
} `json:"provider,omitempty"`
Author *struct {
Name string `json:"name,omitempty"`
Url string `json:"url,omitempty"`
IconUrl string `json:"icon_url,omitempty"`
} `json:"author,omitempty"`
Fields []JSONWebHookDiscordEmbedField `json:"fields,omitempty"`
}
type MinerInfoBlockData ¶
type MinerInfoBlockData struct {
UncleCount uint64 `json:"uncles"`
}
type MinerInfoResult ¶
type PoolInfoResult ¶
type PoolInfoResult struct {
SideChain PoolInfoResultSideChain `json:"sidechain"`
MainChain PoolInfoResultMainChain `json:"mainchain"`
Versions struct {
P2Pool VersionInfo `json:"p2pool"`
Monero VersionInfo `json:"monero"`
} `json:"versions"`
}
type PoolInfoResultMainChain ¶
type PoolInfoResultMainChain struct {
Consensus PoolInfoResultMainChainConsensus `json:"consensus"`
Id types.Hash `json:"id"`
CoinbaseId types.Hash `json:"coinbase_id"`
Height uint64 `json:"height"`
Difficulty types.Difficulty `json:"difficulty"`
Reward uint64 `json:"reward"`
BaseReward uint64 `json:"base_reward"`
NextDifficulty types.Difficulty `json:"next_difficulty"`
// BlockTime included in Consensus
// Deprecated
BlockTime int `json:"block_time"`
}
type PoolInfoResultMainChainConsensus ¶
type PoolInfoResultMainChainConsensus struct {
BlockTime uint64 `json:"block_time"`
TransactionUnlockTime uint64 `json:"transaction_unlock_time"`
MinerRewardUnlockTime uint64 `json:"miner_reward_unlock_time"`
// HardForkSupportedVersion
HardForkSupportedVersion uint8 `json:"hard_fork_supported_version"`
// HardForks HardFork information for Monero known hardfork by backing p2pool
HardForks []monero.HardFork `json:"hard_forks,omitempty"`
}
type PoolInfoResultSideChain ¶
type PoolInfoResultSideChain struct {
// Consensus Specifies the consensus parameters for the backing p2pool instance
Consensus *sidechain.Consensus `json:"consensus"`
// LastBlock Last sidechain block on database
LastBlock *index.SideBlock `json:"last_block"`
// SecondsSinceLastBlock
// Prefer using max(0, time.Now().Unix()-int64(LastBlock .Timestamp)) instead
SecondsSinceLastBlock int64 `json:"seconds_since_last_block"`
// LastFound Last sidechain block on database found and accepted on Monero network
LastFound *index.FoundBlock `json:"last_found"`
Effort PoolInfoResultSideChainEffort `json:"effort"`
Window PoolInfoResultSideChainWindow `json:"window"`
// Found Total count of found blocks in database
Found uint64 `json:"found"`
// Miners Total count of miners in database
Miners uint64 `json:"miners"`
// Id Available on LastBlock .TemplateId
// Deprecated
Id types.Hash `json:"id"`
// Height Available on LastBlock .SideHeight
// Deprecated
Height uint64 `json:"height"`
// Version Available via sidechain.P2PoolShareVersion
// Deprecated
Version sidechain.ShareVersion `json:"version"`
// Difficulty Available on LastBlock .Difficulty
// Deprecated
Difficulty types.Difficulty `json:"difficulty"`
// CumulativeDifficulty Available on LastBlock .CumulativeDifficulty
// Deprecated
CumulativeDifficulty types.Difficulty `json:"cumulative_difficulty"`
// Timestamp Available on LastBlock .Timestamp
// Deprecated
Timestamp uint64 `json:"timestamp"`
// WindowSize Available on Window .Blocks
// Deprecated
WindowSize int `json:"window_size"`
// MaxWindowSize Available on Consensus
// Deprecated
MaxWindowSize int `json:"max_window_size"`
// BlockTime Available on Consensus
// Deprecated
BlockTime int `json:"block_time"`
// UnclePenalty Available on Consensus
// Deprecated
UnclePenalty int `json:"uncle_penalty"`
}
type PoolInfoResultSideChainEffort ¶
type PoolInfoResultSideChainEffort struct {
Current float64 `json:"current"`
Average10 float64 `json:"average10"`
Average50 float64 `json:"average"`
Average200 float64 `json:"average200"`
Last []PoolInfoResultSideChainEffortLastEntry `json:"last"`
}
type PoolInfoResultSideChainWindow ¶
type PoolInfoResultSideChainWindow struct {
// Miners Unique miners found in window
Miners int `json:"miners"`
// Blocks total count of blocks in the window, including uncles
Blocks int `json:"blocks"`
Uncles int `json:"uncles"`
// Top TemplateId of the window tip
Top types.Hash `json:"top"`
// Bottom TemplateId of the last non-uncle block in the window
Bottom types.Hash `json:"bottom"`
// BottomUncles TemplateId of the uncles included under the last block, if any
BottomUncles []types.Hash `json:"bottom_uncles,omitempty"`
Weight types.Difficulty `json:"weight"`
Versions []SideChainVersionEntry `json:"versions"`
}
type PositionChart ¶
type PositionChart struct {
// contains filtered or unexported fields
}
func NewPositionChart ¶
func NewPositionChart(size uint64, totalItems uint64) *PositionChart
func (*PositionChart) Add ¶
func (p *PositionChart) Add(index int, value uint64)
func (*PositionChart) Resolution ¶
func (p *PositionChart) Resolution() uint64
func (*PositionChart) SetIdle ¶
func (p *PositionChart) SetIdle(idleChar byte)
func (*PositionChart) Size ¶
func (p *PositionChart) Size() uint64
func (*PositionChart) String ¶
func (p *PositionChart) String() string
func (*PositionChart) StringWithSeparator ¶
func (p *PositionChart) StringWithSeparator(index int) string
func (*PositionChart) StringWithoutDelimiters ¶
func (p *PositionChart) StringWithoutDelimiters() string
func (*PositionChart) Total ¶
func (p *PositionChart) Total() (result uint64)
type ReleaseDataJson ¶
type SideChainVersionEntry ¶
type SideChainVersionEntry struct {
Weight types.Difficulty `json:"weight"`
Count int `json:"count"`
SoftwareId p2pooltypes.SoftwareId `json:"software_id"`
SoftwareVersion p2pooltypes.SoftwareVersion `json:"software_version"`
SoftwareString string `json:"software_string"`
}
type SignedAction ¶
type SignedAction struct {
Action string `json:"action"`
Data []SignedActionEntry `json:"data"`
Realm string `json:"realm"`
}
func SignedActionAddWebHook ¶
func SignedActionAddWebHook(realm, webhookType, webhookUrl string, other ...SignedActionEntry) *SignedAction
func SignedActionRemoveWebHook ¶
func SignedActionRemoveWebHook(realm, webhookType, webhookUrlHash string, other ...SignedActionEntry) *SignedAction
func SignedActionSetMinerAlias ¶
func SignedActionSetMinerAlias(realm, alias string) *SignedAction
func SignedActionUnsetMinerAlias ¶
func SignedActionUnsetMinerAlias(realm string) *SignedAction
func (*SignedAction) String ¶
func (a *SignedAction) String() string
String Creates a consistent string for signing
func (*SignedAction) Verify ¶
func (a *SignedAction) Verify(realm string, addr address.Interface, signature string) address.SignatureVerifyResult
func (*SignedAction) VerifyFallbackToZero ¶
func (a *SignedAction) VerifyFallbackToZero(realm string, addr address.Interface, signature string) address.SignatureVerifyResult
type SignedActionEntry ¶
type TransactionLookupResult ¶
type TransactionLookupResult struct {
Id types.Hash `json:"id"`
Inputs index.TransactionInputQueryResults `json:"inputs"`
Outs []client.Output `json:"outs"`
Match []index.TransactionInputQueryResultsMatch `json:"matches"`
}
type VersionInfo ¶
type VersionInfo struct {
Version string `json:"version"`
Timestamp int64 `json:"timestamp"`
Link string `json:"link"`
CheckedTimestamp int64 `json:"-"`
}
func (VersionInfo) ShortVersion ¶
func (v VersionInfo) ShortVersion() p2pooltypes.SemanticVersion
Click to show internal directories.
Click to hide internal directories.