kloudlite / kl

Kloudlite CLI Client
GNU Affero General Public License v3.0
5 stars 1 forks source link

connect command will wait until wireguard is connected #167

Closed nxtcoder36 closed 2 weeks ago

nxtcoder36 commented 2 weeks ago

Summary by Sourcery

Enhance the connect command to wait for WireGuard connection establishment by checking the online status. Improve the restart process of the WireGuard proxy container and enhance logging. Update several dependencies in the project.

New Features:

Enhancements:

Chores:

sourcery-ai[bot] commented 2 weeks ago

Reviewer's Guide by Sourcery

This pull request enhances the 'connect' command to wait until the Wireguard connection is established. It introduces a more robust connection process with error handling, timeout mechanisms, and improved logging. The changes also include updates to dependencies and minor modifications to container management.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Implement a waiting mechanism for Wireguard connection
  • Add a loop to check for 'online' status in a log file
  • Implement a 30-second timeout for connection attempts
  • Add error handling for connection failures
  • Improve logging with a success message upon connection
cmd/connect/connect.go
Enhance error handling and logging in connection process
  • Add defer statements for proper resource cleanup
  • Implement more granular error checking
  • Improve spinner messages for better user feedback
cmd/connect/connect.go
Update dependencies and add new packages
  • Update golang.org/x/crypto and other dependencies
  • Add github.com/prometheus-community/pro-bing package
  • Update various indirect dependencies
go.mod
Modify container management in k3s implementation
  • Update the script for restarting the Wireguard proxy container
  • Modify the grace period for pod deletion to 1 second
pkg/k3s/impl.go
Improve container restart process
  • Add cleanup of /tmp/kl directory before container restart
cmd/box/boxpkg/utils.go

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).