Documentation ¶
Overview ¶
Package tcpconn contains a TCP connection disruptor.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrDurationTooShort = errors.New("duration must be at least 1 second")
ErrDurationTooShort is returned when the supplied duration is smaller than 1s.
Functions ¶
This section is empty.
Types ¶
type Disruptor ¶
Disruptor applies TCP Connection disruptions by dropping connections according to a Dropper. A filter decides which connections are considered for dropping.
type Dropper ¶
Dropper is an interface implemented by objects that decide whether a packet should be dropped (rejected).
type Filter ¶
type Filter struct { // Port is the target port to match which connections will be intercepted. Port uint }
Filter holds the matchers used to know which traffic should be intercepted.
type TCPConnectionDropper ¶
type TCPConnectionDropper struct {
DropRate float64
}
TCPConnectionDropper is a dropper that drops a defined percentage of TCP the connections it sees.
func (TCPConnectionDropper) Drop ¶
func (tcd TCPConnectionDropper) Drop(packetBytes []byte) bool
Drop decides whether a packet should be dropped by taking the modulus of hash of the connection it belongs to and comparing it to a threshold derived from DropRate.