Skip to content

refactor: unify core execution flow and rename Manage methods to Run for consistency#24

Merged
1 commit merged into
mainfrom
unknown repository
May 23, 2025
Merged

refactor: unify core execution flow and rename Manage methods to Run for consistency#24
1 commit merged into
mainfrom
unknown repository

Conversation

@ghost

@ghost ghost commented May 23, 2025

Copy link
Copy Markdown

This pull request refactors the core dispatch mechanism and unifies the lifecycle management of different modes (server, client, master) by introducing a common Run interface. It also includes minor structural adjustments to improve code maintainability and consistency.

Refactoring and Unification of Lifecycle Management:

  • Replaced the coreDispatch function's mode-specific methods (runServer, runClient, runMaster) with a unified approach using a Run interface. The Run method is now implemented for Server, Client, and Master classes, consolidating lifecycle management. (cmd/nodepass/core.go, cmd/nodepass/core.goL14-R31)
  • Renamed the Manage method to Run in Client, Server, and Master to align with the new unified interface. (internal/client.go, [1]; internal/server.go, [2]; internal/master.go, [3]

Structural and Functional Enhancements:

  • Added a tunnelListener field to the Common struct for managing tunnel listeners, and updated the stop method to ensure proper closure of this resource. (internal/common.go, [1] [2]
  • Removed the redundant tunnelListener field from the Server struct, as it is now managed centrally in the Common struct. (internal/server.go, internal/server.goL22)

@ghost ghost merged commit a1aa53b into NodePassProject:main May 23, 2025
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants