Skip to content

Refactor client code for improved structure and performance#146

Merged
akiidjk merged 6 commits intorefactor/configfrom
feature/giovanni_client
Mar 30, 2026
Merged

Refactor client code for improved structure and performance#146
akiidjk merged 6 commits intorefactor/configfrom
feature/giovanni_client

Conversation

@giovanni-iannaccone
Copy link
Copy Markdown
Member

Refactor and Modularize Core Components, Improve Config, Exploit, and CLI Handling

This PR introduces a significant refactoring and modularization of the project, with the following key improvements:

1. Previous State of the Client

  • The client code was deeply nested and tightly coupled.
  • The configuration module was managing unrelated responsibilities, including ExploitArgs.
  • Function and variable names were often unclear, making the code hard to follow.
  • Many functions were very large and contained nested logic that passed data through multiple layers.
  • Overall, this structure made the code difficult to maintain, extend, and debug.

2. Configuration Management

  • Decoupled configuration handling from other responsibilities.
  • Config module now strictly handles reading and parsing configuration files.
  • Configurations are loaded at startup and accessed throughout the program via a singleton.

3. Exploit Module

  • Improved exploit handling by introducing a dedicated structure for managing exploits.
  • Created a new module for exploit templates to standardize and simplify template management.

4. Process Handling

  • Extracted a separate module to handle process-related operations, improving code separation and maintainability.

5. API and HTTP Utilities

  • Refactored API code by extracting reusable HTTP utility functions.
  • Simplifies API calls and reduces duplicated logic.

6. CLI Parameter Handling

  • Enhanced the command-line parameter management module for more robust parsing and validation by adopting a builder-like pattern.

7. Future Improvements

It is important to note that the entire codebase still requires several improvements:

  • Further code cleanup and refactoring to make the overall flow easier to follow.
  • Reduce the weight of certain variables by replacing them with iota (enums) where appropriate.
  • Break down large functions into smaller, more focused ones.
  • Extract additional micro-modules to improve modularity and separation of concerns.

Summary

Overall, this refactoring improves code readability, maintainability, and modularity, while ensuring that configurations, exploits, processes, APIs, and CLI handling are properly separated and easier to extend in the future. Future refactors as outlined above will further enhance the code structure and developer experience.

@akiidjk akiidjk added enhancement New feature or request Clean Code Clean THIS! go Pull requests that update go code labels Mar 29, 2026
akiidjk added 2 commits March 29, 2026 21:21
Remove legacy client config manager and split client into
internal and pkg modules. Update go.work to include internal
packages and client/pkg/config. Clean up imports, whitespace and
tidy go.mod/go.sum dependencies.
@akiidjk akiidjk changed the base branch from dev to refactor/config March 30, 2026 09:25
Copy link
Copy Markdown
Collaborator

@akiidjk akiidjk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🦖

@akiidjk akiidjk merged commit c11e46c into refactor/config Mar 30, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Clean Code Clean THIS! enhancement New feature or request go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants