attack

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DroppingTickDuration  = 2 * time.Second
	HitRate               = 10
	DelayResponseDuration = 10 * time.Second
	ViewIDThresholdMin    = 10
	ViewIDThresholdMax    = 100
)

Constants used for attack model.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	AttackEnabled bool

	ViewIDThreshold uint64
	// contains filtered or unexported fields
}

Model contains different models of attacking.

func GetInstance

func GetInstance() *Model

GetInstance returns attack model by using singleton pattern.

func (*Model) DelayResponse

func (attack *Model) DelayResponse()

DelayResponse does attack by delaying response.

func (*Model) IncorrectResponse

func (attack *Model) IncorrectResponse() bool

IncorrectResponse returns if the attack model enable incorrect responding.

func (*Model) Init

func (attack *Model) Init()

Init initializes attack model.

func (*Model) NodeKilledByItSelf

func (attack *Model) NodeKilledByItSelf()

NodeKilledByItSelf runs killing itself attack

func (*Model) Run

func (attack *Model) Run()

Run runs enabled attacks.

func (*Model) SetAttackEnabled

func (attack *Model) SetAttackEnabled(AttackEnabled bool)

SetAttackEnabled sets attack model enabled.

func (*Model) UpdateConsensusReady

func (attack *Model) UpdateConsensusReady(viewID uint64)

UpdateConsensusReady enables an attack type given the current viewID.

type Type

type Type byte

Type is the type of attack model.

const (
	KilledItself Type = iota
	DelayResponse
	IncorrectResponse
)

Constants of different attack models.

Jump to

Keyboard shortcuts

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