Closed nxtcoder36 closed 2 weeks ago
This pull request implements several changes to improve the functionality and reliability of the application's intercept service, K3s tracking, and VPN connection. Key modifications include refactoring the StartAppInterceptService function, updating the K3sTracker structure, improving error handling, and enhancing the overall connection status checks.
sequenceDiagram
participant Client
participant Spinner
participant K3sTracker
participant FileClient
participant Container
Client->>Spinner: UpdateMessage("starting intercept service")
Client->>K3sTracker: GetK3sTracker()
K3sTracker-->>Client: k3sTracker
Client->>FileClient: Create newPorts
alt toStart is true
FileClient-->>Client: Error if port is occupied
end
Client->>Container: runScriptInContainer()
sequenceDiagram
participant StartWg
participant K3sClient
participant EnvClient
StartWg->>K3sClient: RestartWgProxyContainer()
alt InsideBox is false
K3sClient-->>StartWg: Return
end
StartWg->>EnvClient: CheckWireguardConnection()
EnvClient-->>StartWg: Connection status
alt Connection is not established
StartWg->>EnvClient: ExecNoOutput("wg-quick down kl-workspace-wg")
StartWg->>EnvClient: ExecNoOutput("wg-quick up kl-workspace-wg")
StartWg->>EnvClient: Check online status
end
StartWg->>StartWg: Log device connected
classDiagram
class k3sTracker {
bool Compute
bool Gateway
DeviceRouter DeviceRouter
string LastCheckedAt
}
class DeviceRouter {
string IP
Service Service
}
class Service {
Spec Spec
}
class Spec {
list~Port~ Ports
}
class Port {
string Name
int Port
string Protocol
int TargetPort
}
k3sTracker --> DeviceRouter
DeviceRouter --> Service
Service --> Spec
Spec --> Port
Change | Details | Files |
---|---|---|
Refactored StartAppInterceptService function to handle port management more efficiently |
|
k3s/impl.go |
Updated K3sTracker structure and related functions |
|
domain/fileclient/context.go k3s/k3s-tracker/main.go |
Enhanced VPN connection and status checking |
|
cmd/connect/connect.go cmd/status/status.go |
Implemented RemoveAllIntercepts function |
|
k3s/impl.go cmd/clone/env.go cmd/use/env.go |
Refactored and improved error handling throughout the codebase |
|
k3s/impl.go domain/apiclient/app.go cmd/intercept/intercept.go |
Summary by Sourcery
Refactor the application intercept service to improve port management and error handling. Enhance the Wireguard connection verification process and update status messages for better user feedback. Fix issues related to k3s server readiness checks.
Bug Fixes:
Enhancements: