Closed nxtcoder36 closed 2 weeks ago
This pull request implements the 'connect' command and makes several improvements to the existing codebase. The changes focus on enhancing the restart functionality, improving the status command, and adding new features to the K3s client.
sequenceDiagram
participant User
participant Client
participant CLI
participant Container
User->>Client: Initiate restartBoxContainer
Client->>CLI: ContainerList with filters
alt Containers exist
Client->>User: Confirm restart
User->>Client: Confirm (Y/n)
alt User cancels
Client->>User: Return UserCanceled error
end
end
loop For each container
Client->>Container: ContainerStop
Container-->>Client: Stop response
Client->>Container: ContainerRemove
Container-->>Client: Remove response
end
Client->>CLI: Start
CLI-->>Client: Start response
Client-->>User: Return success or error
sequenceDiagram
participant User
participant ConnectCommand
participant K3sClient
User->>ConnectCommand: Execute startWg
ConnectCommand->>K3sClient: NewClient
alt Error in NewClient
ConnectCommand-->>User: Return error
end
ConnectCommand->>ConnectCommand: ExecNoOutput("wg-quick down kl-workspace-wg")
alt Error in ExecNoOutput
ConnectCommand-->>User: Return error
end
ConnectCommand->>ConnectCommand: ExecNoOutput("wg-quick up kl-workspace-wg")
alt Error in ExecNoOutput
ConnectCommand-->>User: Return error
end
ConnectCommand->>K3sClient: RestartWgProxyContainer
K3sClient-->>ConnectCommand: Return success or error
ConnectCommand-->>User: Return success or error
classDiagram
class functions {
+Exec(cmdString string, env map[string]string) ([]byte, error)
+ExecNoOutput(cmdString string) error
}
Change | Details | Files |
---|---|---|
Implemented 'connect' command |
|
cmd/connect/connect.go clis/kl/loadsubs.go |
Enhanced restart functionality |
|
cmd/box/boxpkg/restart.go |
Improved K3s client functionality |
|
pkg/k3s/impl.go pkg/k3s/main.go |
Updated status command |
|
cmd/status/status.go |
Added new utility function |
|
pkg/functions/exec.go |
Updated build configuration |
|
Taskfile.yml |
Adjusted command availability |
|
clis/kl/loadsubs.go cmd/box/klbox.go |
Summary by Sourcery
Introduce a 'connect' command for managing WireGuard connections and refactor container restart logic. Enhance K3s server readiness checks and update the Taskfile to monitor additional file types.
New Features:
Enhancements:
Build: