launch

package
v0.0.0-...-8c25bd3 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: GPL-3.0 Imports: 62 Imported by: 7

Documentation

Index

Constants

View Source
const (
	ReadAllowACLPerm  = ACLPerm(2)
	WriteAllowACLPerm = ACLPerm(3)
)

Variables

View Source
var (
	DefaultNetworkBind                  = &net.UDPAddr{IP: net.ParseIP("127.0.0.1"), Port: 4321} //nolint:mnd //...
	DefaultNetworkPublish               = &net.UDPAddr{IP: net.ParseIP("127.0.0.1"), Port: 4321} //nolint:mnd //...
	DefaultStorageBase                  string
	DefaultStorageDatabaseDirectoryName = "db"
)
View Source
var (
	DefaultNodeInfoHint = hint.MustNewHint("default-node-info-v0.0.1")
	NodeInfoFilename    = "info.json"
)
View Source
var (
	PNameLoadACL  = ps.Name("load-acl")
	ACLContextKey = util.ContextKey("acl")
)
View Source
var (
	PNameDesign                 = ps.Name("design")
	PNameCheckDesign            = ps.Name("check-design")
	PNameINITObjectCache        = ps.Name("init-object-cache")
	PNameGenesisDesign          = ps.Name("genesis-design")
	DesignFlagContextKey        = util.ContextKey("design-flag")
	DevFlagsContextKey          = util.ContextKey("dev-flags")
	GenesisDesignFileContextKey = util.ContextKey("genesis-design-file")
	DesignContextKey            = util.ContextKey("design")
	DesignStringContextKey      = util.ContextKey("design-string")
	GenesisDesignContextKey     = util.ContextKey("genesis-design")
	PrivatekeyContextKey        = util.ContextKey("privatekey-from")
	ACLFlagsContextKey          = util.ContextKey("acl-from")
)
View Source
var (
	PNameDiscoveryFlag      = ps.Name("discovery-flag")
	DiscoveryFlagContextKey = util.ContextKey("discovery-flag")
	DiscoveryContextKey     = util.ContextKey("discovery")
)
View Source
var (
	PNameEncoder       = ps.Name("encoder")
	PNameAddHinters    = ps.Name("add-hinters")
	EncodersContextKey = util.ContextKey("encoders")
)
View Source
var (
	PNameLocal            = ps.Name("local")
	LocalContextKey       = util.ContextKey("local")
	LocalParamsContextKey = util.ContextKey("local-params")
	ISAACParamsContextKey = util.ContextKey("isaac-params")
)
View Source
var (
	PNameMemberlist                         = ps.Name("memberlist")
	PNameStartMemberlist                    = ps.Name("start-memberlist")
	PNameLongRunningMemberlistJoin          = ps.Name("long-running-memberlist-join")
	PNameSuffrageVoting                     = ps.Name("suffrage-voting")
	PNamePatchMemberlist                    = ps.Name("patch-memberlist")
	MemberlistContextKey                    = util.ContextKey("memberlist")
	LongRunningMemberlistJoinContextKey     = util.ContextKey("long-running-memberlist-join")
	EventWhenMemberLeftContextKey           = util.ContextKey("event-when-member-left")
	SuffrageVotingContextKey                = util.ContextKey("suffrage-voting")
	SuffrageVotingVoteFuncContextKey        = util.ContextKey("suffrage-voting-vote-func")
	FilterMemberlistNotifyMsgFuncContextKey = util.ContextKey("filter-memberlist-notify-msg-func")
)
View Source
var (
	PNameNetwork                 = ps.Name("network")
	PNameStartNetwork            = ps.Name("start-network")
	PNameQuicstreamClient        = ps.Name("network-client")
	QuicstreamClientContextKey   = util.ContextKey("network-client")
	QuicstreamServerContextKey   = util.ContextKey("quicstream-server")
	QuicstreamHandlersContextKey = util.ContextKey("quicstream-handlers")
	ConnectionPoolContextKey     = util.ContextKey("network-connection-pool")
)
View Source
var (
	PNameNetworkHandlers             = ps.Name("network-handlers")
	PNameOperationProcessorsMap      = ps.Name("operation-processors-map")
	OperationProcessorsMapContextKey = util.ContextKey("operation-processors-map")
)
View Source
var (
	//revive:disable:line-length-limit
	HandlerNameMemberlistCallbackBroadcastMessage quicstream.HandlerName = "memberlist_callback_broadcast_message"
	HandlerNameMemberlistEnsureBroadcastMessage   quicstream.HandlerName = "memberlist_ensure_broadcast_message"
)
View Source
var (
	ReadNodeHeaderHint  = hint.MustNewHint("read-node-header-v0.0.1")
	WriteNodeHeaderHint = hint.MustNewHint("write-node-header-v0.0.1")
)
View Source
var (
	HandlerNameNodeRead  quicstream.HandlerName = "node_read"
	HandlerNameNodeWrite quicstream.HandlerName = "node_write"
)
View Source
var (
	DesignACLScope               = ACLScope("design")
	StatesAllowConsensusACLScope = ACLScope("states.allow_consensus")
	DiscoveryACLScope            = ACLScope("discovery")
	ACLACLScope                  = ACLScope("acl")
	BlockItemFilesACLScope       = ACLScope("block_item_files")
)
View Source
var (
	PNameNodeInfo      = ps.Name("nodeinfo")
	NodeInfoContextKey = util.ContextKey("nodeinfo")
)
View Source
var (
	PNameProposalMaker      = ps.Name("proposal-maker")
	ProposalMakerContextKey = util.ContextKey("proposal-maker")
)
View Source
var (
	PNameRateLimiterContextKey = ps.Name("network-ratelimiter")
	RateLimiterContextKey      = util.ContextKey("network-ratelimiter")
)
View Source
var (
	PNameBlockItemReadersDecompressFunc      = ps.Name("block-item-readers-decompress-func")
	PNameBlockItemReaders                    = ps.Name("block-item-readers")
	PNameRemotesBlockItemReaderFunc          = ps.Name("remotes-block-item-reader-func")
	BlockItemReadersDecompressFuncContextKey = util.ContextKey("block-item-readers-decompress-func")
	NewBlockItemReadersFuncContextKey        = util.ContextKey("new-block-item-readers-func")
	BlockItemReadersContextKey               = util.ContextKey("block-item-readers")
	RemotesBlockItemReaderFuncContextKey     = util.ContextKey("remotes-block-item-reader-func")
)
View Source
var (
	PNameStatesReady                                = ps.Name("states-ready")
	PNameStates                                     = ps.Name("states")
	PNameBallotbox                                  = ps.Name("ballotbox")
	PNameProposalProcessors                         = ps.Name("proposal-processors")
	PNameStatesSetHandlers                          = ps.Name("states-set-handlers")
	PNameProposerSelector                           = ps.Name("proposer-selector")
	PNameBallotStuckResolver                        = ps.Name("ballot-stuck-resolver")
	BallotboxContextKey                             = util.ContextKey("ballotbox")
	StatesContextKey                                = util.ContextKey("states")
	ProposalProcessorsContextKey                    = util.ContextKey("proposal-processors")
	ProposerSelectFuncContextKey                    = util.ContextKey("proposer-select-func")
	ProposalSelectFuncContextKey                    = util.ContextKey("proposal-select-func")
	WhenNewBlockSavedInSyncingStateFuncContextKey   = util.ContextKey("when-new-block-saved-in-syncing-state-func")
	WhenNewBlockSavedInConsensusStateFuncContextKey = util.ContextKey("when-new-block-saved-in-consensus-state-func")
	WhenNewBlockConfirmedFuncContextKey             = util.ContextKey("when-new-block-confirmed-func")
	BallotStuckResolverContextKey                   = util.ContextKey("ballot-stuck-resolver")
)
View Source
var (
	PNameStorage                    = ps.Name("storage")
	PNameStartStorage               = ps.Name("start-storage")
	PNameCheckLeveldbStorage        = ps.Name("check-leveldb-storage")
	PNameLoadFromDatabase           = ps.Name("load-from-database")
	PNameCleanStorage               = ps.Name("clean-storage")
	PNameCreateLocalFS              = ps.Name("create-localfs")
	PNameCheckLocalFS               = ps.Name("check-localfs")
	PNameLoadDatabase               = ps.Name("load-database")
	PNameCheckBlocksOfStorage       = ps.Name("check-blocks-of-storage")
	PNamePatchBlockItemReaders      = ps.Name("patch-block-item-readers")
	FSNodeInfoContextKey            = util.ContextKey("fs-node-info")
	LeveldbStorageContextKey        = util.ContextKey("leveldb-storage")
	CenterDatabaseContextKey        = util.ContextKey("center-database")
	PermanentDatabaseContextKey     = util.ContextKey("permanent-database")
	PoolDatabaseContextKey          = util.ContextKey("pool-database")
	LastVoteproofsHandlerContextKey = util.ContextKey("last-voteproofs-handler")
	EventLoggingContextKey          = util.ContextKey("event-log")
)
View Source
var (
	LocalFSDataDirectoryName           = "data"
	LocalFSDatabaseDirectoryName       = "db"
	LocalFSEventDatabaseDirectoryName  = "event"
	LeveldbURIScheme                   = "leveldb"
	RedisPermanentDatabasePrefixFormat = "mitum-%s"
)
View Source
var (
	PNameSuffrageCandidateLimiterSet      = ps.Name("suffrage-candidate-limiter-set")
	PNamePatchLastConsensusNodesWatcher   = ps.Name("patch-last-consensus-nodes-watcher")
	PNameLastConsensusNodesWatcher        = ps.Name("last-consensus-nodes-watcher")
	PNameStartLastConsensusNodesWatcher   = ps.Name("start-last-consensus-nodes-watcher")
	PNameNodeInConsensusNodesFunc         = ps.Name("node-in-consensus-nodes-func")
	SuffrageCandidateLimiterSetContextKey = util.ContextKey("suffrage-candidate-limiter-set")
	LastConsensusNodesWatcherContextKey   = util.ContextKey("last-consensus-nodes-watcher")
	NodeInConsensusNodesFuncContextKey    = util.ContextKey("node-in-consensus-nodes-func")
	SuffragePoolContextKey                = util.ContextKey("suffrage-pool")
)
View Source
var (
	PNameSyncSourceChecker      = ps.Name("sync-source-checker")
	PNameStartSyncSourceChecker = ps.Name("start-sync-source-checker")
	SyncSourceCheckerContextKey = util.ContextKey("sync-source-checker")
	SyncSourcePoolContextKey    = util.ContextKey("sync-source-pool")
)
View Source
var (
	PNameTimeSyncer      = ps.Name("time-syncer")
	TimeSyncerContextKey = util.ContextKey("time-syncer")
)
View Source
var (
	PNameLogging        = ps.Name("logging")
	PNameLoggingWithCLI = ps.Name("logging-cli")
)
View Source
var (
	VersionContextKey     = util.ContextKey("version")
	FlagsContextKey       = util.ContextKey("flags")
	KongContextContextKey = util.ContextKey("kong-context")
	LoggingContextKey     = util.ContextKey("logging")
	LogOutContextKey      = util.ContextKey("log-out")
)
View Source
var (
	RateLimiterLimiterNameContextKey   = util.ContextKey("ratelimit-limiter-name")
	RateLimiterClientIDContextKey      = util.ContextKey("ratelimit-limiter-clientid")
	RateLimiterResultContextKey        = util.ContextKey("ratelimit-limiter-result")
	RateLimiterResultAllowedContextKey = util.ContextKey("ratelimit-limiter-result-allowed")
)
View Source
var AllNodeReadKeys = []string{
	"states.allow_consensus",
	"design._source",
	"design._generated",
	"discovery",
	"acl",
	"block_item_files",
}
View Source
var AllNodeWriteKeys = []string{
	"states.allow_consensus",
	"design.parameters.isaac.threshold",
	"design.parameters.isaac.interval_broadcast_ballot",
	"design.parameters.isaac.wait_preparing_init_ballot",
	"design.parameters.isaac.max_try_handover_y_broker_sync_data",
	"design.parameters.misc.sync_source_checker_interval",
	"design.parameters.misc.valid_proposal_operation_expire",
	"design.parameters.misc.valid_proposal_suffrage_operations_expire",
	"design.parameters.misc.max_message_size",
	"design.parameters.memberlist.extra_same_member_limit",
	"design.parameters.network.timeout_request",
	"design.parameters.network.ratelimit",
	"design.sync_sources",
	"discovery",
	"acl",
}
View Source
var DefaultDesignURI = "./config.yml"
View Source
var ErrACLAccessDenied = util.NewIDError("access denied")
View Source
var (
	ErrRateLimited = util.NewIDError("over ratelimit")
)
View Source
var EventLoggingACLScope = ACLScope("event-log")
View Source
var EventLoggingHeaderHint = hint.MustNewHint("event-header-v0.0.1")
View Source
var (
	HandlerNameEventLogging quicstream.HandlerName = "event"
)
View Source
var HandlerNameMemberlist quicstream.HandlerName = "memberlist"
View Source
var HandoverACLScope = ACLScope("handover")
View Source
var Hinters = []encoder.DecodeDetail{

	{Hint: DefaultNodeInfoHint, Instance: DefaultNodeInfo{}},
	{Hint: EventLoggingHeaderHint, Instance: EventLoggingHeader{}},
	{Hint: base.BaseOperationProcessReasonErrorHint, Instance: base.BaseOperationProcessReasonError{}},
	{Hint: base.BaseStateHint, Instance: base.BaseState{}},
	{Hint: base.MPrivatekeyHint, Instance: &base.MPrivatekey{}},
	{Hint: base.MPublickeyHint, Instance: &base.MPublickey{}},
	{Hint: base.OperationFixedtreeHint, Instance: base.OperationFixedtreeNode{}},
	{Hint: base.StateFixedtreeHint, Instance: fixedtree.BaseNode{}},
	{Hint: base.StringAddressHint, Instance: base.StringAddress{}},
	{Hint: isaac.ACCEPTBallotFactHint, Instance: isaac.ACCEPTBallotFact{}},
	{Hint: isaac.ACCEPTBallotHint, Instance: isaac.ACCEPTBallot{}},
	{Hint: isaac.ACCEPTBallotSignFactHint, Instance: isaac.ACCEPTBallotSignFact{}},
	{Hint: isaac.ACCEPTVoteproofHint, Instance: isaac.ACCEPTVoteproof{}},
	{Hint: isaac.ACCEPTExpelVoteproofHint, Instance: isaac.ACCEPTExpelVoteproof{}},
	{Hint: isaac.ACCEPTStuckVoteproofHint, Instance: isaac.ACCEPTStuckVoteproof{}},
	{Hint: isaac.FixedSuffrageCandidateLimiterRuleHint, Instance: isaac.FixedSuffrageCandidateLimiterRule{}},
	{Hint: isaac.INITBallotFactHint, Instance: isaac.INITBallotFact{}},
	{Hint: isaac.EmptyProposalINITBallotFactHint, Instance: isaac.EmptyProposalINITBallotFact{}},
	{Hint: isaac.EmptyOperationsACCEPTBallotFactHint, Instance: isaac.EmptyOperationsACCEPTBallotFact{}},
	{Hint: isaac.NotProcessedACCEPTBallotFactHint, Instance: isaac.NotProcessedACCEPTBallotFact{}},
	{Hint: isaac.INITBallotHint, Instance: isaac.INITBallot{}},
	{Hint: isaac.INITBallotSignFactHint, Instance: isaac.INITBallotSignFact{}},
	{Hint: isaac.INITVoteproofHint, Instance: isaac.INITVoteproof{}},
	{Hint: isaac.INITExpelVoteproofHint, Instance: isaac.INITExpelVoteproof{}},
	{Hint: isaac.INITStuckVoteproofHint, Instance: isaac.INITStuckVoteproof{}},
	{Hint: isaac.ParamsHint, Instance: &isaac.Params{}},
	{Hint: isaac.ManifestHint, Instance: isaac.Manifest{}},
	{Hint: isaac.NetworkPolicyHint, Instance: isaac.NetworkPolicy{}},
	{Hint: isaac.NetworkPolicyStateValueHint, Instance: isaac.NetworkPolicyStateValue{}},
	{Hint: isaac.NodeHint, Instance: base.BaseNode{}},
	{Hint: isaac.ProposalFactHint, Instance: isaac.ProposalFact{}},
	{Hint: isaac.ProposalSignFactHint, Instance: isaac.ProposalSignFact{}},
	{Hint: isaac.SuffrageConfirmBallotFactHint, Instance: isaac.SuffrageConfirmBallotFact{}},
	{Hint: isaac.SuffrageCandidateStateValueHint, Instance: isaac.SuffrageCandidateStateValue{}},
	{Hint: isaac.SuffrageCandidatesStateValueHint, Instance: isaac.SuffrageCandidatesStateValue{}},
	{Hint: isaac.SuffrageNodeStateValueHint, Instance: isaac.SuffrageNodeStateValue{}},
	{Hint: isaac.SuffrageNodesStateValueHint, Instance: isaac.SuffrageNodesStateValue{}},
	{Hint: isaac.SuffrageExpelOperationHint, Instance: isaac.SuffrageExpelOperation{}},
	{Hint: isaacblock.BlockMapHint, Instance: isaacblock.BlockMap{}},
	{Hint: isaac.BlockItemFileHint, Instance: isaac.BlockItemFile{}},
	{Hint: isaac.BlockItemFilesHint, Instance: isaac.BlockItemFiles{}},
	{Hint: isaacblock.SuffrageProofHint, Instance: isaacblock.SuffrageProof{}},
	{
		Hint:     isaacnetwork.ExistsInStateOperationRequestHeaderHint,
		Instance: isaacnetwork.ExistsInStateOperationRequestHeader{},
	},
	{Hint: isaacnetwork.SetAllowConsensusHeaderHint, Instance: isaacnetwork.SetAllowConsensusHeader{}},
	{Hint: isaacnetwork.BlockItemRequestHeaderHint, Instance: isaacnetwork.BlockItemRequestHeader{}},
	{Hint: isaacnetwork.BlockItemFilesRequestHeaderHint, Instance: isaacnetwork.BlockItemFilesRequestHeader{}},
	{Hint: isaacnetwork.BlockMapRequestHeaderHint, Instance: isaacnetwork.BlockMapRequestHeader{}},
	{Hint: isaacnetwork.LastBlockMapRequestHeaderHint, Instance: isaacnetwork.LastBlockMapRequestHeader{}},
	{Hint: isaacnetwork.LastSuffrageProofRequestHeaderHint, Instance: isaacnetwork.LastSuffrageProofRequestHeader{}},
	{Hint: isaacnetwork.NodeChallengeRequestHeaderHint, Instance: isaacnetwork.NodeChallengeRequestHeader{}},
	{Hint: isaacnetwork.NodeInfoHint, Instance: isaacnetwork.NodeInfo{}},
	{Hint: isaacnetwork.NodeInfoRequestHeaderHint, Instance: isaacnetwork.NodeInfoRequestHeader{}},
	{Hint: isaacnetwork.OperationRequestHeaderHint, Instance: isaacnetwork.OperationRequestHeader{}},
	{Hint: isaacnetwork.ProposalRequestHeaderHint, Instance: isaacnetwork.ProposalRequestHeader{}},
	{Hint: isaacnetwork.RequestProposalRequestHeaderHint, Instance: isaacnetwork.RequestProposalRequestHeader{}},
	{Hint: isaacnetwork.SendBallotsHeaderHint, Instance: isaacnetwork.SendBallotsHeader{}},
	{Hint: isaacnetwork.SendOperationRequestHeaderHint, Instance: isaacnetwork.SendOperationRequestHeader{}},
	{Hint: isaacnetwork.StateRequestHeaderHint, Instance: isaacnetwork.StateRequestHeader{}},
	{Hint: isaacnetwork.StreamOperationsHeaderHint, Instance: isaacnetwork.StreamOperationsHeader{}},
	{
		Hint:     isaacnetwork.SuffrageNodeConnInfoRequestHeaderHint,
		Instance: isaacnetwork.SuffrageNodeConnInfoRequestHeader{},
	},
	{Hint: isaacnetwork.SuffrageProofRequestHeaderHint, Instance: isaacnetwork.SuffrageProofRequestHeader{}},

	{Hint: isaacnetwork.AskHandoverHeaderHint, Instance: isaacnetwork.AskHandoverHeader{}},
	{Hint: isaacnetwork.AskHandoverResponseHeaderHint, Instance: isaacnetwork.AskHandoverResponseHeader{}},
	{Hint: isaacnetwork.BlockItemResponseHeaderHint, Instance: isaacnetwork.BlockItemResponseHeader{}},
	{Hint: isaacnetwork.CancelHandoverHeaderHint, Instance: isaacnetwork.CancelHandoverHeader{}},
	{Hint: isaacnetwork.CheckHandoverHeaderHint, Instance: isaacnetwork.CheckHandoverHeader{}},
	{Hint: isaacnetwork.CheckHandoverXHeaderHint, Instance: isaacnetwork.CheckHandoverXHeader{}},
	{Hint: isaacnetwork.HandoverMessageHeaderHint, Instance: isaacnetwork.HandoverMessageHeader{}},
	{Hint: isaacnetwork.StartHandoverHeaderHint, Instance: isaacnetwork.StartHandoverHeader{}},
	{Hint: isaacnetwork.SyncSourceConnInfoRequestHeaderHint, Instance: isaacnetwork.SyncSourceConnInfoRequestHeader{}},

	{Hint: isaacoperation.GenesisNetworkPolicyFactHint, Instance: isaacoperation.GenesisNetworkPolicyFact{}},
	{Hint: isaacoperation.GenesisNetworkPolicyHint, Instance: isaacoperation.GenesisNetworkPolicy{}},
	{Hint: isaacoperation.NetworkPolicyHint, Instance: isaacoperation.NetworkPolicy{}},
	{Hint: isaacoperation.SuffrageCandidateHint, Instance: isaacoperation.SuffrageCandidate{}},
	{Hint: isaacoperation.SuffrageGenesisJoinHint, Instance: isaacoperation.SuffrageGenesisJoin{}},
	{Hint: isaacoperation.SuffrageDisjoinHint, Instance: isaacoperation.SuffrageDisjoin{}},
	{Hint: isaacoperation.SuffrageJoinHint, Instance: isaacoperation.SuffrageJoin{}},
	{
		Hint:     isaacoperation.SuffrageGenesisJoinFactHint,
		Instance: isaacoperation.SuffrageGenesisJoinFact{},
	},
	{Hint: isaacstates.MissingBallotsRequestsMessageHint, Instance: isaacstates.MissingBallotsRequestMessage{}},

	{Hint: isaacstates.HandoverMessageCancelHint, Instance: isaacstates.HandoverMessageCancel{}},
	{Hint: isaacstates.HandoverMessageChallengeBlockMapHint, Instance: isaacstates.HandoverMessageChallengeBlockMap{}},
	{Hint: isaacstates.HandoverMessageChallengeResponseHint, Instance: isaacstates.HandoverMessageChallengeResponse{}},
	{
		Hint:     isaacstates.HandoverMessageChallengeStagePointHint,
		Instance: isaacstates.HandoverMessageChallengeStagePoint{},
	},
	{Hint: isaacstates.HandoverMessageDataHint, Instance: isaacstates.HandoverMessageData{}},
	{Hint: isaacstates.HandoverMessageFinishHint, Instance: isaacstates.HandoverMessageFinish{}},

	{Hint: quicmemberlist.ConnInfoBroadcastMessageHint, Instance: quicmemberlist.ConnInfoBroadcastMessage{}},
	{
		Hint:     quicmemberlist.CallbackBroadcastMessageHeaderHint,
		Instance: quicmemberlist.CallbackBroadcastMessageHeader{},
	},
	{
		Hint:     quicmemberlist.EnsureBroadcastMessageHeaderHint,
		Instance: quicmemberlist.EnsureBroadcastMessageHeader{},
	},
	{Hint: quicmemberlist.MemberHint, Instance: quicmemberlist.BaseMember{}},
	{Hint: quicstreamheader.DefaultResponseHeaderHint, Instance: quicstreamheader.DefaultResponseHeader{}},

	{Hint: ReadNodeHeaderHint, Instance: ReadNodeHeader{}},
	{Hint: WriteNodeHeaderHint, Instance: WriteNodeHeader{}},
}
View Source
var LeveldbLabelEventDatabase = leveldbstorage.KeyPrefix{0x02, 0x00}
View Source
var (
	NetworkHandlerPrefixMapRev = map[quicstream.HandlerPrefix]quicstream.HandlerName{}
)
View Source
var PNameEventLoggingNetworkHandlers = ps.Name("event-log-network-handlers")
View Source
var PNameGenerateGenesis = ps.Name("generate-genesis")
View Source
var PNameHandoverNetworkHandlers = ps.Name("handover-network-handlers")
View Source
var PNameNetworkHandlersReadWriteNode = ps.Name("node-network-handler")
View Source
var PNameStatesNetworkHandlers = ps.Name("states-network-handlers")

Functions

func ACLNetworkHandler

func ACLNetworkHandler[T quicstreamheader.RequestHeader](
	aclallow ACLAllowFunc,
	scope ACLScope,
	required ACLPerm,
	networkID base.NetworkID,
) quicstreamheader.Handler[T]

func AttachBlockItemsNetworkHandlers

func AttachBlockItemsNetworkHandlers(pctx context.Context) error

func AttachHandlerOperation

func AttachHandlerOperation(pctx context.Context) error

func AttachHandlerProposals

func AttachHandlerProposals(pctx context.Context) error

func AttachHandlerSendOperation

func AttachHandlerSendOperation(pctx context.Context) error

func AttachHandlerStreamOperations

func AttachHandlerStreamOperations(pctx context.Context) error

func AttachMemberlistNetworkHandlers

func AttachMemberlistNetworkHandlers(pctx context.Context) error

func CleanStorage

func CleanStorage(
	permuri, root string,
	encs *encoder.Encoders,
	enc encoder.Encoder,
) error

func DecodePrivatekey

func DecodePrivatekey(s string, enc encoder.Encoder) (base.Privatekey, error)

func DefaultDialQuicConfig

func DefaultDialQuicConfig() *quic.Config

func DefaultINITPS

func DefaultINITPS() *ps.PS

func DefaultImportPS

func DefaultImportPS() *ps.PS

func DefaultMainPS

func DefaultMainPS() *ps.PS

func DefaultRunPS

func DefaultRunPS() *ps.PS

func DefaultServerQuicConfig

func DefaultServerQuicConfig() *quic.Config

func DefaultWhenNewBlockConfirmedFunc

func DefaultWhenNewBlockConfirmedFunc(log *logging.Logging) func(base.Height)

func DefaultWhenNewBlockSavedInConsensusStateFunc

func DefaultWhenNewBlockSavedInConsensusStateFunc(
	log *logging.Logging,
	ballotbox *isaacstates.Ballotbox,
	db isaac.Database,
	nodeinfo *isaacnetwork.NodeInfoUpdater,
) func(base.BlockMap)

func DefaultWhenNewBlockSavedInSyncingStateFunc

func DefaultWhenNewBlockSavedInSyncingStateFunc(
	log *logging.Logging,
	db isaac.Database,
	nodeinfo *isaacnetwork.NodeInfoUpdater,
) func(base.Height)

func DialQuicConfig

func DialQuicConfig(params *NetworkParams) *quic.Config

func EventLoggingFromNetworkHandler

func EventLoggingFromNetworkHandler(
	ctx context.Context,
	stream quicstreamheader.StreamFunc,
	header EventLoggingHeader,
	priv base.Privatekey,
	networkID base.NetworkID,
	f func(addedAt time.Time, offset int64, raw []byte) (bool, error),
) error

func EventNameKeyPrefix

func EventNameKeyPrefix(name EventLoggerName) [32]byte

func GenerateNewTLSConfig

func GenerateNewTLSConfig(networkID base.NetworkID) *tls.Config

func GetDiscoveriesFromLocked

func GetDiscoveriesFromLocked(l *util.Locked[[]quicstream.ConnInfo]) []quicstream.ConnInfo

func ImportBlocks

func ImportBlocks(
	fromreaders *isaac.BlockItemReaders,
	fromremotes isaac.RemotesBlockItemReadFunc,
	toreaders *isaac.BlockItemReaders,
	fromHeight, toHeight base.Height,
	encs *encoder.Encoders,
	db isaac.Database,
	params *isaac.Params,
) error

func IsSupportedProposalOperationFactHintFunc

func IsSupportedProposalOperationFactHintFunc() func(hint.Hint) bool

func IsValidSyncSourcesDesign

func IsValidSyncSourcesDesign(
	d *SyncSourcesDesign,
	localPublishString, localPublishResolved string,
) error

func LoadDatabase

func LoadDatabase(
	fsnodeinfo NodeInfo,
	permuri string,
	root string,
	encs *encoder.Encoders,
	enc encoder.Encoder,
	stcachesize,
	oppoolcachesize int,
) (
	*leveldbstorage.Storage,
	*isaacdatabase.Center,
	isaac.PermanentDatabase,
	*isaacdatabase.TempPool,
	error,
)

func LoadDefaultEventStorage

func LoadDefaultEventStorage(
	dir string, readonly bool,
) (*leveldbstorage.Storage, error)

func LoadEventInfoFromKey

func LoadEventInfoFromKey(k []byte) (t time.Time, offset int64, _ error)

func LoadHinters

func LoadHinters(encs *encoder.Encoders) error

func LoadInputFlag

func LoadInputFlag(s string, isfile bool) ([]byte, error)

func LoadPermanentDatabase

func LoadPermanentDatabase(
	uri, id string,
	encs *encoder.Encoders,
	enc encoder.Encoder,
	root string,
	stcachesize int,
) (*leveldbstorage.Storage, isaac.PermanentDatabase, error)

func LoadRawEvent

func LoadRawEvent(raw []byte) ([]byte, error)

func LocalFSDataDirectory

func LocalFSDataDirectory(root string) string

func LocalFSDatabaseDirectory

func LocalFSDatabaseDirectory(root string) string

func LocalFSEventDatabaseDirectory

func LocalFSEventDatabaseDirectory(root string) string

func LocalFromDesign

func LocalFromDesign(design NodeDesign) (base.LocalNode, error)

func NewBlockWriterFunc

func NewBlockWriterFunc(
	local base.LocalNode,
	networkID base.NetworkID,
	dataroot string,
	jsonenc, enc encoder.Encoder,
	db isaac.Database,
	workersize int64,
	stcachesize int,
) isaac.NewBlockWriterFunc

func NewConnInfoDialFunc

func NewConnInfoDialFunc(networkID base.NetworkID, params *NetworkParams) quicstream.ConnInfoDialFunc

func NewConnectionPool

func NewConnectionPool(
	size uint64, networkID base.NetworkID, params *NetworkParams,
) (*quicstream.ConnectionPool, error)

func NewNetworkClient

func NewNetworkClient(
	encs *encoder.Encoders,
	enc encoder.Encoder,
	connectionPool *quicstream.ConnectionPool,
) *isaacnetwork.BaseClient

func NewProposalSelector

func NewProposalSelector(pctx context.Context) (*isaac.BaseProposalSelector, error)

func PAddHinters

func PAddHinters(pctx context.Context) (context.Context, error)

func PBallotStuckResolver

func PBallotStuckResolver(pctx context.Context) (context.Context, error)

func PBallotbox

func PBallotbox(pctx context.Context) (context.Context, error)

func PBlockItemReaders

func PBlockItemReaders(pctx context.Context) (context.Context, error)

func PBlockItemReadersDecompressFunc

func PBlockItemReadersDecompressFunc(pctx context.Context) (context.Context, error)

func PCheckAndCreateLocalFS

func PCheckAndCreateLocalFS(pctx context.Context) (context.Context, error)

func PCheckBlocksOfStorage

func PCheckBlocksOfStorage(pctx context.Context) (context.Context, error)

func PCheckDesign

func PCheckDesign(pctx context.Context) (context.Context, error)

func PCheckLeveldbStorage

func PCheckLeveldbStorage(pctx context.Context) (context.Context, error)

func PCheckLocalFS

func PCheckLocalFS(pctx context.Context) (context.Context, error)

func PCleanStorage

func PCleanStorage(pctx context.Context) (context.Context, error)

func PCloseLastConsensusNodesWatcher

func PCloseLastConsensusNodesWatcher(pctx context.Context) (context.Context, error)

func PCloseMemberlist

func PCloseMemberlist(pctx context.Context) (context.Context, error)

func PCloseNetwork

func PCloseNetwork(pctx context.Context) (context.Context, error)

func PCloseStates

func PCloseStates(pctx context.Context) (context.Context, error)

func PCloseStorage

func PCloseStorage(pctx context.Context) (context.Context, error)

func PCloseSyncSourceChecker

func PCloseSyncSourceChecker(pctx context.Context) (context.Context, error)

func PCloseTimeSyncer

func PCloseTimeSyncer(pctx context.Context) (context.Context, error)

func PCreateLocalFS

func PCreateLocalFS(pctx context.Context) (context.Context, error)

func PDiscoveryFlag

func PDiscoveryFlag(pctx context.Context) (context.Context, error)

func PEncoder

func PEncoder(pctx context.Context) (context.Context, error)

func PEventLoggingNetworkHandlers

func PEventLoggingNetworkHandlers(pctx context.Context) (context.Context, error)

func PGenerateGenesis

func PGenerateGenesis(pctx context.Context) (context.Context, error)

func PGenesisDesign

func PGenesisDesign(pctx context.Context) (context.Context, error)

func PHandoverNetworkHandlers

func PHandoverNetworkHandlers(pctx context.Context) (context.Context, error)

func PINIT

func PINIT(pctx context.Context) (context.Context, error)

func PINITObjectCache

func PINITObjectCache(pctx context.Context) (context.Context, error)

func PLastConsensusNodesWatcher

func PLastConsensusNodesWatcher(pctx context.Context) (context.Context, error)

func PLoadACL

func PLoadACL(pctx context.Context) (context.Context, error)

func PLoadDatabase

func PLoadDatabase(pctx context.Context) (context.Context, error)

func PLoadDesign

func PLoadDesign(pctx context.Context) (context.Context, error)

func PLoadFromDatabase

func PLoadFromDatabase(pctx context.Context) (context.Context, error)

func PLocal

func PLocal(pctx context.Context) (context.Context, error)

func PLogging

func PLogging(pctx context.Context) (context.Context, error)

func PLoggingWithCLI

func PLoggingWithCLI(pctx context.Context) (context.Context, error)

func PLongRunningMemberlistJoin

func PLongRunningMemberlistJoin(pctx context.Context) (context.Context, error)

func PMemberlist

func PMemberlist(pctx context.Context) (context.Context, error)

func PNetwork

func PNetwork(pctx context.Context) (context.Context, error)

func PNetworkHandlers

func PNetworkHandlers(pctx context.Context) (context.Context, error)

func PNetworkHandlersReadWriteNode

func PNetworkHandlersReadWriteNode(pctx context.Context) (context.Context, error)

func PNetworkRateLimiter

func PNetworkRateLimiter(pctx context.Context) (context.Context, error)

func PNodeInConsensusNodesFunc

func PNodeInConsensusNodesFunc(pctx context.Context) (context.Context, error)

func PNodeInfo

func PNodeInfo(pctx context.Context) (context.Context, error)

func POperationProcessorsMap

func POperationProcessorsMap(pctx context.Context) (context.Context, error)

func PPatchBlockItemReaders

func PPatchBlockItemReaders(pctx context.Context) (context.Context, error)

func PPatchLastConsensusNodesWatcher

func PPatchLastConsensusNodesWatcher(pctx context.Context) (context.Context, error)

func PPatchMemberlist

func PPatchMemberlist(pctx context.Context) (ctx context.Context, err error)

func PProposalMaker

func PProposalMaker(pctx context.Context) (context.Context, error)

func PProposalProcessors

func PProposalProcessors(pctx context.Context) (context.Context, error)

func PProposerSelector

func PProposerSelector(pctx context.Context) (context.Context, error)

func PQuicstreamClient

func PQuicstreamClient(pctx context.Context) (context.Context, error)

func PRemotesBlockItemReaderFunc

func PRemotesBlockItemReaderFunc(pctx context.Context) (context.Context, error)

func PStartLastConsensusNodesWatcher

func PStartLastConsensusNodesWatcher(pctx context.Context) (context.Context, error)

func PStartMemberlist

func PStartMemberlist(pctx context.Context) (context.Context, error)

func PStartNetwork

func PStartNetwork(pctx context.Context) (context.Context, error)

func PStartStorage

func PStartStorage(pctx context.Context) (context.Context, error)

func PStartSyncSourceChecker

func PStartSyncSourceChecker(pctx context.Context) (context.Context, error)

func PStartTimeSyncer

func PStartTimeSyncer(pctx context.Context) (context.Context, error)

func PStates

func PStates(pctx context.Context) (context.Context, error)

func PStatesNetworkHandlers

func PStatesNetworkHandlers(pctx context.Context) (context.Context, error)

func PStatesSetHandlers

func PStatesSetHandlers(pctx context.Context) (context.Context, error)

func PStorage

func PStorage(pctx context.Context) (context.Context, error)

func PSuffrageCandidateLimiterSet

func PSuffrageCandidateLimiterSet(pctx context.Context) (context.Context, error)

func PSuffrageVoting

func PSuffrageVoting(pctx context.Context) (context.Context, error)

func PSyncSourceChecker

func PSyncSourceChecker(pctx context.Context) (context.Context, error)

func QuicstreamHandlerEventLogging

func QuicstreamHandlerEventLogging(
	aclhandler quicstreamheader.Handler[EventLoggingHeader],
	eventLogging *EventLogging,
	maxItem uint64,
) (quicstreamheader.Handler[EventLoggingHeader], error)

func QuicstreamHandlerGetNodeInfoFunc

func QuicstreamHandlerGetNodeInfoFunc(
	enc encoder.Encoder,
	nodeinfo *isaacnetwork.NodeInfoUpdater,
) func() ([]byte, error)

func QuicstreamHandlerLastBlockMapFunc

func QuicstreamHandlerLastBlockMapFunc(
	db isaac.Database,
) func(last util.Hash) (string, []byte, []byte, bool, error)

func QuicstreamHandlerSuffrageNodeConnInfoFunc

func QuicstreamHandlerSuffrageNodeConnInfoFunc(
	db isaac.Database,
	memberlist *quicmemberlist.Memberlist,
) func() ([]isaac.NodeConnInfo, error)

func ReadNodeFromNetworkHandler

func ReadNodeFromNetworkHandler(
	ctx context.Context,
	priv base.Privatekey,
	networkID base.NetworkID,
	key string,
	stream quicstreamheader.StreamFunc,
) (t interface{}, found bool, _ error)

func RemoveLocalFS

func RemoveLocalFS(root string) error

func SaveNodeInfo

func SaveNodeInfo(root string, i NodeInfo) error

func SendOperationFilterFunc

func SendOperationFilterFunc(pctx context.Context) (
	func(base.Operation) (bool, error),
	error,
)

func ServerQuicConfig

func ServerQuicConfig(params *NetworkParams) *quic.Config

func SetupLoggingFromFlags

func SetupLoggingFromFlags(flag LoggingFlags) (*logging.Logging, io.Writer, error)

func UpdateNodeInfoWithNewBlock

func UpdateNodeInfoWithNewBlock(
	db isaac.Database,
	nodeinfo *isaacnetwork.NodeInfoUpdater,
) error

func WriteNodeFromNetworkHandler

func WriteNodeFromNetworkHandler(
	ctx context.Context,
	priv base.Privatekey,
	networkID base.NetworkID,
	key string,
	value string,
	stream quicstreamheader.StreamFunc,
) (found bool, _ error)

Types

type ACL

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

func NewACL

func NewACL(mapsize uint64, superuser string) (*ACL, error)

func (*ACL) Allow

func (acl *ACL) Allow(user string, scope ACLScope, required ACLPerm) (ACLPerm, bool)

type ACLAllowFunc

type ACLAllowFunc func(
	_ context.Context,
	user string,
	scope ACLScope,
	required ACLPerm,
	extra *zerolog.Event,
) bool

func NewACLAllowFunc

func NewACLAllowFunc(acl *ACL, el *zerolog.Logger) ACLAllowFunc

type ACLFlags

type ACLFlags struct {
	//revive:disable:line-length-limit
	Flag SecretFlag `name:"acl" help:"acl uri; './acl.yml', 'file:///acl.yml', 'vault://a.b.c.d/acl'" placeholder:"URL"`
}

type ACLPerm

type ACLPerm uint8

func NewAllowACLPerm

func NewAllowACLPerm(c uint8) ACLPerm

func (ACLPerm) IsValid

func (p ACLPerm) IsValid([]byte) error

func (ACLPerm) MarshalText

func (p ACLPerm) MarshalText() ([]byte, error)

func (ACLPerm) String

func (p ACLPerm) String() string

func (*ACLPerm) UnmarshalText

func (p *ACLPerm) UnmarshalText(b []byte) error

type ACLScope

type ACLScope string

type ACLUser

type ACLUser interface {
	ACLUser() base.Publickey
}

type AddressFlag

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

func (AddressFlag) Address

func (f AddressFlag) Address() base.Address

func (*AddressFlag) UnmarshalText

func (f *AddressFlag) UnmarshalText(b []byte) error

type BaseFlags

type BaseFlags struct {
	LoggingFlags `embed:"" prefix:"log."`
}

type ClientIDRateLimiterRuleSet

type ClientIDRateLimiterRuleSet struct {
	StringKeyRateLimiterRuleSet
}

func NewClientIDRateLimiterRuleSet

func NewClientIDRateLimiterRuleSet(
	rules map[string]RateLimiterRuleMap,
) ClientIDRateLimiterRuleSet

func (ClientIDRateLimiterRuleSet) Rule

func (rs ClientIDRateLimiterRuleSet) Rule(
	_ net.Addr, handler string, hint RateLimitRuleHint,
) (_ string, rule RateLimiterRule, _ string, _ bool)

type ConnInfoFlag

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

func (*ConnInfoFlag) ConnInfo

func (f *ConnInfoFlag) ConnInfo() quicstream.ConnInfo

func (ConnInfoFlag) MarshalText

func (f ConnInfoFlag) MarshalText() ([]byte, error)

func (ConnInfoFlag) String

func (f ConnInfoFlag) String() string

func (*ConnInfoFlag) UnmarshalText

func (f *ConnInfoFlag) UnmarshalText(b []byte) error

type DefaultNodeInfo

type DefaultNodeInfo struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func CreateDefaultNodeInfo

func CreateDefaultNodeInfo(networkID base.NetworkID, version util.Version) DefaultNodeInfo

func NewDefaultNodeInfo

func NewDefaultNodeInfo(id string, networkID base.NetworkID, version util.Version) DefaultNodeInfo

func (DefaultNodeInfo) CreatedAt

func (info DefaultNodeInfo) CreatedAt() time.Time

func (DefaultNodeInfo) ID

func (info DefaultNodeInfo) ID() string

func (DefaultNodeInfo) IsValid

func (info DefaultNodeInfo) IsValid([]byte) error

func (DefaultNodeInfo) LastStartedAt

func (info DefaultNodeInfo) LastStartedAt() time.Time

func (DefaultNodeInfo) MarshalJSON

func (info DefaultNodeInfo) MarshalJSON() ([]byte, error)

func (DefaultNodeInfo) NetworkID

func (info DefaultNodeInfo) NetworkID() base.NetworkID

func (*DefaultNodeInfo) UnmarshalJSON

func (info *DefaultNodeInfo) UnmarshalJSON(b []byte) error

func (DefaultNodeInfo) UpdateLastStartedAt

func (info DefaultNodeInfo) UpdateLastStartedAt() NodeInfo

func (DefaultNodeInfo) Version

func (info DefaultNodeInfo) Version() util.Version

type DesignFlag

type DesignFlag struct {
	//revive:disable:line-length-limit
	URI           DesignURIFlag `name:"design" help:"design uri; 'file:///config.yml', 'https://a.b.c.d/config.yml'" group:"design" default:"${design_uri}"`
	URLProperties `embed:"" prefix:"design." group:"design"`
}

DesignFlag is the flag for loading design from various locations. Only one location is allowed. For example, - "--design=./no0sas.yml", or - "--design=https://a.b.c.d/no0sas.yml", or - "--design=consul://a.b.c.d:8500/no0sas/design", or - "--design=consul:///no0sas/design": If address not set, the environment variables of consul will be used.

func (DesignFlag) Properties

func (f DesignFlag) Properties() URLProperties

func (DesignFlag) Scheme

func (f DesignFlag) Scheme() string

func (DesignFlag) URL

func (f DesignFlag) URL() *url.URL

type DesignURIFlag

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

func (*DesignURIFlag) UnmarshalText

func (f *DesignURIFlag) UnmarshalText(b []byte) error

type DevFlags

type DevFlags struct {
	//revive:disable:line-length-limit
	//revive:disable:struct-tag
	AllowRiskyThreshold bool          `name:"allow-risky-threshold" help:"allow risky threshold under threshold, ${safe_threshold}" group:"dev"`
	DelaySyncer         time.Duration `name:"delay-syncer" help:"initial delay when sync one block" group:"dev"`
	AllowConsensus      bool          `name:"allow-consensus" help:"allow to enter consensus" group:"dev"`
	ExitBroken          bool          `name:"exit-broken" help:"exit broken state" group:"dev"`
}

type EventLoggerName

type EventLoggerName string
var (
	UnknownEventLogger EventLoggerName = "unknown"
	AllEventLogger     EventLoggerName = "all"
)
var ACLEventLogger EventLoggerName = "acl"
var BlockItemFilesEventLogger EventLoggerName = "block-item-files"
var EventLoggingEventLogger EventLoggerName = "event_logging"
var HandoverEventLogger EventLoggerName = "handover"
var NodeEventLogger EventLoggerName = "node"
var NodeReadWriteEventLogger EventLoggerName = "node_readwrite"

type EventLogging

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

func NewEventLogging

func NewEventLogging(root string, defaultwriter io.Writer) (*EventLogging, error)

func (*EventLogging) Close

func (el *EventLogging) Close() error

func (*EventLogging) Iter

func (el *EventLogging) Iter(
	offsets [2]int64,
	callback func(addedAt time.Time, offset int64, raw []byte) (bool, error),
	sort bool,
	limit uint64,
) error

func (*EventLogging) IterName

func (el *EventLogging) IterName(
	name EventLoggerName,
	offsets [2]int64,
	callback func(addedAt time.Time, offset int64, raw []byte) (bool, error),
	sort bool,
	limit uint64,
) error

func (*EventLogging) Logger

func (el *EventLogging) Logger(name EventLoggerName) (zerolog.Logger, bool)

func (*EventLogging) Register

func (el *EventLogging) Register(name EventLoggerName) (l zerolog.Logger, _ error)

type EventLoggingHeader

type EventLoggingHeader struct {
	isaacnetwork.BaseHeader
	// contains filtered or unexported fields
}

func NewEventLoggingHeader

func NewEventLoggingHeader(
	name EventLoggerName,
	offsets [2]int64,
	limit uint64,
	sort bool,
	acluser base.Publickey,
) EventLoggingHeader

func (EventLoggingHeader) ACLUser

func (h EventLoggingHeader) ACLUser() base.Publickey

func (*EventLoggingHeader) DecodeJSON

func (h *EventLoggingHeader) DecodeJSON(b []byte, enc encoder.Encoder) error

func (EventLoggingHeader) IsValid

func (h EventLoggingHeader) IsValid([]byte) error

func (EventLoggingHeader) Limit

func (h EventLoggingHeader) Limit() uint64

func (EventLoggingHeader) MarshalJSON

func (h EventLoggingHeader) MarshalJSON() ([]byte, error)

func (EventLoggingHeader) Name

func (EventLoggingHeader) Offsets

func (h EventLoggingHeader) Offsets() [2]int64

func (EventLoggingHeader) Sort

func (h EventLoggingHeader) Sort() bool

type GenesisBlockGenerator

type GenesisBlockGenerator struct {
	*logging.Logging
	// contains filtered or unexported fields
}

func NewGenesisBlockGenerator

func NewGenesisBlockGenerator(
	local base.LocalNode,
	networkID base.NetworkID,
	encs *encoder.Encoders,
	db isaac.Database,
	dataroot string,
	facts []base.Fact,
	loadImportedBlockMap func() (base.BlockMap, bool, error),
) *GenesisBlockGenerator

func (*GenesisBlockGenerator) Generate

func (g *GenesisBlockGenerator) Generate() (base.BlockMap, error)

type GenesisDesign

type GenesisDesign struct {
	Facts []base.Fact `yaml:"facts" json:"facts"`
}

func GenesisDesignFromFile

func GenesisDesignFromFile(f string, jsonencoder encoder.Encoder) (d GenesisDesign, _ []byte, _ error)

func (*GenesisDesign) DecodeYAML

func (d *GenesisDesign) DecodeYAML(b []byte, jsonencoder encoder.Encoder) error

func (*GenesisDesign) IsValid

func (*GenesisDesign) IsValid([]byte) error

type GenesisDesignYAMLUnmarshaler

type GenesisDesignYAMLUnmarshaler struct {
	Facts []interface{} `json:"facts" yaml:"facts"`
}

type HeightFlag

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

func (*HeightFlag) Height

func (f *HeightFlag) Height() base.Height

func (*HeightFlag) IsSet

func (f *HeightFlag) IsSet() bool

func (*HeightFlag) UnmarshalText

func (f *HeightFlag) UnmarshalText(b []byte) error

type LocalParams

type LocalParams struct {
	// ISAAC sets the consensus related parameters.
	ISAAC *isaac.Params `yaml:"isaac,omitempty" json:"isaac,omitempty"`
	// Memberlist sets the memberlist parameters. memberlist handles the
	// connections of suffrage nodes. For details, see
	// https://pkg.go.dev/github.com/hashicorp/memberlist#Config .
	Memberlist *MemberlistParams `yaml:"memberlist,omitempty" json:"memberlist,omitempty"`
	// Network sets the network related parameters. For details, see
	// https://pkg.go.dev/github.com/quic-go/quic-go#Config .
	Network *NetworkParams `yaml:"network,omitempty" json:"network,omitempty"`
	// MISC sets misc parameters.
	MISC *MISCParams `yaml:"misc,omitempty" json:"misc,omitempty"`
}

func (*LocalParams) DecodeYAML

func (p *LocalParams) DecodeYAML(b []byte, jsonencoder encoder.Encoder) error

func (*LocalParams) IsValid

func (p *LocalParams) IsValid(networkID base.NetworkID) error

func (*LocalParams) MarshalYAML

func (p *LocalParams) MarshalYAML() (interface{}, error)

type LocalParamsYAMLUnmarshaler

type LocalParamsYAMLUnmarshaler struct {
	ISAAC      map[string]interface{} `yaml:"isaac"`
	Memberlist *MemberlistParams      `yaml:"memberlist,omitempty"`
	MISC       *MISCParams            `yaml:"misc,omitempty"`
	Network    *NetworkParams         `yaml:"network,omitempty"`
}

type LogLevelFlag

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

func (LogLevelFlag) Level

func (f LogLevelFlag) Level() zerolog.Level

func (LogLevelFlag) String

func (f LogLevelFlag) String() string

func (*LogLevelFlag) UnmarshalText

func (f *LogLevelFlag) UnmarshalText(b []byte) error

type LogOutFlag

type LogOutFlag string

func (LogOutFlag) File

func (f LogOutFlag) File() (io.Writer, error)

type LoggingFlags

type LoggingFlags struct {
	//revive:disable:line-length-limit
	//revive:disable:struct-tag
	Format     string       `enum:"json, terminal" default:"${log_format}" help:"log format: {${enum}}" group:"logging"`
	Out        []LogOutFlag `name:"out" default:"${log_out}" help:"log output file: {stdout, stderr, <file>}" group:"logging"`
	Level      LogLevelFlag `name:"level" default:"${log_level}" help:"log level: {trace, debug, info, warn, error}" group:"logging"`
	ForceColor bool         `name:"force-color" default:"${log_force_color}" negatable:"" help:"log force color" group:"logging"`
}

type LongRunningMemberlistJoin

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

func NewLongRunningMemberlistJoin

func NewLongRunningMemberlistJoin(
	ensureJoin func([]quicstream.ConnInfo) (bool, error),
	isJoined func() bool,
) *LongRunningMemberlistJoin

func (*LongRunningMemberlistJoin) Cancel

func (l *LongRunningMemberlistJoin) Cancel() error

func (*LongRunningMemberlistJoin) Join

func (l *LongRunningMemberlistJoin) Join(cis ...quicstream.ConnInfo) <-chan struct{}

type MISCParams

type MISCParams struct {
	*util.BaseParams
	// contains filtered or unexported fields
}

func (*MISCParams) BlockItemReadersRemoveEmptyAfter

func (p *MISCParams) BlockItemReadersRemoveEmptyAfter() time.Duration

BlockItemReadersRemoveEmptyAfter removes empty block item directory after the duration. Zero duration not allowed.

func (*MISCParams) BlockItemReadersRemoveEmptyInterval

func (p *MISCParams) BlockItemReadersRemoveEmptyInterval() time.Duration

BlockItemReadersRemoveEmptyInterval is the interval to remove empty block item directory after BlockItemReadersRemoveEmptyAfter. Zero duration not allowed.

func (*MISCParams) IsValid

func (p *MISCParams) IsValid([]byte) error

func (*MISCParams) MarshalJSON

func (p *MISCParams) MarshalJSON() ([]byte, error)

func (*MISCParams) MarshalYAML

func (p *MISCParams) MarshalYAML() (interface{}, error)

func (*MISCParams) MaxMessageSize

func (p *MISCParams) MaxMessageSize() uint64

MaxMessageSize is the maximum size of incoming messages like ballot or operation. If message size is over, it will be ignored.

func (*MISCParams) ObjectCacheSize

func (p *MISCParams) ObjectCacheSize() uint64

ObjectCacheSize is the cache size for various internal objects like address or keypair.

func (*MISCParams) SetBlockItemReadersRemoveEmptyAfter

func (p *MISCParams) SetBlockItemReadersRemoveEmptyAfter(d time.Duration) error

func (*MISCParams) SetBlockItemReadersRemoveEmptyInterval

func (p *MISCParams) SetBlockItemReadersRemoveEmptyInterval(d time.Duration) error

func (*MISCParams) SetMaxMessageSize

func (p *MISCParams) SetMaxMessageSize(d uint64) error

func (*MISCParams) SetObjectCacheSize

func (p *MISCParams) SetObjectCacheSize(d uint64) error

func (*MISCParams) SetSyncSourceCheckerInterval

func (p *MISCParams) SetSyncSourceCheckerInterval(d time.Duration) error

func (*MISCParams) SetValidProposalOperationExpire

func (p *MISCParams) SetValidProposalOperationExpire(d time.Duration) error

func (*MISCParams) SetValidProposalSuffrageOperationsExpire

func (p *MISCParams) SetValidProposalSuffrageOperationsExpire(d time.Duration) error

func (*MISCParams) SyncSourceCheckerInterval

func (p *MISCParams) SyncSourceCheckerInterval() time.Duration

SyncSourceCheckerInterval is the interval to check the liveness of sync sources.

func (*MISCParams) UnmarshalJSON

func (p *MISCParams) UnmarshalJSON(b []byte) error

func (*MISCParams) UnmarshalYAML

func (p *MISCParams) UnmarshalYAML(y *yaml.Node) error

func (*MISCParams) ValidProposalOperationExpire

func (p *MISCParams) ValidProposalOperationExpire() time.Duration

ValidProposalOperationExpire is the maximum creation time for valid operation. If the creation time of operation is older than ValidProposalOperationExpire, it will be ignored.

func (*MISCParams) ValidProposalSuffrageOperationsExpire

func (p *MISCParams) ValidProposalSuffrageOperationsExpire() time.Duration

ValidProposalSuffrageOperationsExpire is the maximum creation time for valid suffrage operations like isaacoperation.SuffrageCandidate operation. If the creation time of suffrage operation is older than ValidProposalSuffrageOperationsExpire, it will be ignored.

type MemberlistParams

type MemberlistParams struct {
	*util.BaseParams
	// contains filtered or unexported fields
}

func (*MemberlistParams) ExtraSameMemberLimit

func (p *MemberlistParams) ExtraSameMemberLimit() uint64

func (*MemberlistParams) IsValid

func (*MemberlistParams) IsValid([]byte) error

func (*MemberlistParams) MarshalJSON

func (p *MemberlistParams) MarshalJSON() ([]byte, error)

func (*MemberlistParams) MarshalYAML

func (p *MemberlistParams) MarshalYAML() (interface{}, error)

func (*MemberlistParams) ProbeInterval

func (p *MemberlistParams) ProbeInterval() time.Duration

func (*MemberlistParams) ProbeTimeout

func (p *MemberlistParams) ProbeTimeout() time.Duration

func (*MemberlistParams) RetransmitMult

func (p *MemberlistParams) RetransmitMult() int

func (*MemberlistParams) SetExtraSameMemberLimit

func (p *MemberlistParams) SetExtraSameMemberLimit(d uint64) error

func (*MemberlistParams) SetProbeInterval

func (p *MemberlistParams) SetProbeInterval(d time.Duration) error

func (*MemberlistParams) SetProbeTimeout

func (p *MemberlistParams) SetProbeTimeout(d time.Duration) error

func (*MemberlistParams) SetRetransmitMult

func (p *MemberlistParams) SetRetransmitMult(d int) error

func (*MemberlistParams) SetSuspicionMaxTimeoutMult

func (p *MemberlistParams) SetSuspicionMaxTimeoutMult(d int) error

func (*MemberlistParams) SetSuspicionMult

func (p *MemberlistParams) SetSuspicionMult(d int) error

func (*MemberlistParams) SetTCPTimeout

func (p *MemberlistParams) SetTCPTimeout(d time.Duration) error

func (*MemberlistParams) SetUDPBufferSize

func (p *MemberlistParams) SetUDPBufferSize(d int) error

func (*MemberlistParams) SuspicionMaxTimeoutMult

func (p *MemberlistParams) SuspicionMaxTimeoutMult() int

func (*MemberlistParams) SuspicionMult

func (p *MemberlistParams) SuspicionMult() int

func (*MemberlistParams) TCPTimeout

func (p *MemberlistParams) TCPTimeout() time.Duration

func (*MemberlistParams) UDPBufferSize

func (p *MemberlistParams) UDPBufferSize() int

func (*MemberlistParams) UnmarshalJSON

func (p *MemberlistParams) UnmarshalJSON(b []byte) error

func (*MemberlistParams) UnmarshalYAML

func (p *MemberlistParams) UnmarshalYAML(y *yaml.Node) error

type NetRateLimiterRuleSet

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

func NewNetRateLimiterRuleSet

func NewNetRateLimiterRuleSet() NetRateLimiterRuleSet

func (*NetRateLimiterRuleSet) Add

func (NetRateLimiterRuleSet) IsValid

func (rs NetRateLimiterRuleSet) IsValid([]byte) error

func (NetRateLimiterRuleSet) MarshalJSON

func (rs NetRateLimiterRuleSet) MarshalJSON() ([]byte, error)

func (NetRateLimiterRuleSet) Rule

func (rs NetRateLimiterRuleSet) Rule(
	addr net.Addr, handler string, _ RateLimitRuleHint,
) (_ string, _ RateLimiterRule, _ string, _ bool)

func (*NetRateLimiterRuleSet) UnmarshalJSON

func (rs *NetRateLimiterRuleSet) UnmarshalJSON(b []byte) error

func (NetRateLimiterRuleSet) UpdatedAt

func (rs NetRateLimiterRuleSet) UpdatedAt() int64

type NetworkParams

type NetworkParams struct {
	*util.BaseParams
	// contains filtered or unexported fields
}

func (*NetworkParams) ConnectionPoolSize

func (p *NetworkParams) ConnectionPoolSize() uint64

ConnectionPoolSize is the sharded map size for connection pool.

func (*NetworkParams) DefaultHandlerTimeout

func (p *NetworkParams) DefaultHandlerTimeout() time.Duration

DefaultHandlerTimeout is the default timeout for network handlers. If handling request is over timeout, the request will be canceled by server.

func (*NetworkParams) HandlerTimeout

func (p *NetworkParams) HandlerTimeout(i quicstream.HandlerName) (time.Duration, error)

HandlerTimeout is the map of timeouts for each handler. If not set in HandlerTimeout, DefaultHandlerTimeout will be used.

func (*NetworkParams) HandlerTimeoutFunc

func (p *NetworkParams) HandlerTimeoutFunc(i quicstream.HandlerName) (func() time.Duration, error)

func (*NetworkParams) HandshakeIdleTimeout

func (p *NetworkParams) HandshakeIdleTimeout() time.Duration

HandshakeIdleTimeout; see https://pkg.go.dev/github.com/quic-go/quic-go#Config .

func (*NetworkParams) IsValid

func (p *NetworkParams) IsValid([]byte) error

func (*NetworkParams) KeepAlivePeriod

func (p *NetworkParams) KeepAlivePeriod() time.Duration

KeepAlivePeriod; see https://pkg.go.dev/github.com/quic-go/quic-go#Config .

func (*NetworkParams) MarshalJSON

func (p *NetworkParams) MarshalJSON() ([]byte, error)

func (*NetworkParams) MarshalYAML

func (p *NetworkParams) MarshalYAML() (interface{}, error)

func (*NetworkParams) MaxIdleTimeout

func (p *NetworkParams) MaxIdleTimeout() time.Duration

MaxIdleTimeout; see https://pkg.go.dev/github.com/quic-go/quic-go#Config .

func (*NetworkParams) MaxIncomingStreams

func (p *NetworkParams) MaxIncomingStreams() uint64

MaxIncomingStreams; see https://pkg.go.dev/github.com/quic-go/quic-go#Config .

func (*NetworkParams) MaxStreamTimeout

func (p *NetworkParams) MaxStreamTimeout() time.Duration

MaxStreamTimeout; see https://pkg.go.dev/github.com/quic-go/quic-go#Config .

func (*NetworkParams) RateLimit

func (p *NetworkParams) RateLimit() *NetworkRateLimitParams

func (*NetworkParams) SetConnectionPoolSize

func (p *NetworkParams) SetConnectionPoolSize(d uint64) error

func (*NetworkParams) SetDefaultHandlerTimeout

func (p *NetworkParams) SetDefaultHandlerTimeout(d time.Duration) error

func (*NetworkParams) SetHandlerTimeout

func (p *NetworkParams) SetHandlerTimeout(i quicstream.HandlerName, d time.Duration) error

func (*NetworkParams) SetHandshakeIdleTimeout

func (p *NetworkParams) SetHandshakeIdleTimeout(d time.Duration) error

func (*NetworkParams) SetKeepAlivePeriod

func (p *NetworkParams) SetKeepAlivePeriod(d time.Duration) error

func (*NetworkParams) SetMaxIdleTimeout

func (p *NetworkParams) SetMaxIdleTimeout(d time.Duration) error

func (*NetworkParams) SetMaxIncomingStreams

func (p *NetworkParams) SetMaxIncomingStreams(d uint64) error

func (*NetworkParams) SetMaxStreamTimeout

func (p *NetworkParams) SetMaxStreamTimeout(d time.Duration) error

func (*NetworkParams) SetRateLimit

func (p *NetworkParams) SetRateLimit(r *RateLimiterRules) error

func (*NetworkParams) SetTimeoutRequest

func (p *NetworkParams) SetTimeoutRequest(d time.Duration) error

func (*NetworkParams) TimeoutRequest

func (p *NetworkParams) TimeoutRequest() time.Duration

TimeoutRequest is the default timeout to request the other nodes; see https://pkg.go.dev/github.com/quic-go/quic-go#Config .

func (*NetworkParams) UnmarshalJSON

func (p *NetworkParams) UnmarshalJSON(b []byte) error

func (*NetworkParams) UnmarshalYAML

func (p *NetworkParams) UnmarshalYAML(y *yaml.Node) error

type NetworkRateLimitParams

type NetworkRateLimitParams struct {
	*RateLimiterRules
}

func NewNetworkRateLimitParams

func NewNetworkRateLimitParams() *NetworkRateLimitParams

func (*NetworkRateLimitParams) IsValid

func (p *NetworkRateLimitParams) IsValid([]byte) error

func (*NetworkRateLimitParams) MarshalJSON

func (p *NetworkRateLimitParams) MarshalJSON() ([]byte, error)

func (*NetworkRateLimitParams) MarshalYAML

func (p *NetworkRateLimitParams) MarshalYAML() (interface{}, error)

func (*NetworkRateLimitParams) UnmarshalJSON

func (p *NetworkRateLimitParams) UnmarshalJSON(b []byte) error

func (*NetworkRateLimitParams) UnmarshalYAML

func (p *NetworkRateLimitParams) UnmarshalYAML(y *yaml.Node) error

type NetworkRateLimitParamsUnmarshaler

type NetworkRateLimitParamsUnmarshaler struct {
	Suffrage *SuffrageRateLimiterRuleSet `json:"suffrage,omitempty" yaml:"suffrage,omitempty"`
	Node     *NodeRateLimiterRuleSet     `json:"node,omitempty" yaml:"node,omitempty"`
	Net      *NetRateLimiterRuleSet      `json:"net,omitempty" yaml:"net,omitempty"`
	Default  *RateLimiterRuleMap         `json:"default,omitempty" yaml:"default,omitempty"`
}

type NodeDesign

type NodeDesign struct {
	Address        base.Address
	Privatekey     base.Privatekey
	Storage        NodeStorageDesign
	Network        NodeNetworkDesign
	NetworkID      base.NetworkID
	LocalParams    *LocalParams
	SyncSources    *SyncSourcesDesign
	TimeServerPort int
	TimeServer     string
}

func NodeDesignFromConsul

func NodeDesignFromConsul(addr, key string, jsonencoder encoder.Encoder) (design NodeDesign, _ []byte, _ error)

func NodeDesignFromFile

func NodeDesignFromFile(f string, jsonencoder encoder.Encoder) (d NodeDesign, _ []byte, _ error)

func NodeDesignFromHTTP

func NodeDesignFromHTTP(
	u string,
	tlsinsecure bool,
	jsonencoder encoder.Encoder,
) (design NodeDesign, _ []byte, _ error)

func (*NodeDesign) Check

func (d *NodeDesign) Check(devflags DevFlags) error

func (*NodeDesign) DecodeYAML

func (d *NodeDesign) DecodeYAML(b []byte, jsonencoder encoder.Encoder) error

func (*NodeDesign) IsValid

func (d *NodeDesign) IsValid([]byte) error

func (NodeDesign) MarshalJSON

func (d NodeDesign) MarshalJSON() ([]byte, error)

func (NodeDesign) MarshalYAML

func (d NodeDesign) MarshalYAML() (interface{}, error)

type NodeDesignMarshaler

type NodeDesignMarshaler struct {
	LocalParams *LocalParams       `json:"parameters" yaml:"parameters"` //nolint:tagliatelle //...
	SyncSources *SyncSourcesDesign `json:"sync_sources" yaml:"sync_sources"`
	Address     base.Address       `json:"address" yaml:"address"`
	Privatekey  base.Privatekey    `json:"privatekey" yaml:"privatekey"`
	Storage     NodeStorageDesign  `json:"storage" yaml:"storage"`
	NetworkID   string             `json:"network_id" yaml:"network_id"`
	TimeServer  string             `json:"time_server,omitempty" yaml:"time_server,omitempty"`
	Network     NodeNetworkDesign  `json:"network" yaml:"network"`
}

type NodeDesignYAMLUnmarshaler

type NodeDesignYAMLUnmarshaler struct {
	SyncSources interface{}                 `json:"sync_sources" yaml:"sync_sources"`
	Storage     NodeStorageDesignLMarshaler `json:"storage" yaml:"storage"`
	Address     string                      `json:"address" yaml:"address"`
	Privatekey  string                      `json:"privatekey" yaml:"privatekey"`
	NetworkID   string                      `json:"network_id" yaml:"network_id"`
	TimeServer  string                      `json:"time_server,omitempty" yaml:"time_server,omitempty"`
	LocalParams interface{}                 `json:"parameters" yaml:"parameters"` //nolint:tagliatelle //...
	Network     NodeNetworkDesignMarshaler  `json:"network" yaml:"network"`
}

type NodeInfo

type NodeInfo interface {
	util.IsValider
	ID() string
	NetworkID() base.NetworkID
	CreatedAt() time.Time
	LastStartedAt() time.Time
	UpdateLastStartedAt() NodeInfo
	Version() util.Version // NOTE mitum build version
}

func CheckLocalFS

func CheckLocalFS(networkID base.NetworkID, root string, enc encoder.Encoder) (NodeInfo, error)

func CreateLocalFS

func CreateLocalFS(newinfo NodeInfo, root string, enc encoder.Encoder) (NodeInfo, error)

func LoadNodeInfo

func LoadNodeInfo(root string, enc encoder.Encoder) (_ NodeInfo, found bool, _ error)

type NodeNetworkDesign

type NodeNetworkDesign struct {
	Bind *net.UDPAddr `yaml:"bind"`

	PublishString string `yaml:"publish"` //nolint:tagliatelle //...
	TLSInsecure   bool   `yaml:"tls_insecure"`
	// contains filtered or unexported fields
}

func (*NodeNetworkDesign) DecodeYAML

func (d *NodeNetworkDesign) DecodeYAML(b []byte, jsonencoder encoder.Encoder) error

func (*NodeNetworkDesign) IsValid

func (d *NodeNetworkDesign) IsValid([]byte) error

func (NodeNetworkDesign) MarshalJSON

func (d NodeNetworkDesign) MarshalJSON() ([]byte, error)

func (NodeNetworkDesign) MarshalYAML

func (d NodeNetworkDesign) MarshalYAML() (interface{}, error)

func (NodeNetworkDesign) Publish

func (d NodeNetworkDesign) Publish() *net.UDPAddr

func (NodeNetworkDesign) PublishConnInfo

func (d NodeNetworkDesign) PublishConnInfo() quicstream.ConnInfo

type NodeNetworkDesignMarshaler

type NodeNetworkDesignMarshaler struct {
	Bind        string `json:"bind,omitempty" yaml:"bind,omitempty"`
	Publish     string `json:"publish" yaml:"publish"`
	TLSInsecure bool   `json:"tls_insecure" yaml:"tls_insecure"`
}

func (*NodeNetworkDesignMarshaler) Decode

type NodeRateLimiterRuleSet

type NodeRateLimiterRuleSet struct {
	StringKeyRateLimiterRuleSet
}

func NewNodeRateLimiterRuleSet

func NewNodeRateLimiterRuleSet(
	rules map[string]RateLimiterRuleMap,
) NodeRateLimiterRuleSet

func (NodeRateLimiterRuleSet) Rule

func (rs NodeRateLimiterRuleSet) Rule(
	_ net.Addr, handler string, hint RateLimitRuleHint,
) (_ string, _ RateLimiterRule, _ string, _ bool)

type NodeStorageDesign

type NodeStorageDesign struct {
	Database *url.URL `yaml:"database"`
	Base     string   `yaml:"base"`
}

func (*NodeStorageDesign) DecodeYAML

func (d *NodeStorageDesign) DecodeYAML(b []byte, jsonencoder encoder.Encoder) error

func (*NodeStorageDesign) IsValid

func (d *NodeStorageDesign) IsValid([]byte) error

func (NodeStorageDesign) MarshalJSON

func (d NodeStorageDesign) MarshalJSON() ([]byte, error)

func (NodeStorageDesign) MarshalYAML

func (d NodeStorageDesign) MarshalYAML() (interface{}, error)

func (*NodeStorageDesign) Patch

func (d *NodeStorageDesign) Patch(node base.Address) error

type NodeStorageDesignLMarshaler

type NodeStorageDesignLMarshaler struct {
	Base     string `json:"base" yaml:"base"`
	Database string `json:"database" yaml:"database"`
}

func (*NodeStorageDesignLMarshaler) Decode

type PrivatekeyArgument

type PrivatekeyArgument struct {
	//revive:disable:line-length-limit
	Flag SecretFlag `` /* 140-byte string literal not displayed */

}

type PrivatekeyFlags

type PrivatekeyFlags struct {
	//revive:disable:line-length-limit
	Flag SecretFlag `` /* 133-byte string literal not displayed */

}

type RangeFlag

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

func (*RangeFlag) From

func (f *RangeFlag) From() *uint64

func (*RangeFlag) To

func (f *RangeFlag) To() *uint64

func (*RangeFlag) UnmarshalText

func (f *RangeFlag) UnmarshalText(b []byte) error

type RateLimitHandler

type RateLimitHandler struct {
	*util.ContextDaemon
	// contains filtered or unexported fields
}

func NewRateLimitHandler

func NewRateLimitHandler(args *RateLimitHandlerArgs) (*RateLimitHandler, error)

func (*RateLimitHandler) AddNode

func (r *RateLimitHandler) AddNode(addr net.Addr, node base.Address) bool

func (*RateLimitHandler) Func

type RateLimitHandlerArgs

type RateLimitHandlerArgs struct {
	Rules     *RateLimiterRules
	PoolSizes []uint64
	// ExpireAddr sets the expire duration for idle addr. if addr is over
	// ExpireAddr, it will be removed.
	ExpireAddr     time.Duration
	ShrinkInterval time.Duration
	// MaxAddrs limits the number of network addresses; if new address over
	// MaxAddrs, the oldes addr will be removed.
	MaxAddrs uint64
}

func NewRateLimitHandlerArgs

func NewRateLimitHandlerArgs() *RateLimitHandlerArgs

type RateLimitRuleHint

type RateLimitRuleHint struct {
	Node     base.Address `json:"node,omitempty"`
	ClientID string       `json:"client_id,omitempty"`
}

type RateLimiter

type RateLimiter struct {
	*rate.Limiter
	// contains filtered or unexported fields
}

func NewRateLimiter

func NewRateLimiter(limit rate.Limit, burst int, checksum, t, desc string) *RateLimiter

NewRateLimiter make new *RateLimiter; - if limit is zero or burst is zero, all events will be rejected - if limit is rate.Inf, no limit

func (*RateLimiter) Allow

func (r *RateLimiter) Allow() bool

func (*RateLimiter) Burst

func (r *RateLimiter) Burst() int

func (*RateLimiter) Checksum

func (r *RateLimiter) Checksum() string

func (*RateLimiter) Desc

func (r *RateLimiter) Desc() string

func (*RateLimiter) Limit

func (r *RateLimiter) Limit() rate.Limit

func (*RateLimiter) MarshalJSON

func (r *RateLimiter) MarshalJSON() ([]byte, error)

func (*RateLimiter) Tokens

func (r *RateLimiter) Tokens() float64

func (*RateLimiter) Type

func (r *RateLimiter) Type() string

func (*RateLimiter) Update

func (r *RateLimiter) Update(limit rate.Limit, burst int, checksum, t, desc string) *RateLimiter

func (*RateLimiter) UpdatedAt

func (r *RateLimiter) UpdatedAt() int64

type RateLimiterResult

type RateLimiterResult struct {
	Addr        net.Addr          `json:"addr,omitempty"`
	Hint        RateLimitRuleHint `json:"hint,omitempty"`
	Limiter     string            `json:"limiter,omitempty"`
	RulesetType string            `json:"ruleset_type,omitempty"`
	RulesetDesc string            `json:"ruleset_desc,omitempty"`
	Prefix      string            `json:"prefix,omitempty"`
	Tokens      float64           `json:"tokens,omitempty"`
	Allowed     bool              `json:"allowed,omitempty"`
}

type RateLimiterRule

type RateLimiterRule struct {
	Limit rate.Limit
	Burst int
	// contains filtered or unexported fields
}

func LimitRateLimiterRule

func LimitRateLimiterRule() RateLimiterRule

func NewRateLimiterRule

func NewRateLimiterRule(d time.Duration, burst int) RateLimiterRule

func NoLimitRateLimiterRule

func NoLimitRateLimiterRule() RateLimiterRule

func (RateLimiterRule) MarshalText

func (r RateLimiterRule) MarshalText() ([]byte, error)

func (RateLimiterRule) String

func (r RateLimiterRule) String() string

func (*RateLimiterRule) UnmarshalText

func (r *RateLimiterRule) UnmarshalText(b []byte) error

type RateLimiterRuleMap

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

func NewRateLimiterRuleMap

func NewRateLimiterRuleMap(
	d *RateLimiterRule,
	m map[string]RateLimiterRule,
) RateLimiterRuleMap

func (RateLimiterRuleMap) IsEmpty

func (m RateLimiterRuleMap) IsEmpty() bool

func (RateLimiterRuleMap) Len

func (m RateLimiterRuleMap) Len() int

func (RateLimiterRuleMap) MarshalJSON

func (m RateLimiterRuleMap) MarshalJSON() ([]byte, error)

func (RateLimiterRuleMap) Rule

func (m RateLimiterRuleMap) Rule(handler string) (rule RateLimiterRule, found bool)

func (*RateLimiterRuleMap) UnmarshalJSON

func (m *RateLimiterRuleMap) UnmarshalJSON(b []byte) error

type RateLimiterRuleSet

type RateLimiterRuleSet interface {
	Rule(addr net.Addr, handler string, hint RateLimitRuleHint) (
		checksum string, _ RateLimiterRule, desc string, found bool)
	UpdatedAt() int64
	util.IsValider
}

type RateLimiterRules

type RateLimiterRules struct {
	IsInConsensusNodesFunc func() (
		statehash util.Hash,
		exists func(base.Address) (found bool),
		_ error,
	)
	// contains filtered or unexported fields
}

func NewRateLimiterRules

func NewRateLimiterRules() *RateLimiterRules

func (*RateLimiterRules) ClientIDRuleSet

func (r *RateLimiterRules) ClientIDRuleSet() RateLimiterRuleSet

func (*RateLimiterRules) DefaultMapUpdatedAt

func (r *RateLimiterRules) DefaultMapUpdatedAt() int64

func (*RateLimiterRules) DefaultRuleMap

func (r *RateLimiterRules) DefaultRuleMap() RateLimiterRuleMap

func (*RateLimiterRules) IsValid

func (r *RateLimiterRules) IsValid([]byte) error

func (*RateLimiterRules) NetRuleSet

func (r *RateLimiterRules) NetRuleSet() RateLimiterRuleSet

func (*RateLimiterRules) NodeRuleSet

func (r *RateLimiterRules) NodeRuleSet() RateLimiterRuleSet

func (*RateLimiterRules) Rule

func (r *RateLimiterRules) Rule(
	addr net.Addr,
	handler string,
	hint RateLimitRuleHint,
	l *RateLimiter,
) (_ *RateLimiter, isnew bool)

func (*RateLimiterRules) SetClientIDRuleSet

func (r *RateLimiterRules) SetClientIDRuleSet(l RateLimiterRuleSet) error

func (*RateLimiterRules) SetDefaultRuleMap

func (r *RateLimiterRules) SetDefaultRuleMap(rule RateLimiterRuleMap) error

func (*RateLimiterRules) SetIsInConsensusNodesFunc

func (r *RateLimiterRules) SetIsInConsensusNodesFunc(f func() (
	statehash util.Hash,
	exists func(base.Address) (found bool),
	_ error,
),
)

func (*RateLimiterRules) SetNetRuleSet

func (r *RateLimiterRules) SetNetRuleSet(l RateLimiterRuleSet) error

func (*RateLimiterRules) SetNodeRuleSet

func (r *RateLimiterRules) SetNodeRuleSet(l RateLimiterRuleSet) error

func (*RateLimiterRules) SetSuffrageRuleSet

func (r *RateLimiterRules) SetSuffrageRuleSet(l RateLimiterRuleSet) error

func (*RateLimiterRules) SuffrageRuleSet

func (r *RateLimiterRules) SuffrageRuleSet() RateLimiterRuleSet

type ReadNodeHeader

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

func NewReadNodeHeader

func NewReadNodeHeader(key string, acluser base.Publickey) ReadNodeHeader

func (ReadNodeHeader) ACLUser

func (h ReadNodeHeader) ACLUser() base.Publickey

func (*ReadNodeHeader) DecodeJSON

func (h *ReadNodeHeader) DecodeJSON(b []byte, enc encoder.Encoder) error

func (ReadNodeHeader) IsValid

func (h ReadNodeHeader) IsValid([]byte) error

func (ReadNodeHeader) MarshalJSON

func (h ReadNodeHeader) MarshalJSON() ([]byte, error)

type SecretFlag

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

func (SecretFlag) Body

func (f SecretFlag) Body() []byte

func (SecretFlag) String

func (f SecretFlag) String() string

func (*SecretFlag) UnmarshalText

func (f *SecretFlag) UnmarshalText(b []byte) error

type StringKeyRateLimiterRuleSet

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

func (StringKeyRateLimiterRuleSet) IsValid

func (StringKeyRateLimiterRuleSet) MarshalJSON

func (rs StringKeyRateLimiterRuleSet) MarshalJSON() ([]byte, error)

func (*StringKeyRateLimiterRuleSet) UnmarshalJSON

func (rs *StringKeyRateLimiterRuleSet) UnmarshalJSON(b []byte) error

func (StringKeyRateLimiterRuleSet) UpdatedAt

func (rs StringKeyRateLimiterRuleSet) UpdatedAt() int64

type SuffragePool

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

func NewSuffragePool

func NewSuffragePool(
	byHeightf func(base.Height) (base.Suffrage, bool, error),
	lastf func() (base.Height, base.Suffrage, bool, error),
) *SuffragePool

func (*SuffragePool) Height

func (s *SuffragePool) Height(height base.Height) (base.Suffrage, bool, error)

func (*SuffragePool) Last

func (s *SuffragePool) Last() (base.Suffrage, bool, error)

func (*SuffragePool) Purge

func (s *SuffragePool) Purge()

type SuffrageRateLimiterRuleSet

type SuffrageRateLimiterRuleSet struct {
	IsInConsensusNodesFunc func() (util.Hash, func(base.Address) (found bool), error)
	// contains filtered or unexported fields
}

func NewSuffrageRateLimiterRuleSet

func NewSuffrageRateLimiterRuleSet(rule RateLimiterRuleMap) *SuffrageRateLimiterRuleSet

func (*SuffrageRateLimiterRuleSet) IsValid

func (*SuffrageRateLimiterRuleSet) MarshalJSON

func (rs *SuffrageRateLimiterRuleSet) MarshalJSON() ([]byte, error)

func (*SuffrageRateLimiterRuleSet) Rule

func (rs *SuffrageRateLimiterRuleSet) Rule(
	_ net.Addr, handler string, hint RateLimitRuleHint,
) (statehash string, rule RateLimiterRule, _ string, _ bool)

func (*SuffrageRateLimiterRuleSet) UnmarshalJSON

func (rs *SuffrageRateLimiterRuleSet) UnmarshalJSON(b []byte) error

func (*SuffrageRateLimiterRuleSet) UpdatedAt

func (rs *SuffrageRateLimiterRuleSet) UpdatedAt() int64

type SyncSourcesDesign

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

func NewSyncSourcesDesign

func NewSyncSourcesDesign(sources []isaacnetwork.SyncSource) *SyncSourcesDesign

func (*SyncSourcesDesign) DecodeYAML

func (d *SyncSourcesDesign) DecodeYAML(b []byte, jsonencoder encoder.Encoder) error

func (*SyncSourcesDesign) IsValid

func (d *SyncSourcesDesign) IsValid([]byte) error

func (*SyncSourcesDesign) MarshalJSON

func (d *SyncSourcesDesign) MarshalJSON() ([]byte, error)

func (*SyncSourcesDesign) MarshalYAML

func (d *SyncSourcesDesign) MarshalYAML() (interface{}, error)

func (*SyncSourcesDesign) Sources

func (d *SyncSourcesDesign) Sources() []isaacnetwork.SyncSource

func (*SyncSourcesDesign) Update

func (d *SyncSourcesDesign) Update(sources []isaacnetwork.SyncSource)

type URLProperties

type URLProperties struct {
	HTTPSTLSInsecure bool `name:"https.tls_insecure" negatable:"" help:"https tls insecure"`
}

type WriteNodeHeader

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

func NewWriteNodeHeader

func NewWriteNodeHeader(key string, acluser base.Publickey) WriteNodeHeader

func (WriteNodeHeader) ACLUser

func (h WriteNodeHeader) ACLUser() base.Publickey

func (*WriteNodeHeader) DecodeJSON

func (h *WriteNodeHeader) DecodeJSON(b []byte, enc encoder.Encoder) error

func (WriteNodeHeader) IsValid

func (h WriteNodeHeader) IsValid([]byte) error

func (WriteNodeHeader) MarshalJSON

func (h WriteNodeHeader) MarshalJSON() ([]byte, error)

type YAMLACL

type YAMLACL struct {
	*ACL
	// contains filtered or unexported fields
}

func NewYAMLACL

func NewYAMLACL(acl *ACL) *YAMLACL

func (*YAMLACL) Export

func (acl *YAMLACL) Export() interface{}

func (*YAMLACL) Import

func (acl *YAMLACL) Import(b []byte, enc encoder.Encoder) (updated bool, _ error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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