api

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.6.0 DO NOT EDIT.

Package api provides interfaces for the CipherSwarm API client. These interfaces enable dependency injection and improve testability by allowing mock implementations in tests.

Index

Constants

View Source
const (
	Bearer_authScopes = "bearer_auth.Scopes"
)

Variables

View Source
var ErrCircuitOpen = errors.New("circuit breaker is open")

ErrCircuitOpen is returned when the circuit breaker is open and not allowing requests.

Functions

func ConvertInt64SliceToInt

func ConvertInt64SliceToInt(s []int64) ([]int, int)

ConvertInt64SliceToInt converts []int64 to []int with bounds checking to prevent silent overflow on 32-bit platforms. Returns the converted slice and the number of values that were clamped to zero. Callers should log a warning when clamped > 0.

func HashListResponseStream

func HashListResponseStream(resp *GetHashListResponse) io.Reader

HashListResponseStream extracts the response body as an io.Reader from a GetHashListResponse. It uses the parsed Body bytes because the generated oapi-codegen parser reads and closes HTTPResponse.Body during parsing, making the original body stream unavailable. Returns io.Reader (vs io.ReadCloser) because callers in downloader.go don't need Close semantics.

func NewAuthenticateRequest

func NewAuthenticateRequest(server string) (*http.Request, error)

NewAuthenticateRequest generates requests for Authenticate

func NewGetAgentRequest

func NewGetAgentRequest(server string, id int64) (*http.Request, error)

NewGetAgentRequest generates requests for GetAgent

func NewGetAttackRequest

func NewGetAttackRequest(server string, id int64) (*http.Request, error)

NewGetAttackRequest generates requests for GetAttack

func NewGetConfigurationRequest

func NewGetConfigurationRequest(server string) (*http.Request, error)

NewGetConfigurationRequest generates requests for GetConfiguration

func NewGetHashListRequest

func NewGetHashListRequest(server string, id int64) (*http.Request, error)

NewGetHashListRequest generates requests for GetHashList

func NewGetHealthRequest added in v0.6.2

func NewGetHealthRequest(server string) (*http.Request, error)

NewGetHealthRequest generates requests for GetHealth

func NewGetNewTaskRequest

func NewGetNewTaskRequest(server string) (*http.Request, error)

NewGetNewTaskRequest generates requests for GetNewTask

func NewGetTaskRequest

func NewGetTaskRequest(server string, id int64) (*http.Request, error)

NewGetTaskRequest generates requests for GetTask

func NewGetTaskZapsRequest

func NewGetTaskZapsRequest(server string, id int64) (*http.Request, error)

NewGetTaskZapsRequest generates requests for GetTaskZaps

func NewSendCrackRequest

func NewSendCrackRequest(server string, id int64, body SendCrackJSONRequestBody) (*http.Request, error)

NewSendCrackRequest calls the generic SendCrack builder with application/json body

func NewSendCrackRequestWithBody

func NewSendCrackRequestWithBody(server string, id int64, contentType string, body io.Reader) (*http.Request, error)

NewSendCrackRequestWithBody generates requests for SendCrack with any type of body

func NewSendHeartbeatRequest

func NewSendHeartbeatRequest(server string, id int64, body SendHeartbeatJSONRequestBody) (*http.Request, error)

NewSendHeartbeatRequest calls the generic SendHeartbeat builder with application/json body

func NewSendHeartbeatRequestWithBody

func NewSendHeartbeatRequestWithBody(server string, id int64, contentType string, body io.Reader) (*http.Request, error)

NewSendHeartbeatRequestWithBody generates requests for SendHeartbeat with any type of body

func NewSendStatusRequest

func NewSendStatusRequest(server string, id int64, body SendStatusJSONRequestBody) (*http.Request, error)

NewSendStatusRequest calls the generic SendStatus builder with application/json body

func NewSendStatusRequestWithBody

func NewSendStatusRequestWithBody(server string, id int64, contentType string, body io.Reader) (*http.Request, error)

NewSendStatusRequestWithBody generates requests for SendStatus with any type of body

func NewSetAgentShutdownRequest

func NewSetAgentShutdownRequest(server string, id int64) (*http.Request, error)

NewSetAgentShutdownRequest generates requests for SetAgentShutdown

func NewSetTaskAbandonedRequest

func NewSetTaskAbandonedRequest(server string, id int64) (*http.Request, error)

NewSetTaskAbandonedRequest generates requests for SetTaskAbandoned

func NewSetTaskAcceptedRequest

func NewSetTaskAcceptedRequest(server string, id int64) (*http.Request, error)

NewSetTaskAcceptedRequest generates requests for SetTaskAccepted

func NewSetTaskExhaustedRequest

func NewSetTaskExhaustedRequest(server string, id int64) (*http.Request, error)

NewSetTaskExhaustedRequest generates requests for SetTaskExhausted

func NewSubmitBenchmarkRequest

func NewSubmitBenchmarkRequest(server string, id int64, body SubmitBenchmarkJSONRequestBody) (*http.Request, error)

NewSubmitBenchmarkRequest calls the generic SubmitBenchmark builder with application/json body

func NewSubmitBenchmarkRequestWithBody

func NewSubmitBenchmarkRequestWithBody(server string, id int64, contentType string, body io.Reader) (*http.Request, error)

NewSubmitBenchmarkRequestWithBody generates requests for SubmitBenchmark with any type of body

func NewSubmitErrorAgentRequest

func NewSubmitErrorAgentRequest(server string, id int64, body SubmitErrorAgentJSONRequestBody) (*http.Request, error)

NewSubmitErrorAgentRequest calls the generic SubmitErrorAgent builder with application/json body

func NewSubmitErrorAgentRequestWithBody

func NewSubmitErrorAgentRequestWithBody(server string, id int64, contentType string, body io.Reader) (*http.Request, error)

NewSubmitErrorAgentRequestWithBody generates requests for SubmitErrorAgent with any type of body

func NewUpdateAgentRequest

func NewUpdateAgentRequest(server string, id int64, body UpdateAgentJSONRequestBody) (*http.Request, error)

NewUpdateAgentRequest calls the generic UpdateAgent builder with application/json body

func NewUpdateAgentRequestWithBody

func NewUpdateAgentRequestWithBody(server string, id int64, contentType string, body io.Reader) (*http.Request, error)

NewUpdateAgentRequestWithBody generates requests for UpdateAgent with any type of body

func ResponseStream

func ResponseStream(resp *GetTaskZapsResponse) io.ReadCloser

ResponseStream extracts the response body as an io.ReadCloser from a GetTaskZapsResponse. It uses the parsed Body bytes because the generated oapi-codegen parser reads and closes HTTPResponse.Body during parsing, making the original body stream unavailable. Returns io.ReadCloser (vs io.Reader) because callers in zap.go defer-close the stream.

Types

type APIClient

type APIClient interface {
	Tasks() TasksClient
	Attacks() AttacksClient
	Agents() AgentsClient
	Auth() AuthClient
}

APIClient is the aggregate interface combining all API subsystems. This can be implemented by the AgentClient wrapper or by mocks in tests.

type APIError

type APIError struct {
	StatusCode int
	Message    string
	Body       string
}

APIError represents an HTTP error returned by the CipherSwarm API. It serves as the unified internal error type for 4xx and 5xx API responses. For the API error object model (JSON "error" field), see ErrorObject.

func (*APIError) Error

func (e *APIError) Error() string

Error returns a formatted error string including the status code and body.

type AdvancedAgentConfiguration

type AdvancedAgentConfiguration struct {
	// AgentUpdateInterval The interval in seconds to check for agent updates
	AgentUpdateInterval *int `json:"agent_update_interval"`

	// BackendDevice The device to use for hashcat, separated by commas
	BackendDevice *string `json:"backend_device"`

	// EnableAdditionalHashTypes Causes hashcat to perform benchmark-all, rather than just benchmark
	EnableAdditionalHashTypes bool `json:"enable_additional_hash_types"`

	// OpenclDevices The OpenCL device types to use for hashcat, separated by commas
	OpenclDevices *string `json:"opencl_devices,omitempty"`

	// UseNativeHashcat Use the hashcat binary already installed on the client system
	UseNativeHashcat *bool `json:"use_native_hashcat"`
}

AdvancedAgentConfiguration Advanced hashcat and agent configuration options

type Agent

type Agent struct {
	// AdvancedConfiguration Advanced hashcat and agent configuration options
	AdvancedConfiguration AdvancedAgentConfiguration `json:"advanced_configuration"`

	// ClientSignature The signature of the client
	ClientSignature string `json:"client_signature"`

	// CurrentActivity Current agent activity state
	CurrentActivity *string  `json:"current_activity,omitempty"`
	Devices         []string `json:"devices"`

	// HostName The hostname of the agent
	HostName string `json:"host_name"`

	// Id The id of the agent
	Id int64 `json:"id"`

	// OperatingSystem The operating system of the agent
	OperatingSystem string `json:"operating_system"`

	// State The state of the agent
	State AgentState `json:"state"`
}

Agent A cracking agent registered with CipherSwarm

type AgentClient

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

AgentClient wraps the generated ClientWithResponses and implements the APIClient interface.

func NewAgentClient

func NewAgentClient(serverURL, token string, cfg TransportConfig) (*AgentClient, error)

NewAgentClient creates a new AgentClient with a layered transport chain. Layers (inner to outer): http.Transport -> CircuitTransport -> RetryTransport -> http.Client.

func (*AgentClient) Agents

func (a *AgentClient) Agents() AgentsClient

Agents returns a sub-client for agent-related API operations.

func (*AgentClient) Attacks

func (a *AgentClient) Attacks() AttacksClient

Attacks returns a sub-client for attack-related API operations.

func (*AgentClient) Auth

func (a *AgentClient) Auth() AuthClient

Auth returns a sub-client for authentication-related API operations.

func (*AgentClient) Tasks

func (a *AgentClient) Tasks() TasksClient

Tasks returns a sub-client for task-related API operations.

type AgentHeartbeatRequest added in v0.6.2

type AgentHeartbeatRequest struct {
	// Activity Current agent activity state. Known values: starting, benchmarking, updating, downloading, waiting, cracking, stopping. Future versions may support additional values.
	Activity *string `json:"activity,omitempty"`
}

AgentHeartbeatRequest Optional activity state update sent with an agent heartbeat

type AgentState

type AgentState string

AgentState The state of the agent

const (
	AgentStateActive  AgentState = "active"
	AgentStateError   AgentState = "error"
	AgentStateOffline AgentState = "offline"
	AgentStatePending AgentState = "pending"
	AgentStateStopped AgentState = "stopped"
)

Defines values for AgentState.

func (AgentState) Valid added in v0.6.2

func (e AgentState) Valid() bool

Valid indicates whether the value is a known member of the AgentState enum.

type AgentsClient

type AgentsClient interface {
	// SendHeartbeat sends a heartbeat to the server with the current activity state.
	SendHeartbeat(ctx context.Context, id int64, activity string) (*SendHeartbeatResponse, error)

	// UpdateAgent updates agent metadata.
	UpdateAgent(
		ctx context.Context,
		id int64,
		body UpdateAgentJSONRequestBody,
	) (*UpdateAgentResponse, error)

	// SubmitBenchmark submits benchmark results.
	SubmitBenchmark(
		ctx context.Context,
		id int64,
		body SubmitBenchmarkJSONRequestBody,
	) (*SubmitBenchmarkResponse, error)

	// SubmitErrorAgent reports an error to the server.
	SubmitErrorAgent(
		ctx context.Context,
		id int64,
		body SubmitErrorAgentJSONRequestBody,
	) (*SubmitErrorAgentResponse, error)

	// SetAgentShutdown notifies the server of agent shutdown.
	SetAgentShutdown(ctx context.Context, id int64) (*SetAgentShutdownResponse, error)
}

AgentsClient defines the interface for agent-related API operations. It groups all agent-identity operations (heartbeat, metadata, benchmarks, errors, shutdown) because they share the same agent_id path parameter and auth scope. Splitting into finer-grained interfaces would add overhead without practical testability gain at this codebase size.

type Attack

type Attack struct {
	// AttackMode Attack mode name
	AttackMode AttackAttackMode `json:"attack_mode"`

	// AttackModeHashcat hashcat attack mode
	AttackModeHashcat int `json:"attack_mode_hashcat"`

	// ClassicMarkov Enable hashcat classic markov mode
	ClassicMarkov bool `json:"classic_markov"`

	// CustomCharset1 Custom charset 1 for hashcat mask attacks
	CustomCharset1 *string `json:"custom_charset_1,omitempty"`

	// CustomCharset2 Custom charset 2 for hashcat mask attacks
	CustomCharset2 *string `json:"custom_charset_2,omitempty"`

	// CustomCharset3 Custom charset 3 for hashcat mask attacks
	CustomCharset3 *string `json:"custom_charset_3,omitempty"`

	// CustomCharset4 Custom charset 4 for hashcat mask attacks
	CustomCharset4 *string `json:"custom_charset_4,omitempty"`

	// DisableMarkov Disable hashcat markov mode
	DisableMarkov bool `json:"disable_markov"`

	// HashListChecksum The MD5 checksum of the hash list
	HashListChecksum *[]byte `json:"hash_list_checksum"`

	// HashListId The id of the hash list
	HashListId int64 `json:"hash_list_id"`

	// HashListUrl The download URL for the hash list
	HashListUrl *string `json:"hash_list_url"`

	// HashMode The hashcat hash mode
	HashMode int `json:"hash_mode"`

	// Id The id of the attack
	Id int64 `json:"id"`

	// IncrementMaximum The end of the increment range
	IncrementMaximum int `json:"increment_maximum"`

	// IncrementMinimum The start of the increment range
	IncrementMinimum int `json:"increment_minimum"`

	// IncrementMode Enable hashcat increment mode
	IncrementMode bool `json:"increment_mode"`

	// LeftRule The left-hand rule for combinator attacks
	LeftRule *string `json:"left_rule,omitempty"`

	// MarkovThreshold The hashcat markov threshold
	MarkovThreshold *int `json:"markov_threshold,omitempty"`

	// Mask A hashcat mask string
	Mask *string `json:"mask,omitempty"`

	// MaskList A downloadable resource file (word list, rule list, or mask list) used by an attack
	MaskList *AttackResourceFile `json:"mask_list,omitempty"`

	// Optimized Enable hashcat optimized mode
	Optimized bool `json:"optimized"`

	// RightRule The right-hand rule for combinator attacks
	RightRule *string `json:"right_rule,omitempty"`

	// RuleList A downloadable resource file (word list, rule list, or mask list) used by an attack
	RuleList *AttackResourceFile `json:"rule_list,omitempty"`

	// SlowCandidateGenerators Enable hashcat slow candidate generators
	SlowCandidateGenerators bool `json:"slow_candidate_generators"`

	// Url The URL to the attack
	Url *string `json:"url"`

	// WordList A downloadable resource file (word list, rule list, or mask list) used by an attack
	WordList *AttackResourceFile `json:"word_list,omitempty"`

	// WorkloadProfile The hashcat workload profile
	WorkloadProfile int `json:"workload_profile"`
}

Attack A hashcat attack configuration assigned to an agent

type AttackAttackMode

type AttackAttackMode string

AttackAttackMode Attack mode name

const (
	Dictionary       AttackAttackMode = "dictionary"
	HybridDictionary AttackAttackMode = "hybrid_dictionary"
	HybridMask       AttackAttackMode = "hybrid_mask"
	Mask             AttackAttackMode = "mask"
)

Defines values for AttackAttackMode.

func (AttackAttackMode) Valid added in v0.6.2

func (e AttackAttackMode) Valid() bool

Valid indicates whether the value is a known member of the AttackAttackMode enum.

type AttackResourceFile

type AttackResourceFile struct {
	// Checksum The MD5 checksum of the resource file
	Checksum []byte `json:"checksum"`

	// DownloadUrl The download URL of the resource file
	DownloadUrl string `json:"download_url"`

	// FileName The name of the resource file
	FileName string `json:"file_name"`

	// Id The id of the resource file
	Id int64 `json:"id"`
}

AttackResourceFile A downloadable resource file (word list, rule list, or mask list) used by an attack

type AttacksClient

type AttacksClient interface {
	// GetAttack retrieves attack parameters by ID.
	GetAttack(ctx context.Context, id int64) (*GetAttackResponse, error)

	// GetHashList retrieves the hash list for an attack.
	GetHashList(ctx context.Context, id int64) (*GetHashListResponse, error)
}

AttacksClient defines the interface for attack-related API operations.

type AuthClient

type AuthClient interface {
	// Authenticate verifies agent credentials with the server.
	Authenticate(ctx context.Context) (*AuthenticateResponse, error)

	// GetConfiguration retrieves agent configuration from the server.
	GetConfiguration(ctx context.Context) (*GetConfigurationResponse, error)
}

AuthClient defines the interface for authentication-related API operations.

type AuthenticateResponse

type AuthenticateResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *AuthenticationResponse
	JSON401      *ErrorObject
}

func ParseAuthenticateResponse

func ParseAuthenticateResponse(rsp *http.Response) (*AuthenticateResponse, error)

ParseAuthenticateResponse parses an HTTP response from a AuthenticateWithResponse call

func (AuthenticateResponse) Status

func (r AuthenticateResponse) Status() string

Status returns HTTPResponse.Status

func (AuthenticateResponse) StatusCode

func (r AuthenticateResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type AuthenticationResponse added in v0.6.2

type AuthenticationResponse struct {
	AgentId       int64 `json:"agent_id"`
	Authenticated bool  `json:"authenticated"`
}

AuthenticationResponse The response to a successful agent authentication

type BenchmarkReceipt added in v0.6.2

type BenchmarkReceipt struct {
	// FailedCount Number of benchmark entries rejected due to validation failures
	FailedCount int `json:"failed_count"`

	// Message Human-readable summary of the submission result
	Message *string `json:"message,omitempty"`

	// ProcessedCount Number of benchmark entries successfully stored
	ProcessedCount int `json:"processed_count"`

	// ReceivedCount Number of benchmark entries received in the request
	ReceivedCount int `json:"received_count"`
}

BenchmarkReceipt Receipt returned after benchmark submission indicating how many entries were accepted

type CircuitBreaker added in v0.6.2

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

CircuitBreaker implements the circuit breaker pattern for API resilience. It tracks consecutive failures and opens the circuit when a threshold is reached, preventing further requests until a timeout expires and a probe request succeeds.

When used inside a RetryTransport, each retry attempt counts as a separate failure. A threshold of 5 with 3 retries means the circuit can open after 2 logical requests.

Thread-safe: all methods use a mutex for synchronization.

func NewCircuitBreaker added in v0.6.2

func NewCircuitBreaker(failureThreshold int, timeout time.Duration) *CircuitBreaker

NewCircuitBreaker creates a circuit breaker with the given failure threshold and timeout. A failureThreshold < 1 is clamped to 1 to prevent a degenerate breaker that opens on the very first failure.

func (*CircuitBreaker) Allow added in v0.6.2

func (cb *CircuitBreaker) Allow() bool

Allow returns true if the circuit breaker allows a request to proceed. In closed state, always allows. In open state, allows only after the timeout has elapsed (transitions to half-open for a single probe request).

func (*CircuitBreaker) RecordFailure added in v0.6.2

func (cb *CircuitBreaker) RecordFailure()

RecordFailure records a failed request. Increments failure count and opens the circuit if the threshold is reached. In half-open state, immediately reopens.

func (*CircuitBreaker) RecordSuccess added in v0.6.2

func (cb *CircuitBreaker) RecordSuccess()

RecordSuccess records a successful request. Resets failure count and closes the circuit.

func (*CircuitBreaker) Reset added in v0.6.2

func (cb *CircuitBreaker) Reset()

Reset clears the circuit breaker state back to closed with zero failures.

type CircuitTransport added in v0.6.2

type CircuitTransport struct {
	Base    http.RoundTripper
	Breaker *CircuitBreaker
	Logger  *slog.Logger // Optional structured logger; nil disables logging.
}

CircuitTransport wraps an http.RoundTripper with circuit breaker logic. When the circuit is open, requests are rejected immediately with ErrCircuitOpen. Successful responses (non-5xx) reset the failure count; server errors (5xx) and network errors increment it toward the circuit-open threshold.

func (*CircuitTransport) RoundTrip added in v0.6.2

func (ct *CircuitTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper with circuit breaker protection.

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) Authenticate

func (c *Client) Authenticate(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetAgent

func (c *Client) GetAgent(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetAttack

func (c *Client) GetAttack(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetConfiguration

func (c *Client) GetConfiguration(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetHashList

func (c *Client) GetHashList(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetHealth added in v0.6.2

func (c *Client) GetHealth(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetNewTask

func (c *Client) GetNewTask(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetTask

func (c *Client) GetTask(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetTaskZaps

func (c *Client) GetTaskZaps(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SendCrack

func (c *Client) SendCrack(ctx context.Context, id int64, body SendCrackJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SendCrackWithBody

func (c *Client) SendCrackWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SendHeartbeat

func (c *Client) SendHeartbeat(ctx context.Context, id int64, body SendHeartbeatJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SendHeartbeatWithBody

func (c *Client) SendHeartbeatWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SendStatus

func (c *Client) SendStatus(ctx context.Context, id int64, body SendStatusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SendStatusWithBody

func (c *Client) SendStatusWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SetAgentShutdown

func (c *Client) SetAgentShutdown(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SetTaskAbandoned

func (c *Client) SetTaskAbandoned(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SetTaskAccepted

func (c *Client) SetTaskAccepted(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SetTaskExhausted

func (c *Client) SetTaskExhausted(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SubmitBenchmark

func (c *Client) SubmitBenchmark(ctx context.Context, id int64, body SubmitBenchmarkJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SubmitBenchmarkWithBody

func (c *Client) SubmitBenchmarkWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SubmitErrorAgent

func (c *Client) SubmitErrorAgent(ctx context.Context, id int64, body SubmitErrorAgentJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) SubmitErrorAgentWithBody

func (c *Client) SubmitErrorAgentWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) UpdateAgent

func (c *Client) UpdateAgent(ctx context.Context, id int64, body UpdateAgentJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) UpdateAgentWithBody

func (c *Client) UpdateAgentWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// GetAgent request
	GetAgent(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// UpdateAgentWithBody request with any body
	UpdateAgentWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	UpdateAgent(ctx context.Context, id int64, body UpdateAgentJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SendHeartbeatWithBody request with any body
	SendHeartbeatWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	SendHeartbeat(ctx context.Context, id int64, body SendHeartbeatJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SetAgentShutdown request
	SetAgentShutdown(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SubmitBenchmarkWithBody request with any body
	SubmitBenchmarkWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	SubmitBenchmark(ctx context.Context, id int64, body SubmitBenchmarkJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SubmitErrorAgentWithBody request with any body
	SubmitErrorAgentWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	SubmitErrorAgent(ctx context.Context, id int64, body SubmitErrorAgentJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetAttack request
	GetAttack(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetHashList request
	GetHashList(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// Authenticate request
	Authenticate(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetConfiguration request
	GetConfiguration(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetHealth request
	GetHealth(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetNewTask request
	GetNewTask(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetTask request
	GetTask(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SetTaskAbandoned request
	SetTaskAbandoned(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SetTaskAccepted request
	SetTaskAccepted(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SetTaskExhausted request
	SetTaskExhausted(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetTaskZaps request
	GetTaskZaps(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SendCrackWithBody request with any body
	SendCrackWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	SendCrack(ctx context.Context, id int64, body SendCrackJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// SendStatusWithBody request with any body
	SendStatusWithBody(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	SendStatus(ctx context.Context, id int64, body SendStatusJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) AuthenticateWithResponse

func (c *ClientWithResponses) AuthenticateWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*AuthenticateResponse, error)

AuthenticateWithResponse request returning *AuthenticateResponse

func (*ClientWithResponses) GetAgentWithResponse

func (c *ClientWithResponses) GetAgentWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetAgentResponse, error)

GetAgentWithResponse request returning *GetAgentResponse

func (*ClientWithResponses) GetAttackWithResponse

func (c *ClientWithResponses) GetAttackWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetAttackResponse, error)

GetAttackWithResponse request returning *GetAttackResponse

func (*ClientWithResponses) GetConfigurationWithResponse

func (c *ClientWithResponses) GetConfigurationWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetConfigurationResponse, error)

GetConfigurationWithResponse request returning *GetConfigurationResponse

func (*ClientWithResponses) GetHashListWithResponse

func (c *ClientWithResponses) GetHashListWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetHashListResponse, error)

GetHashListWithResponse request returning *GetHashListResponse

func (*ClientWithResponses) GetHealthWithResponse added in v0.6.2

func (c *ClientWithResponses) GetHealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetHealthResponse, error)

GetHealthWithResponse request returning *GetHealthResponse

func (*ClientWithResponses) GetNewTaskWithResponse

func (c *ClientWithResponses) GetNewTaskWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetNewTaskResponse, error)

GetNewTaskWithResponse request returning *GetNewTaskResponse

func (*ClientWithResponses) GetTaskWithResponse

func (c *ClientWithResponses) GetTaskWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetTaskResponse, error)

GetTaskWithResponse request returning *GetTaskResponse

func (*ClientWithResponses) GetTaskZapsWithResponse

func (c *ClientWithResponses) GetTaskZapsWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetTaskZapsResponse, error)

GetTaskZapsWithResponse request returning *GetTaskZapsResponse

func (*ClientWithResponses) SendCrackWithBodyWithResponse

func (c *ClientWithResponses) SendCrackWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SendCrackResponse, error)

SendCrackWithBodyWithResponse request with arbitrary body returning *SendCrackResponse

func (*ClientWithResponses) SendCrackWithResponse

func (c *ClientWithResponses) SendCrackWithResponse(ctx context.Context, id int64, body SendCrackJSONRequestBody, reqEditors ...RequestEditorFn) (*SendCrackResponse, error)

func (*ClientWithResponses) SendHeartbeatWithBodyWithResponse

func (c *ClientWithResponses) SendHeartbeatWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SendHeartbeatResponse, error)

SendHeartbeatWithBodyWithResponse request with arbitrary body returning *SendHeartbeatResponse

func (*ClientWithResponses) SendHeartbeatWithResponse

func (c *ClientWithResponses) SendHeartbeatWithResponse(ctx context.Context, id int64, body SendHeartbeatJSONRequestBody, reqEditors ...RequestEditorFn) (*SendHeartbeatResponse, error)

func (*ClientWithResponses) SendStatusWithBodyWithResponse

func (c *ClientWithResponses) SendStatusWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SendStatusResponse, error)

SendStatusWithBodyWithResponse request with arbitrary body returning *SendStatusResponse

func (*ClientWithResponses) SendStatusWithResponse

func (c *ClientWithResponses) SendStatusWithResponse(ctx context.Context, id int64, body SendStatusJSONRequestBody, reqEditors ...RequestEditorFn) (*SendStatusResponse, error)

func (*ClientWithResponses) SetAgentShutdownWithResponse

func (c *ClientWithResponses) SetAgentShutdownWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*SetAgentShutdownResponse, error)

SetAgentShutdownWithResponse request returning *SetAgentShutdownResponse

func (*ClientWithResponses) SetTaskAbandonedWithResponse

func (c *ClientWithResponses) SetTaskAbandonedWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*SetTaskAbandonedResponse, error)

SetTaskAbandonedWithResponse request returning *SetTaskAbandonedResponse

func (*ClientWithResponses) SetTaskAcceptedWithResponse

func (c *ClientWithResponses) SetTaskAcceptedWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*SetTaskAcceptedResponse, error)

SetTaskAcceptedWithResponse request returning *SetTaskAcceptedResponse

func (*ClientWithResponses) SetTaskExhaustedWithResponse

func (c *ClientWithResponses) SetTaskExhaustedWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*SetTaskExhaustedResponse, error)

SetTaskExhaustedWithResponse request returning *SetTaskExhaustedResponse

func (*ClientWithResponses) SubmitBenchmarkWithBodyWithResponse

func (c *ClientWithResponses) SubmitBenchmarkWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SubmitBenchmarkResponse, error)

SubmitBenchmarkWithBodyWithResponse request with arbitrary body returning *SubmitBenchmarkResponse

func (*ClientWithResponses) SubmitBenchmarkWithResponse

func (c *ClientWithResponses) SubmitBenchmarkWithResponse(ctx context.Context, id int64, body SubmitBenchmarkJSONRequestBody, reqEditors ...RequestEditorFn) (*SubmitBenchmarkResponse, error)

func (*ClientWithResponses) SubmitErrorAgentWithBodyWithResponse

func (c *ClientWithResponses) SubmitErrorAgentWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SubmitErrorAgentResponse, error)

SubmitErrorAgentWithBodyWithResponse request with arbitrary body returning *SubmitErrorAgentResponse

func (*ClientWithResponses) SubmitErrorAgentWithResponse

func (c *ClientWithResponses) SubmitErrorAgentWithResponse(ctx context.Context, id int64, body SubmitErrorAgentJSONRequestBody, reqEditors ...RequestEditorFn) (*SubmitErrorAgentResponse, error)

func (*ClientWithResponses) UpdateAgentWithBodyWithResponse

func (c *ClientWithResponses) UpdateAgentWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateAgentResponse, error)

UpdateAgentWithBodyWithResponse request with arbitrary body returning *UpdateAgentResponse

func (*ClientWithResponses) UpdateAgentWithResponse

func (c *ClientWithResponses) UpdateAgentWithResponse(ctx context.Context, id int64, body UpdateAgentJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateAgentResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetAgentWithResponse request
	GetAgentWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetAgentResponse, error)

	// UpdateAgentWithBodyWithResponse request with any body
	UpdateAgentWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateAgentResponse, error)

	UpdateAgentWithResponse(ctx context.Context, id int64, body UpdateAgentJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateAgentResponse, error)

	// SendHeartbeatWithBodyWithResponse request with any body
	SendHeartbeatWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SendHeartbeatResponse, error)

	SendHeartbeatWithResponse(ctx context.Context, id int64, body SendHeartbeatJSONRequestBody, reqEditors ...RequestEditorFn) (*SendHeartbeatResponse, error)

	// SetAgentShutdownWithResponse request
	SetAgentShutdownWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*SetAgentShutdownResponse, error)

	// SubmitBenchmarkWithBodyWithResponse request with any body
	SubmitBenchmarkWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SubmitBenchmarkResponse, error)

	SubmitBenchmarkWithResponse(ctx context.Context, id int64, body SubmitBenchmarkJSONRequestBody, reqEditors ...RequestEditorFn) (*SubmitBenchmarkResponse, error)

	// SubmitErrorAgentWithBodyWithResponse request with any body
	SubmitErrorAgentWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SubmitErrorAgentResponse, error)

	SubmitErrorAgentWithResponse(ctx context.Context, id int64, body SubmitErrorAgentJSONRequestBody, reqEditors ...RequestEditorFn) (*SubmitErrorAgentResponse, error)

	// GetAttackWithResponse request
	GetAttackWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetAttackResponse, error)

	// GetHashListWithResponse request
	GetHashListWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetHashListResponse, error)

	// AuthenticateWithResponse request
	AuthenticateWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*AuthenticateResponse, error)

	// GetConfigurationWithResponse request
	GetConfigurationWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetConfigurationResponse, error)

	// GetHealthWithResponse request
	GetHealthWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetHealthResponse, error)

	// GetNewTaskWithResponse request
	GetNewTaskWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetNewTaskResponse, error)

	// GetTaskWithResponse request
	GetTaskWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetTaskResponse, error)

	// SetTaskAbandonedWithResponse request
	SetTaskAbandonedWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*SetTaskAbandonedResponse, error)

	// SetTaskAcceptedWithResponse request
	SetTaskAcceptedWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*SetTaskAcceptedResponse, error)

	// SetTaskExhaustedWithResponse request
	SetTaskExhaustedWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*SetTaskExhaustedResponse, error)

	// GetTaskZapsWithResponse request
	GetTaskZapsWithResponse(ctx context.Context, id int64, reqEditors ...RequestEditorFn) (*GetTaskZapsResponse, error)

	// SendCrackWithBodyWithResponse request with any body
	SendCrackWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SendCrackResponse, error)

	SendCrackWithResponse(ctx context.Context, id int64, body SendCrackJSONRequestBody, reqEditors ...RequestEditorFn) (*SendCrackResponse, error)

	// SendStatusWithBodyWithResponse request with any body
	SendStatusWithBodyWithResponse(ctx context.Context, id int64, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SendStatusResponse, error)

	SendStatusWithResponse(ctx context.Context, id int64, body SendStatusJSONRequestBody, reqEditors ...RequestEditorFn) (*SendStatusResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type ConfigurationResponse added in v0.6.2

type ConfigurationResponse struct {
	// ApiVersion The minimum accepted version of the API
	ApiVersion int `json:"api_version"`

	// BenchmarksNeeded Whether the agent needs to run benchmarks
	BenchmarksNeeded bool `json:"benchmarks_needed"`

	// Config Advanced hashcat and agent configuration options
	Config AdvancedAgentConfiguration `json:"config"`

	// RecommendedCircuitBreaker Recommended circuit breaker settings for agent connections
	RecommendedCircuitBreaker struct {
		// FailureThreshold Number of failures before circuit opens
		FailureThreshold int `json:"failure_threshold"`

		// Timeout Seconds before circuit half-opens for retry
		Timeout int `json:"timeout"`
	} `json:"recommended_circuit_breaker"`

	// RecommendedRetry Recommended retry settings for agent HTTP requests
	RecommendedRetry struct {
		// InitialDelay Initial retry delay in seconds
		InitialDelay int `json:"initial_delay"`

		// MaxAttempts Maximum number of retry attempts
		MaxAttempts int `json:"max_attempts"`

		// MaxDelay Maximum retry delay in seconds
		MaxDelay int `json:"max_delay"`
	} `json:"recommended_retry"`

	// RecommendedTimeouts Recommended timeout settings for agent HTTP connections
	RecommendedTimeouts struct {
		// ConnectTimeout TCP connect timeout in seconds
		ConnectTimeout int `json:"connect_timeout"`

		// ReadTimeout Read timeout in seconds
		ReadTimeout int `json:"read_timeout"`

		// RequestTimeout Overall request timeout in seconds
		RequestTimeout int `json:"request_timeout"`

		// WriteTimeout Write timeout in seconds
		WriteTimeout int `json:"write_timeout"`
	} `json:"recommended_timeouts"`
}

ConfigurationResponse Agent configuration including advanced settings and resilience parameters

type DeviceStatus

type DeviceStatus struct {
	// DeviceId The id of the device
	DeviceId int `json:"device_id"`

	// DeviceName The name of the device
	DeviceName string `json:"device_name"`

	// DeviceType The type of the device
	DeviceType DeviceStatusDeviceType `json:"device_type"`

	// Speed The speed of the device
	Speed int64 `json:"speed"`

	// Temperature The temperature of the device, or -1 if unmonitored.
	Temperature int `json:"temperature"`

	// Utilization The utilization of the device
	Utilization int `json:"utilization"`
}

DeviceStatus Status and performance metrics for a single GPU or CPU device

type DeviceStatusDeviceType

type DeviceStatusDeviceType string

DeviceStatusDeviceType The type of the device

const (
	CPU DeviceStatusDeviceType = "CPU"
	GPU DeviceStatusDeviceType = "GPU"
)

Defines values for DeviceStatusDeviceType.

func (DeviceStatusDeviceType) Valid added in v0.6.2

func (e DeviceStatusDeviceType) Valid() bool

Valid indicates whether the value is a known member of the DeviceStatusDeviceType enum.

type ErrorMetadata added in v0.6.2

type ErrorMetadata struct {
	// ErrorDate The date of the error
	ErrorDate time.Time `json:"error_date"`

	// Other Structured error context from the agent
	Other *ErrorMetadata_Other `json:"other,omitempty"`
}

ErrorMetadata Additional metadata about an agent error

type ErrorMetadata_Other added in v0.6.2

type ErrorMetadata_Other struct {
	// AffectedCount Number of hashes affected by the error
	AffectedCount *int `json:"affected_count,omitempty"`

	// Category Error category (e.g. hash_format, device, network)
	Category *string `json:"category,omitempty"`

	// ErrorType Machine-readable error type slug
	ErrorType *string `json:"error_type,omitempty"`

	// Retryable Whether the operation can be retried
	Retryable *bool `json:"retryable,omitempty"`

	// Terminal Whether the error is definitively unrecoverable
	Terminal *bool `json:"terminal,omitempty"`

	// TotalCount Total number of hashes in the hash list
	TotalCount           *int                   `json:"total_count,omitempty"`
	AdditionalProperties map[string]interface{} `json:"-"`
}

ErrorMetadata_Other Structured error context from the agent

func (ErrorMetadata_Other) Get added in v0.6.2

func (a ErrorMetadata_Other) Get(fieldName string) (value interface{}, found bool)

Getter for additional properties for ErrorMetadata_Other. Returns the specified element and whether it was found

func (ErrorMetadata_Other) MarshalJSON added in v0.6.2

func (a ErrorMetadata_Other) MarshalJSON() ([]byte, error)

Override default JSON handling for ErrorMetadata_Other to handle AdditionalProperties

func (*ErrorMetadata_Other) Set added in v0.6.2

func (a *ErrorMetadata_Other) Set(fieldName string, value interface{})

Setter for additional properties for ErrorMetadata_Other

func (*ErrorMetadata_Other) UnmarshalJSON added in v0.6.2

func (a *ErrorMetadata_Other) UnmarshalJSON(b []byte) error

Override default JSON handling for ErrorMetadata_Other to handle AdditionalProperties

type ErrorObject

type ErrorObject struct {
	Err                  string         `json:"error"`
	AdditionalProperties map[string]any `json:"-"`
}

ErrorObject represents an API error object with an "error" JSON field. It implements the error interface and maps to the OpenAPI ErrorObject schema. The generated ErrorObject schema is excluded from client.gen.go (via exclude-schemas in config.yaml) because a struct field named "Error" conflicts with the Error() method required by the error interface. The Err field is serialized as "error" in JSON to match the API contract.

func (*ErrorObject) Error

func (e *ErrorObject) Error() string

Error implements the error interface, returning the error message.

func (*ErrorObject) Get

func (e *ErrorObject) Get(fieldName string) (any, bool)

Get returns the specified additional property and whether it was found.

func (*ErrorObject) MarshalJSON

func (e *ErrorObject) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaling to handle AdditionalProperties.

func (*ErrorObject) Set

func (e *ErrorObject) Set(fieldName string, value any)

Set sets the specified additional property.

func (*ErrorObject) UnmarshalJSON

func (e *ErrorObject) UnmarshalJSON(b []byte) error

UnmarshalJSON implements custom JSON unmarshaling to handle AdditionalProperties.

type GetAgentResponse

type GetAgentResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Agent
	JSON401      *ErrorObject
}

func ParseGetAgentResponse

func ParseGetAgentResponse(rsp *http.Response) (*GetAgentResponse, error)

ParseGetAgentResponse parses an HTTP response from a GetAgentWithResponse call

func (GetAgentResponse) Status

func (r GetAgentResponse) Status() string

Status returns HTTPResponse.Status

func (GetAgentResponse) StatusCode

func (r GetAgentResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetAttackResponse

type GetAttackResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Attack
	JSON401      *ErrorObject
	JSON404      *ErrorObject
}

func ParseGetAttackResponse

func ParseGetAttackResponse(rsp *http.Response) (*GetAttackResponse, error)

ParseGetAttackResponse parses an HTTP response from a GetAttackWithResponse call

func (GetAttackResponse) Status

func (r GetAttackResponse) Status() string

Status returns HTTPResponse.Status

func (GetAttackResponse) StatusCode

func (r GetAttackResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetConfigurationResponse

type GetConfigurationResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *ConfigurationResponse
	JSON401      *ErrorObject
}

func ParseGetConfigurationResponse

func ParseGetConfigurationResponse(rsp *http.Response) (*GetConfigurationResponse, error)

ParseGetConfigurationResponse parses an HTTP response from a GetConfigurationWithResponse call

func (GetConfigurationResponse) Status

func (r GetConfigurationResponse) Status() string

Status returns HTTPResponse.Status

func (GetConfigurationResponse) StatusCode

func (r GetConfigurationResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetHashListResponse

type GetHashListResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *ErrorObject
	JSON404      *ErrorObject
}

func ParseGetHashListResponse

func ParseGetHashListResponse(rsp *http.Response) (*GetHashListResponse, error)

ParseGetHashListResponse parses an HTTP response from a GetHashListWithResponse call

func (GetHashListResponse) Status

func (r GetHashListResponse) Status() string

Status returns HTTPResponse.Status

func (GetHashListResponse) StatusCode

func (r GetHashListResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetHealthResponse added in v0.6.2

type GetHealthResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		// ApiVersion API version
		ApiVersion int `json:"api_version"`

		// Database Database health (healthy or unhealthy)
		Database string `json:"database"`

		// Status Overall health status (ok or degraded)
		Status string `json:"status"`

		// Timestamp Server timestamp
		Timestamp time.Time `json:"timestamp"`
	}
	JSON503 *struct {
		// ApiVersion API version
		ApiVersion int `json:"api_version"`

		// Database Database health (healthy or unhealthy)
		Database string `json:"database"`

		// Status Overall health status (ok or degraded)
		Status string `json:"status"`

		// Timestamp Server timestamp
		Timestamp time.Time `json:"timestamp"`
	}
}

func ParseGetHealthResponse added in v0.6.2

func ParseGetHealthResponse(rsp *http.Response) (*GetHealthResponse, error)

ParseGetHealthResponse parses an HTTP response from a GetHealthWithResponse call

func (GetHealthResponse) Status added in v0.6.2

func (r GetHealthResponse) Status() string

Status returns HTTPResponse.Status

func (GetHealthResponse) StatusCode added in v0.6.2

func (r GetHealthResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetNewTaskResponse

type GetNewTaskResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Task
	JSON401      *ErrorObject
}

func ParseGetNewTaskResponse

func ParseGetNewTaskResponse(rsp *http.Response) (*GetNewTaskResponse, error)

ParseGetNewTaskResponse parses an HTTP response from a GetNewTaskWithResponse call

func (GetNewTaskResponse) Status

func (r GetNewTaskResponse) Status() string

Status returns HTTPResponse.Status

func (GetNewTaskResponse) StatusCode

func (r GetNewTaskResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetTaskResponse

type GetTaskResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Task
	JSON401      *ErrorObject
	JSON404      *ErrorObject
}

func ParseGetTaskResponse

func ParseGetTaskResponse(rsp *http.Response) (*GetTaskResponse, error)

ParseGetTaskResponse parses an HTTP response from a GetTaskWithResponse call

func (GetTaskResponse) Status

func (r GetTaskResponse) Status() string

Status returns HTTPResponse.Status

func (GetTaskResponse) StatusCode

func (r GetTaskResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetTaskZapsResponse

type GetTaskZapsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *ErrorObject
	JSON404      *ErrorObject
	JSON422      *ErrorObject
}

func ParseGetTaskZapsResponse

func ParseGetTaskZapsResponse(rsp *http.Response) (*GetTaskZapsResponse, error)

ParseGetTaskZapsResponse parses an HTTP response from a GetTaskZapsWithResponse call

func (GetTaskZapsResponse) Status

func (r GetTaskZapsResponse) Status() string

Status returns HTTPResponse.Status

func (GetTaskZapsResponse) StatusCode

func (r GetTaskZapsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HashcatBenchmark

type HashcatBenchmark struct {
	// Device The device used for the benchmark
	Device int `json:"device"`

	// HashSpeed The speed of the benchmark in hashes per second.
	HashSpeed float64 `json:"hash_speed"`

	// HashType The hashcat hash type
	HashType int `json:"hash_type"`

	// Runtime The runtime of the benchmark in milliseconds.
	Runtime int64 `json:"runtime"`
}

HashcatBenchmark A single hashcat benchmark result for a specific hash type and device

type HashcatGuess

type HashcatGuess struct {
	// GuessBase The base value used for the guess (for example, the mask)
	GuessBase string `json:"guess_base"`

	// GuessBaseCount The number of times the base value was used
	GuessBaseCount int64 `json:"guess_base_count"`

	// GuessBaseOffset The offset of the base value
	GuessBaseOffset int64 `json:"guess_base_offset"`

	// GuessBasePercentage The percentage completion of the base value
	GuessBasePercentage float64 `json:"guess_base_percentage"`

	// GuessMod The modifier used for the guess (for example, the wordlist)
	GuessMod string `json:"guess_mod"`

	// GuessModCount The number of times the modifier was used
	GuessModCount int64 `json:"guess_mod_count"`

	// GuessModOffset The offset of the modifier
	GuessModOffset int64 `json:"guess_mod_offset"`

	// GuessModPercentage The percentage completion of the modifier
	GuessModPercentage float64 `json:"guess_mod_percentage"`

	// GuessMode The mode used for the guess
	GuessMode int `json:"guess_mode"`
}

HashcatGuess Current hashcat guess progress including base and modifier values

type HashcatResult

type HashcatResult struct {
	// Hash The hash value
	Hash string `json:"hash"`

	// PlainText The plain text value
	PlainText string `json:"plain_text"`

	// Timestamp The time the hash was cracked
	Timestamp time.Time `json:"timestamp"`
}

HashcatResult A cracked hash result submitted by an agent

type HashcatStatusUpdate added in v0.6.2

type HashcatStatusUpdate struct {
	// DeviceStatuses The status of the devices used for the task
	DeviceStatuses []DeviceStatus `json:"device_statuses"`

	// EstimatedStop The estimated time of completion.
	EstimatedStop time.Time `json:"estimated_stop"`

	// HashcatGuess Current hashcat guess progress including base and modifier values
	HashcatGuess HashcatGuess `json:"hashcat_guess"`

	// OriginalLine The original line from hashcat
	OriginalLine string `json:"original_line"`

	// Progress The progress of the task
	Progress []int64 `json:"progress"`

	// RecoveredHashes The number of recovered hashes
	RecoveredHashes []int `json:"recovered_hashes"`

	// RecoveredSalts The number of recovered salts
	RecoveredSalts []int `json:"recovered_salts"`

	// Rejected The number of rejected guesses
	Rejected int64 `json:"rejected"`

	// RestorePoint The restore point of the task
	RestorePoint int64 `json:"restore_point"`

	// Session The session name
	Session string `json:"session"`

	// Status The status of the task
	Status int `json:"status"`

	// Target The target of the task
	Target string `json:"target"`

	// Time The time the status was received
	Time time.Time `json:"time"`

	// TimeStart The time the task started.
	TimeStart time.Time `json:"time_start"`
}

HashcatStatusUpdate A hashcat status update submitted by an agent during task execution

type HeartbeatResponse added in v0.6.2

type HeartbeatResponse struct {
	// State The state of the agent:
	//                        * `pending` - The agent needs to perform the setup process again.
	//                        * `active` - The agent is ready to accept tasks, all is good.
	//                        * `error` - The agent has encountered an error and needs to be checked.
	//                        * `stopped` - The agent has been stopped by the user.
	//                        * `offline` - The agent has not checked in recently and is considered offline.
	State HeartbeatResponseState `json:"state"`
}

HeartbeatResponse The response to an agent heartbeat

type HeartbeatResponseState added in v0.6.2

type HeartbeatResponseState string

HeartbeatResponseState The state of the agent:

  • `pending` - The agent needs to perform the setup process again.
  • `active` - The agent is ready to accept tasks, all is good.
  • `error` - The agent has encountered an error and needs to be checked.
  • `stopped` - The agent has been stopped by the user.
  • `offline` - The agent has not checked in recently and is considered offline.
const (
	HeartbeatResponseStateActive  HeartbeatResponseState = "active"
	HeartbeatResponseStateError   HeartbeatResponseState = "error"
	HeartbeatResponseStateOffline HeartbeatResponseState = "offline"
	HeartbeatResponseStatePending HeartbeatResponseState = "pending"
	HeartbeatResponseStateStopped HeartbeatResponseState = "stopped"
)

Defines values for HeartbeatResponseState.

func (HeartbeatResponseState) Valid added in v0.6.2

func (e HeartbeatResponseState) Valid() bool

Valid indicates whether the value is a known member of the HeartbeatResponseState enum.

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type MockAgentsClient

type MockAgentsClient struct {
	SendHeartbeatFunc    func(ctx context.Context, id int64, activity string) (*SendHeartbeatResponse, error)
	UpdateAgentFunc      func(ctx context.Context, id int64, body UpdateAgentJSONRequestBody) (*UpdateAgentResponse, error)
	SubmitBenchmarkFunc  func(ctx context.Context, id int64, body SubmitBenchmarkJSONRequestBody) (*SubmitBenchmarkResponse, error)
	SubmitErrorAgentFunc func(ctx context.Context, id int64, body SubmitErrorAgentJSONRequestBody) (*SubmitErrorAgentResponse, error)
	SetAgentShutdownFunc func(ctx context.Context, id int64) (*SetAgentShutdownResponse, error)
}

MockAgentsClient is a configurable mock for AgentsClient.

func (*MockAgentsClient) SendHeartbeat

func (m *MockAgentsClient) SendHeartbeat(
	ctx context.Context,
	id int64,
	activity string,
) (*SendHeartbeatResponse, error)

SendHeartbeat calls the configured function or returns an error if not configured.

func (*MockAgentsClient) SetAgentShutdown

func (m *MockAgentsClient) SetAgentShutdown(
	ctx context.Context,
	id int64,
) (*SetAgentShutdownResponse, error)

SetAgentShutdown calls the configured function or returns an error if not configured.

func (*MockAgentsClient) SubmitBenchmark

SubmitBenchmark calls the configured function or returns an error if not configured.

func (*MockAgentsClient) SubmitErrorAgent

SubmitErrorAgent calls the configured function or returns an error if not configured.

func (*MockAgentsClient) UpdateAgent

UpdateAgent calls the configured function or returns an error if not configured.

type MockAttacksClient

type MockAttacksClient struct {
	GetAttackFunc   func(ctx context.Context, id int64) (*GetAttackResponse, error)
	GetHashListFunc func(ctx context.Context, id int64) (*GetHashListResponse, error)
}

MockAttacksClient is a configurable mock for AttacksClient.

func (*MockAttacksClient) GetAttack

func (m *MockAttacksClient) GetAttack(ctx context.Context, id int64) (*GetAttackResponse, error)

GetAttack calls the configured function or returns an error if not configured.

func (*MockAttacksClient) GetHashList

func (m *MockAttacksClient) GetHashList(ctx context.Context, id int64) (*GetHashListResponse, error)

GetHashList calls the configured function or returns an error if not configured.

type MockAuthClient

type MockAuthClient struct {
	AuthenticateFunc     func(ctx context.Context) (*AuthenticateResponse, error)
	GetConfigurationFunc func(ctx context.Context) (*GetConfigurationResponse, error)
}

MockAuthClient is a configurable mock for AuthClient.

func (*MockAuthClient) Authenticate

func (m *MockAuthClient) Authenticate(ctx context.Context) (*AuthenticateResponse, error)

Authenticate calls the configured function or returns an error if not configured.

func (*MockAuthClient) GetConfiguration

func (m *MockAuthClient) GetConfiguration(ctx context.Context) (*GetConfigurationResponse, error)

GetConfiguration calls the configured function or returns an error if not configured.

type MockClient

type MockClient struct {
	TasksImpl   TasksClient
	AttacksImpl AttacksClient
	AgentsImpl  AgentsClient
	AuthImpl    AuthClient
}

MockClient is a test double for the APIClient interface. Each subsystem client can be configured independently.

func (*MockClient) Agents

func (m *MockClient) Agents() AgentsClient

Agents returns the configured AgentsClient, or an unconfigured mock that returns descriptive errors.

func (*MockClient) Attacks

func (m *MockClient) Attacks() AttacksClient

Attacks returns the configured AttacksClient, or an unconfigured mock that returns descriptive errors.

func (*MockClient) Auth

func (m *MockClient) Auth() AuthClient

Auth returns the configured AuthClient, or an unconfigured mock that returns descriptive errors.

func (*MockClient) Tasks

func (m *MockClient) Tasks() TasksClient

Tasks returns the configured TasksClient, or an unconfigured mock that returns descriptive errors.

type MockTasksClient

type MockTasksClient struct {
	GetNewTaskFunc       func(ctx context.Context) (*GetNewTaskResponse, error)
	SetTaskAcceptedFunc  func(ctx context.Context, id int64) (*SetTaskAcceptedResponse, error)
	SetTaskExhaustedFunc func(ctx context.Context, id int64) (*SetTaskExhaustedResponse, error)
	SetTaskAbandonedFunc func(ctx context.Context, id int64) (*SetTaskAbandonedResponse, error)
	SendStatusFunc       func(ctx context.Context, id int64, status HashcatStatusUpdate) (*SendStatusResponse, error)
	SendCrackFunc        func(ctx context.Context, id int64, result HashcatResult) (*SendCrackResponse, error)
	GetTaskZapsFunc      func(ctx context.Context, id int64) (*GetTaskZapsResponse, error)
}

MockTasksClient is a configurable mock for TasksClient. Set the function fields to control mock behavior.

func (*MockTasksClient) GetNewTask

func (m *MockTasksClient) GetNewTask(ctx context.Context) (*GetNewTaskResponse, error)

GetNewTask calls the configured function or returns an error if not configured.

func (*MockTasksClient) GetTaskZaps

func (m *MockTasksClient) GetTaskZaps(ctx context.Context, id int64) (*GetTaskZapsResponse, error)

GetTaskZaps calls the configured function or returns an error if not configured.

func (*MockTasksClient) SendCrack

func (m *MockTasksClient) SendCrack(
	ctx context.Context,
	id int64,
	result HashcatResult,
) (*SendCrackResponse, error)

SendCrack calls the configured function or returns an error if not configured.

func (*MockTasksClient) SendStatus

func (m *MockTasksClient) SendStatus(
	ctx context.Context,
	id int64,
	status HashcatStatusUpdate,
) (*SendStatusResponse, error)

SendStatus calls the configured function or returns an error if not configured.

func (*MockTasksClient) SetTaskAbandoned

func (m *MockTasksClient) SetTaskAbandoned(
	ctx context.Context,
	id int64,
) (*SetTaskAbandonedResponse, error)

SetTaskAbandoned calls the configured function or returns an error if not configured.

func (*MockTasksClient) SetTaskAccepted

func (m *MockTasksClient) SetTaskAccepted(ctx context.Context, id int64) (*SetTaskAcceptedResponse, error)

SetTaskAccepted calls the configured function or returns an error if not configured.

func (*MockTasksClient) SetTaskExhausted

func (m *MockTasksClient) SetTaskExhausted(
	ctx context.Context,
	id int64,
) (*SetTaskExhaustedResponse, error)

SetTaskExhausted calls the configured function or returns an error if not configured.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type RetryTransport added in v0.6.2

type RetryTransport struct {
	Base         http.RoundTripper // Underlying transport
	MaxAttempts  int               // Total attempts (1 = no retry)
	InitialDelay time.Duration     // First retry delay
	MaxDelay     time.Duration     // Cap for exponential backoff
	Logger       *slog.Logger      // Optional structured logger; nil disables logging.
}

RetryTransport wraps an http.RoundTripper with retry logic using exponential backoff with jitter. It retries on network errors, 5xx responses, and 429 Too Many Requests, but not on other 4xx client errors.

func (*RetryTransport) RoundTrip added in v0.6.2

func (t *RetryTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper with retry logic.

type SendCrackJSONRequestBody

type SendCrackJSONRequestBody = HashcatResult

SendCrackJSONRequestBody defines body for SendCrack for application/json ContentType.

type SendCrackResponse

type SendCrackResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *ErrorObject
	JSON404      *ErrorObject
}

func ParseSendCrackResponse

func ParseSendCrackResponse(rsp *http.Response) (*SendCrackResponse, error)

ParseSendCrackResponse parses an HTTP response from a SendCrackWithResponse call

func (SendCrackResponse) Status

func (r SendCrackResponse) Status() string

Status returns HTTPResponse.Status

func (SendCrackResponse) StatusCode

func (r SendCrackResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SendHeartbeatJSONRequestBody

type SendHeartbeatJSONRequestBody = AgentHeartbeatRequest

SendHeartbeatJSONRequestBody defines body for SendHeartbeat for application/json ContentType.

type SendHeartbeatResponse

type SendHeartbeatResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *HeartbeatResponse
	JSON401      *ErrorObject
}

func ParseSendHeartbeatResponse

func ParseSendHeartbeatResponse(rsp *http.Response) (*SendHeartbeatResponse, error)

ParseSendHeartbeatResponse parses an HTTP response from a SendHeartbeatWithResponse call

func (SendHeartbeatResponse) Status

func (r SendHeartbeatResponse) Status() string

Status returns HTTPResponse.Status

func (SendHeartbeatResponse) StatusCode

func (r SendHeartbeatResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SendStatusJSONRequestBody

type SendStatusJSONRequestBody = HashcatStatusUpdate

SendStatusJSONRequestBody defines body for SendStatus for application/json ContentType.

type SendStatusResponse

type SendStatusResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *ErrorObject
	JSON422      *ErrorObject
}

func ParseSendStatusResponse

func ParseSendStatusResponse(rsp *http.Response) (*SendStatusResponse, error)

ParseSendStatusResponse parses an HTTP response from a SendStatusWithResponse call

func (SendStatusResponse) Status

func (r SendStatusResponse) Status() string

Status returns HTTPResponse.Status

func (SendStatusResponse) StatusCode

func (r SendStatusResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SetAgentShutdownResponse

type SetAgentShutdownResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *ErrorObject
}

func ParseSetAgentShutdownResponse

func ParseSetAgentShutdownResponse(rsp *http.Response) (*SetAgentShutdownResponse, error)

ParseSetAgentShutdownResponse parses an HTTP response from a SetAgentShutdownWithResponse call

func (SetAgentShutdownResponse) Status

func (r SetAgentShutdownResponse) Status() string

Status returns HTTPResponse.Status

func (SetAgentShutdownResponse) StatusCode

func (r SetAgentShutdownResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SetTaskAbandonedError

type SetTaskAbandonedError struct {
	Details []string `json:"details"`
	Error_  *string  `json:"error"` //nolint:revive // underscore avoids collision with Error() method
}

SetTaskAbandonedError represents a 422 error when abandoning a task. It maps to the 422 response schema for the SetTaskAbandoned endpoint.

func (*SetTaskAbandonedError) Error

func (e *SetTaskAbandonedError) Error() string

Error returns a JSON representation of the error. Falls back to a descriptive string if JSON marshaling fails.

type SetTaskAbandonedResponse

type SetTaskAbandonedResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *TaskAbandonResponse
	JSON401      *ErrorObject
	JSON404      *ErrorObject
	JSON422      *TaskAbandonError
}

func ParseSetTaskAbandonedResponse

func ParseSetTaskAbandonedResponse(rsp *http.Response) (*SetTaskAbandonedResponse, error)

ParseSetTaskAbandonedResponse parses an HTTP response from a SetTaskAbandonedWithResponse call

func (SetTaskAbandonedResponse) Status

func (r SetTaskAbandonedResponse) Status() string

Status returns HTTPResponse.Status

func (SetTaskAbandonedResponse) StatusCode

func (r SetTaskAbandonedResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SetTaskAcceptedResponse

type SetTaskAcceptedResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *ErrorObject
	JSON404      *ErrorObject
	JSON422      *ErrorObject
}

func ParseSetTaskAcceptedResponse

func ParseSetTaskAcceptedResponse(rsp *http.Response) (*SetTaskAcceptedResponse, error)

ParseSetTaskAcceptedResponse parses an HTTP response from a SetTaskAcceptedWithResponse call

func (SetTaskAcceptedResponse) Status

func (r SetTaskAcceptedResponse) Status() string

Status returns HTTPResponse.Status

func (SetTaskAcceptedResponse) StatusCode

func (r SetTaskAcceptedResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SetTaskExhaustedResponse

type SetTaskExhaustedResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *ErrorObject
	JSON404      *ErrorObject
}

func ParseSetTaskExhaustedResponse

func ParseSetTaskExhaustedResponse(rsp *http.Response) (*SetTaskExhaustedResponse, error)

ParseSetTaskExhaustedResponse parses an HTTP response from a SetTaskExhaustedWithResponse call

func (SetTaskExhaustedResponse) Status

func (r SetTaskExhaustedResponse) Status() string

Status returns HTTPResponse.Status

func (SetTaskExhaustedResponse) StatusCode

func (r SetTaskExhaustedResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Severity

type Severity = SubmitErrorRequestSeverity

Severity is a type alias for the generated SubmitErrorRequestSeverity. This provides named constants for error severity levels.

const (
	SeverityCritical Severity = Critical
	SeverityWarning  Severity = Warning
	SeverityInfo     Severity = Info
	SeverityMajor    Severity = Major
	SeverityMinor    Severity = Minor
	SeverityFatal    Severity = Fatal
)

Severity levels for error reporting.

type State added in v0.6.2

type State = HeartbeatResponseState

State is a type alias for the generated HeartbeatResponseState. This provides short named constants for heartbeat state values.

const (
	// StateActive indicates the agent is ready to accept tasks.
	StateActive State = "active"
	// StateError indicates the agent has encountered an error.
	StateError State = "error"
	// StateOffline indicates the agent has not checked in recently.
	StateOffline State = "offline"
	// StatePending indicates the agent needs to perform setup again.
	StatePending State = "pending"
	// StateStopped indicates the agent has been stopped by the user.
	StateStopped State = "stopped"
)

State constants for heartbeat response state values.

type SubmitBenchmarkJSONRequestBody

type SubmitBenchmarkJSONRequestBody = SubmitBenchmarkRequest

SubmitBenchmarkJSONRequestBody defines body for SubmitBenchmark for application/json ContentType.

type SubmitBenchmarkRequest added in v0.6.2

type SubmitBenchmarkRequest struct {
	HashcatBenchmarks []HashcatBenchmark `json:"hashcat_benchmarks"`
}

SubmitBenchmarkRequest Hashcat benchmark results submitted by an agent

type SubmitBenchmarkResponse

type SubmitBenchmarkResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *BenchmarkReceipt
	JSON400      *ErrorObject
	JSON401      *ErrorObject
	JSON422      *ErrorObject
}

func ParseSubmitBenchmarkResponse

func ParseSubmitBenchmarkResponse(rsp *http.Response) (*SubmitBenchmarkResponse, error)

ParseSubmitBenchmarkResponse parses an HTTP response from a SubmitBenchmarkWithResponse call

func (SubmitBenchmarkResponse) Status

func (r SubmitBenchmarkResponse) Status() string

Status returns HTTPResponse.Status

func (SubmitBenchmarkResponse) StatusCode

func (r SubmitBenchmarkResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SubmitErrorAgentJSONRequestBody

type SubmitErrorAgentJSONRequestBody = SubmitErrorRequest

SubmitErrorAgentJSONRequestBody defines body for SubmitErrorAgent for application/json ContentType.

type SubmitErrorAgentResponse

type SubmitErrorAgentResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON401      *ErrorObject
}

func ParseSubmitErrorAgentResponse

func ParseSubmitErrorAgentResponse(rsp *http.Response) (*SubmitErrorAgentResponse, error)

ParseSubmitErrorAgentResponse parses an HTTP response from a SubmitErrorAgentWithResponse call

func (SubmitErrorAgentResponse) Status

func (r SubmitErrorAgentResponse) Status() string

Status returns HTTPResponse.Status

func (SubmitErrorAgentResponse) StatusCode

func (r SubmitErrorAgentResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type SubmitErrorRequest added in v0.6.2

type SubmitErrorRequest struct {
	// AgentId The agent that caused the error
	AgentId int64 `json:"agent_id"`

	// Message The error message
	Message string `json:"message"`

	// Metadata Additional metadata about an agent error
	Metadata *ErrorMetadata `json:"metadata,omitempty"`

	// Severity The severity of the error:
	//                        * `info` - Informational message, no action required.
	//                        * `warning` - Non-critical error, no action required. Anticipated, but not necessarily problematic.
	//                        * `minor` - Minor error, no action required. Should be investigated, but the task can continue.
	//                        * `major` - Major error, action required. The task should be investigated and possibly restarted.
	//                        * `critical` - Critical error, action required. The task should be stopped and investigated.
	//                         * `fatal` - Fatal error, action required. The agent cannot continue with the task and should not be reattempted.
	Severity SubmitErrorRequestSeverity `json:"severity"`

	// TaskId The task that caused the error, if any
	TaskId *int64 `json:"task_id,omitempty"`
}

SubmitErrorRequest Error details reported by the agent

type SubmitErrorRequestSeverity added in v0.6.2

type SubmitErrorRequestSeverity string

SubmitErrorRequestSeverity The severity of the error:

  • `info` - Informational message, no action required.
  • `warning` - Non-critical error, no action required. Anticipated, but not necessarily problematic.
  • `minor` - Minor error, no action required. Should be investigated, but the task can continue.
  • `major` - Major error, action required. The task should be investigated and possibly restarted.
  • `critical` - Critical error, action required. The task should be stopped and investigated.
  • `fatal` - Fatal error, action required. The agent cannot continue with the task and should not be reattempted.
const (
	Critical SubmitErrorRequestSeverity = "critical"
	Fatal    SubmitErrorRequestSeverity = "fatal"
	Info     SubmitErrorRequestSeverity = "info"
	Major    SubmitErrorRequestSeverity = "major"
	Minor    SubmitErrorRequestSeverity = "minor"
	Warning  SubmitErrorRequestSeverity = "warning"
)

Defines values for SubmitErrorRequestSeverity.

func (SubmitErrorRequestSeverity) Valid added in v0.6.2

func (e SubmitErrorRequestSeverity) Valid() bool

Valid indicates whether the value is a known member of the SubmitErrorRequestSeverity enum.

type Task

type Task struct {
	// AttackId The id of the attack
	AttackId int64 `json:"attack_id"`

	// Id The id of the task
	Id int64 `json:"id"`

	// Limit The limit of the keyspace
	Limit *int64 `json:"limit,omitempty"`

	// Skip The offset of the keyspace
	Skip *int64 `json:"skip,omitempty"`

	// StartDate The time the task was started
	StartDate time.Time `json:"start_date"`

	// Status The status of the task
	Status TaskStatus `json:"status"`
}

Task A unit of work assigned to an agent for a specific attack

type TaskAbandonError added in v0.6.2

type TaskAbandonError struct {
	Details *[]string `json:"details,omitempty"`
	Error   *string   `json:"error,omitempty"`
}

TaskAbandonError Error response when a task cannot be abandoned

type TaskAbandonResponse added in v0.6.2

type TaskAbandonResponse struct {
	State   *string `json:"state,omitempty"`
	Success *bool   `json:"success,omitempty"`
}

TaskAbandonResponse The response to a successful task abandon request

type TaskStatus

type TaskStatus string

TaskStatus The status of the task

const (
	Abandoned TaskStatus = "abandoned"
	Completed TaskStatus = "completed"
	Exhausted TaskStatus = "exhausted"
	Failed    TaskStatus = "failed"
	Paused    TaskStatus = "paused"
	Pending   TaskStatus = "pending"
	Running   TaskStatus = "running"
)

Defines values for TaskStatus.

func (TaskStatus) Valid added in v0.6.2

func (e TaskStatus) Valid() bool

Valid indicates whether the value is a known member of the TaskStatus enum.

type TasksClient

type TasksClient interface {
	// GetNewTask retrieves a new task from the server.
	GetNewTask(ctx context.Context) (*GetNewTaskResponse, error)

	// SetTaskAccepted marks a task as accepted.
	SetTaskAccepted(ctx context.Context, id int64) (*SetTaskAcceptedResponse, error)

	// SetTaskExhausted marks a task as exhausted (keyspace fully searched).
	SetTaskExhausted(ctx context.Context, id int64) (*SetTaskExhaustedResponse, error)

	// SetTaskAbandoned marks a task as abandoned.
	SetTaskAbandoned(ctx context.Context, id int64) (*SetTaskAbandonedResponse, error)

	// SendStatus sends a status update for a running task.
	SendStatus(ctx context.Context, id int64, status HashcatStatusUpdate) (*SendStatusResponse, error)

	// SendCrack sends a cracked hash result.
	SendCrack(ctx context.Context, id int64, result HashcatResult) (*SendCrackResponse, error)

	// GetTaskZaps retrieves previously cracked hashes for a task.
	GetTaskZaps(ctx context.Context, id int64) (*GetTaskZapsResponse, error)
}

TasksClient defines the interface for task-related API operations. This enables mocking in tests and decouples code from the concrete API client implementation.

type TransportConfig added in v0.6.2

type TransportConfig struct {
	ConnectTimeout time.Duration // TCP dial timeout
	ReadTimeout    time.Duration // TLS handshake + response header timeout
	RequestTimeout time.Duration // Overall per-request timeout on http.Client

	MaxAttempts       int           // Total attempts (1 = no retry)
	RetryInitialDelay time.Duration // First retry backoff delay
	RetryMaxDelay     time.Duration // Cap for exponential backoff

	CircuitBreakerFailureThreshold int           // Consecutive failures before opening
	CircuitBreakerTimeout          time.Duration // Duration before half-open probe

	Logger *slog.Logger // Optional; nil disables transport logging

	// BaseTransport overrides the default http.Transport when set.
	// Used by tests to inject httpmock's transport into the chain.
	BaseTransport http.RoundTripper

	// CircuitBreaker reuses an existing circuit breaker when set.
	// This preserves failure history across client rebuilds (e.g., after server config reload).
	// When nil, a new circuit breaker is created.
	CircuitBreaker *CircuitBreaker
}

TransportConfig holds all configuration for the HTTP transport chain.

type UpdateAgentJSONRequestBody

type UpdateAgentJSONRequestBody = UpdateAgentRequest

UpdateAgentJSONRequestBody defines body for UpdateAgent for application/json ContentType.

type UpdateAgentRequest added in v0.6.2

type UpdateAgentRequest struct {
	// ClientSignature The signature of the client
	ClientSignature string   `json:"client_signature"`
	Devices         []string `json:"devices"`

	// HostName The hostname of the agent
	HostName string `json:"host_name"`

	// Id The id of the agent
	Id int64 `json:"id"`

	// OperatingSystem The operating system of the agent
	OperatingSystem string `json:"operating_system"`
}

UpdateAgentRequest Agent system information submitted on registration or update

type UpdateAgentResponse

type UpdateAgentResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Agent
	JSON401      *ErrorObject
}

func ParseUpdateAgentResponse

func ParseUpdateAgentResponse(rsp *http.Response) (*UpdateAgentResponse, error)

ParseUpdateAgentResponse parses an HTTP response from a UpdateAgentWithResponse call

func (UpdateAgentResponse) Status

func (r UpdateAgentResponse) Status() string

Status returns HTTPResponse.Status

func (UpdateAgentResponse) StatusCode

func (r UpdateAgentResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

Jump to

Keyboard shortcuts

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