misbehavior

package
v0.0.0-...-05bc493 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlameExcessiveIntro
	MismatchedPulsarPacket
	ProtocolViolation
)
View Source
const (
	FraudMultipleNsh
	MismatchedRank
	MismatchedNeighbour
	WrongPower
)

Variables

This section is empty.

Functions

func Is

func Is(err error) bool

func IsFraud

func IsFraud(err error) bool

Types

type BlameError

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

func (BlameError) BlameType

func (p BlameError) BlameType() int

func (*BlameError) CaptureMark

func (p *BlameError) CaptureMark() interface{}

func (*BlameError) Details

func (p *BlameError) Details() []interface{}

func (BlameError) Error

func (p BlameError) Error() string

func (*BlameError) IsUnknown

func (p *BlameError) IsUnknown() bool

func (*BlameError) MisbehaviorType

func (p *BlameError) MisbehaviorType() Type

func (*BlameError) ViolatorHost

func (p *BlameError) ViolatorHost() endpoints.InboundConnection

func (*BlameError) ViolatorNode

func (p *BlameError) ViolatorNode() profiles.BaseNode

type BlameFactory

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

func NewBlameFactory

func NewBlameFactory(capture ReportFunc) BlameFactory

func (BlameFactory) ExcessiveIntro

func (p BlameFactory) ExcessiveIntro(violator profiles.BaseNode, evidence1 cryptkit.SignedEvidenceHolder, evidence2 cryptkit.SignedEvidenceHolder) BlameError

func (BlameFactory) NewBlame

func (p BlameFactory) NewBlame(fraudType int, msg string, violatorHost endpoints.Inbound, violatorNode profiles.BaseNode, details ...interface{}) BlameError

func (BlameFactory) NewHostBlame

func (p BlameFactory) NewHostBlame(fraudType int, msg string, violatorHost endpoints.Inbound, details ...interface{}) BlameError

func (BlameFactory) NewMismatchedPulsarPacket

func (p BlameFactory) NewMismatchedPulsarPacket(from endpoints.Inbound, expected proofs.OriginalPulsarPacket, received proofs.OriginalPulsarPacket) BlameError

func (BlameFactory) NewMismatchedPulsePacket

func (p BlameFactory) NewMismatchedPulsePacket(from profiles.BaseNode, expected proofs.OriginalPulsarPacket, received proofs.OriginalPulsarPacket) BlameError

func (BlameFactory) NewNodeBlame

func (p BlameFactory) NewNodeBlame(fraudType int, msg string, violatorNode profiles.BaseNode, details ...interface{}) BlameError

func (BlameFactory) NewProtocolViolation

func (p BlameFactory) NewProtocolViolation(violator profiles.BaseNode, msg string) BlameError

type Category

type Category int
const (
	Blame Category
	Fraud
)

func (Category) Of

func (c Category) Of(misbehavior int) Type

type FraudError

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

func FraudOf

func FraudOf(err error) *FraudError

func (*FraudError) CaptureMark

func (p *FraudError) CaptureMark() interface{}

func (*FraudError) Details

func (p *FraudError) Details() []interface{}

func (FraudError) Error

func (p FraudError) Error() string

func (FraudError) FraudType

func (p FraudError) FraudType() int

func (*FraudError) IsUnknown

func (p *FraudError) IsUnknown() bool

func (*FraudError) MisbehaviorType

func (p *FraudError) MisbehaviorType() Type

func (*FraudError) ViolatorHost

func (p *FraudError) ViolatorHost() endpoints.InboundConnection

func (*FraudError) ViolatorNode

func (p *FraudError) ViolatorNode() profiles.BaseNode

type FraudFactory

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

func NewFraudFactory

func NewFraudFactory(capture ReportFunc) FraudFactory

func (FraudFactory) NewFraud

func (p FraudFactory) NewFraud(fraudType int, msg string, violatorHost endpoints.Inbound, violatorNode profiles.BaseNode, details ...interface{}) FraudError

func (FraudFactory) NewHostFraud

func (p FraudFactory) NewHostFraud(fraudType int, msg string, violatorHost endpoints.Inbound, details ...interface{}) FraudError

func (FraudFactory) NewInconsistentMembershipAnnouncement

func (p FraudFactory) NewInconsistentMembershipAnnouncement(violator profiles.ActiveNode,
	evidence1 profiles.MembershipAnnouncement, evidence2 profiles.MembershipAnnouncement) FraudError

nolint:interfacer

func (FraudFactory) NewInconsistentNeighbourAnnouncement

func (p FraudFactory) NewInconsistentNeighbourAnnouncement(violator profiles.BaseNode) FraudError

func (FraudFactory) NewInvalidPowerLevel

func (p FraudFactory) NewInvalidPowerLevel(violator profiles.BaseNode) FraudError

func (FraudFactory) NewMismatchedMembershipRank

func (p FraudFactory) NewMismatchedMembershipRank(violator profiles.ActiveNode, mp profiles.MembershipProfile) FraudError

func (FraudFactory) NewMismatchedMembershipRankOrNodeCount

func (p FraudFactory) NewMismatchedMembershipRankOrNodeCount(violator profiles.ActiveNode,
	mp profiles.MembershipProfile, nodeCount int) FraudError

nolint:interfacer

func (FraudFactory) NewMismatchedNeighbourRank

func (p FraudFactory) NewMismatchedNeighbourRank(violator profiles.BaseNode) error

func (FraudFactory) NewNeighbourContainsSource

func (p FraudFactory) NewNeighbourContainsSource(violator profiles.BaseNode) error

func (FraudFactory) NewNeighbourMissingTarget

func (p FraudFactory) NewNeighbourMissingTarget(violator profiles.BaseNode) error

func (FraudFactory) NewNodeFraud

func (p FraudFactory) NewNodeFraud(fraudType int, msg string, violatorNode profiles.BaseNode, details ...interface{}) FraudError

func (FraudFactory) NewUnknownNeighbour

func (p FraudFactory) NewUnknownNeighbour(violator profiles.BaseNode) error

type Report

type Report interface {
	CaptureMark() interface{}
	Details() []interface{}
	ViolatorNode() profiles.BaseNode
	ViolatorHost() endpoints.InboundConnection
	MisbehaviorType() Type
}

func Of

func Of(err error) Report

type ReportFunc

type ReportFunc func(report Report) interface{}

type ReportMock

type ReportMock struct {
	CaptureMarkMock mReportMockCaptureMark

	DetailsMock mReportMockDetails

	MisbehaviorTypeMock mReportMockMisbehaviorType

	ViolatorHostMock mReportMockViolatorHost

	ViolatorNodeMock mReportMockViolatorNode
	// contains filtered or unexported fields
}

ReportMock implements Report

func NewReportMock

func NewReportMock(t minimock.Tester) *ReportMock

NewReportMock returns a mock for Report

func (*ReportMock) CaptureMark

func (mmCaptureMark *ReportMock) CaptureMark() (p1 interface{})

CaptureMark implements Report

func (*ReportMock) CaptureMarkAfterCounter

func (mmCaptureMark *ReportMock) CaptureMarkAfterCounter() uint64

CaptureMarkAfterCounter returns a count of finished ReportMock.CaptureMark invocations

func (*ReportMock) CaptureMarkBeforeCounter

func (mmCaptureMark *ReportMock) CaptureMarkBeforeCounter() uint64

CaptureMarkBeforeCounter returns a count of ReportMock.CaptureMark invocations

func (*ReportMock) Details

func (mmDetails *ReportMock) Details() (pa1 []interface{})

Details implements Report

func (*ReportMock) DetailsAfterCounter

func (mmDetails *ReportMock) DetailsAfterCounter() uint64

DetailsAfterCounter returns a count of finished ReportMock.Details invocations

func (*ReportMock) DetailsBeforeCounter

func (mmDetails *ReportMock) DetailsBeforeCounter() uint64

DetailsBeforeCounter returns a count of ReportMock.Details invocations

func (*ReportMock) MinimockCaptureMarkDone

func (m *ReportMock) MinimockCaptureMarkDone() bool

MinimockCaptureMarkDone returns true if the count of the CaptureMark invocations corresponds the number of defined expectations

func (*ReportMock) MinimockCaptureMarkInspect

func (m *ReportMock) MinimockCaptureMarkInspect()

MinimockCaptureMarkInspect logs each unmet expectation

func (*ReportMock) MinimockDetailsDone

func (m *ReportMock) MinimockDetailsDone() bool

MinimockDetailsDone returns true if the count of the Details invocations corresponds the number of defined expectations

func (*ReportMock) MinimockDetailsInspect

func (m *ReportMock) MinimockDetailsInspect()

MinimockDetailsInspect logs each unmet expectation

func (*ReportMock) MinimockFinish

func (m *ReportMock) MinimockFinish()

MinimockFinish checks that all mocked methods have been called the expected number of times

func (*ReportMock) MinimockMisbehaviorTypeDone

func (m *ReportMock) MinimockMisbehaviorTypeDone() bool

MinimockMisbehaviorTypeDone returns true if the count of the MisbehaviorType invocations corresponds the number of defined expectations

func (*ReportMock) MinimockMisbehaviorTypeInspect

func (m *ReportMock) MinimockMisbehaviorTypeInspect()

MinimockMisbehaviorTypeInspect logs each unmet expectation

func (*ReportMock) MinimockViolatorHostDone

func (m *ReportMock) MinimockViolatorHostDone() bool

MinimockViolatorHostDone returns true if the count of the ViolatorHost invocations corresponds the number of defined expectations

func (*ReportMock) MinimockViolatorHostInspect

func (m *ReportMock) MinimockViolatorHostInspect()

MinimockViolatorHostInspect logs each unmet expectation

func (*ReportMock) MinimockViolatorNodeDone

func (m *ReportMock) MinimockViolatorNodeDone() bool

MinimockViolatorNodeDone returns true if the count of the ViolatorNode invocations corresponds the number of defined expectations

func (*ReportMock) MinimockViolatorNodeInspect

func (m *ReportMock) MinimockViolatorNodeInspect()

MinimockViolatorNodeInspect logs each unmet expectation

func (*ReportMock) MinimockWait

func (m *ReportMock) MinimockWait(timeout mm_time.Duration)

MinimockWait waits for all mocked methods to be called the expected number of times

func (*ReportMock) MisbehaviorType

func (mmMisbehaviorType *ReportMock) MisbehaviorType() (t1 Type)

MisbehaviorType implements Report

func (*ReportMock) MisbehaviorTypeAfterCounter

func (mmMisbehaviorType *ReportMock) MisbehaviorTypeAfterCounter() uint64

MisbehaviorTypeAfterCounter returns a count of finished ReportMock.MisbehaviorType invocations

func (*ReportMock) MisbehaviorTypeBeforeCounter

func (mmMisbehaviorType *ReportMock) MisbehaviorTypeBeforeCounter() uint64

MisbehaviorTypeBeforeCounter returns a count of ReportMock.MisbehaviorType invocations

func (*ReportMock) ViolatorHost

func (mmViolatorHost *ReportMock) ViolatorHost() (i1 endpoints.InboundConnection)

ViolatorHost implements Report

func (*ReportMock) ViolatorHostAfterCounter

func (mmViolatorHost *ReportMock) ViolatorHostAfterCounter() uint64

ViolatorHostAfterCounter returns a count of finished ReportMock.ViolatorHost invocations

func (*ReportMock) ViolatorHostBeforeCounter

func (mmViolatorHost *ReportMock) ViolatorHostBeforeCounter() uint64

ViolatorHostBeforeCounter returns a count of ReportMock.ViolatorHost invocations

func (*ReportMock) ViolatorNode

func (mmViolatorNode *ReportMock) ViolatorNode() (b1 profiles.BaseNode)

ViolatorNode implements Report

func (*ReportMock) ViolatorNodeAfterCounter

func (mmViolatorNode *ReportMock) ViolatorNodeAfterCounter() uint64

ViolatorNodeAfterCounter returns a count of finished ReportMock.ViolatorNode invocations

func (*ReportMock) ViolatorNodeBeforeCounter

func (mmViolatorNode *ReportMock) ViolatorNodeBeforeCounter() uint64

ViolatorNodeBeforeCounter returns a count of ReportMock.ViolatorNode invocations

type ReportMockCaptureMarkExpectation

type ReportMockCaptureMarkExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

ReportMockCaptureMarkExpectation specifies expectation struct of the Report.CaptureMark

type ReportMockCaptureMarkResults

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

ReportMockCaptureMarkResults contains results of the Report.CaptureMark

type ReportMockDetailsExpectation

type ReportMockDetailsExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

ReportMockDetailsExpectation specifies expectation struct of the Report.Details

type ReportMockDetailsResults

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

ReportMockDetailsResults contains results of the Report.Details

type ReportMockMisbehaviorTypeExpectation

type ReportMockMisbehaviorTypeExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

ReportMockMisbehaviorTypeExpectation specifies expectation struct of the Report.MisbehaviorType

type ReportMockMisbehaviorTypeResults

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

ReportMockMisbehaviorTypeResults contains results of the Report.MisbehaviorType

type ReportMockViolatorHostExpectation

type ReportMockViolatorHostExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

ReportMockViolatorHostExpectation specifies expectation struct of the Report.ViolatorHost

type ReportMockViolatorHostResults

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

ReportMockViolatorHostResults contains results of the Report.ViolatorHost

type ReportMockViolatorNodeExpectation

type ReportMockViolatorNodeExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

ReportMockViolatorNodeExpectation specifies expectation struct of the Report.ViolatorNode

type ReportMockViolatorNodeResults

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

ReportMockViolatorNodeResults contains results of the Report.ViolatorNode

type Type

type Type uint64

func (Type) Category

func (c Type) Category() Category

func (Type) Type

func (c Type) Type() int

Jump to

Keyboard shortcuts

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