stress

package
v0.0.0-...-6407dfe Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: ISC Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SemVer is the version of ircstress this is.
	SemVer = "0.0.1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	sync.Mutex

	Nick   string
	Socket *Socket
	// contains filtered or unexported fields
}

Client is a client connection

func NewClient

func NewClient(id int) Client

func (*Client) CloseExpected

func (client *Client) CloseExpected() bool

func (*Client) Connect

func (c *Client) Connect(server *Server) error

Connect connects to the given server

func (*Client) Disconnect

func (c *Client) Disconnect(server *Server)

Disconnect disconnects from the given server

func (*Client) LastPong

func (client *Client) LastPong() uint64

func (*Client) Ping

func (client *Client) Ping()

func (*Client) SetCloseExpected

func (client *Client) SetCloseExpected(val bool)

type Event

type Event struct {
	Type EventType
	Line string
	Wait *WaitMessage
}

Event is an IRC event.

type EventQueue

type EventQueue struct {
	Client Client
	Events []Event
	// contains filtered or unexported fields
}

EventQueue represents a series of events.

func NewEventQueue

func NewEventQueue(id int) EventQueue

NewEventQueue returns a new EventQueue

func (EventQueue) Run

func (queue EventQueue) Run(server *Server)

Run goes through our event list.

type EventType

type EventType int

EventType is the type of event it is.

const (
	// ETConnect represents the client connecting to the server.
	ETConnect EventType = iota
	// ETDisconnect represents the client disconnecting from the server.
	ETDisconnect
	// ETLine represents the client sending an IRC line to the server.
	ETLine
	// ETWait represents the client waiting for a specific response from the server.
	ETWait
	// ETPing causes the client to send a ping, then wait for the specific response
	ETPing
)

type NickSelector

type NickSelector struct {
	RandomNickOrder bool
	// contains filtered or unexported fields
}

NickSelector takes given nicknames and provides you with nicknames to use.

func NewNickSelector

func NewNickSelector() *NickSelector

NewNickSelector returns an empty NickSelector with no nicks.

func NickSelectorFromList

func NickSelectorFromList(nickList string) *NickSelector

NickSelectorFromList takes a list of nicks and returns a NickSelector.

func (*NickSelector) GetNick

func (ns *NickSelector) GetNick() string

GetNick returns a nickname from the selector.

type Server

type Server struct {
	ClientsReadyToDisconnect sync.WaitGroup
	ClientsFinished          sync.WaitGroup

	Name string
	Conn ServerConnectionDetails
	// contains filtered or unexported fields
}

Server represents a server we are stress-testing.

func (*Server) RecordSuccess

func (server *Server) RecordSuccess()

func (*Server) Succeeded

func (server *Server) Succeeded() uint64

type ServerConnectionDetails

type ServerConnectionDetails struct {
	Address string
	IsTLS   bool
}

ServerConnectionDetails holds the details used to connect to the server.

type Socket

type Socket struct {
	Closed bool
	// contains filtered or unexported fields
}

Socket represents an IRC socket.

func NewSocket

func NewSocket(conn net.Conn) Socket

NewSocket returns a new Socket.

func (*Socket) Close

func (socket *Socket) Close()

Close stops a Socket from being able to send/receive any more data.

func (*Socket) Read

func (socket *Socket) Read() (string, error)

Read returns a single IRC line from a Socket.

func (*Socket) Write

func (socket *Socket) Write(data string) error

Write sends the given string out of Socket.

func (*Socket) WriteLine

func (socket *Socket) WriteLine(line string) error

WriteLine writes the given line out of Socket.

type WaitMessage

type WaitMessage struct {
	// Command is the IRC command to wait for.
	Command *string
	// Params are the IRC message params to wait for.
	Params *string
}

WaitMessage is a message that the client should wait for.

Jump to

Keyboard shortcuts

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