mirror of
https://github.com/Gouryella/drip.git
synced 2026-04-28 13:20:36 +00:00
feat(client): Added the --short option to the version command to support plain text output.
Added the `--short` flag to the `version` command for printing version information without styles. In this mode, only the version, Git commit hash, and build time in plain text format will be output, facilitating script parsing. Optimized Windows process detection logic to improve runtime accuracy. Removed redundant comments and simplified signal checking methods, making the code clearer and easier to maintain. refactor(protocol): Replaced string matching of data frame types with enumeration types. Unified the representation of data frame types in the protocol, using the `DataType` enumeration to improve performance and readability. Introduced a pooled buffer mechanism to improve memory efficiency in high-load scenarios. refactor(ui): Adjusted style definitions, removing hard-coded color values. Removed fixed color settings from some lipgloss styles, providing flexibility for future theme customization. ``` docs(install): Improved the version extraction function in the installation script. Added the `get_version_from_binary` function to enhance version identification capabilities, prioritizing plain mode output, ensuring accurate version number acquisition for the drip client or server across different terminal environments. perf(tcp): Improved TCP processing performance and connection management capabilities. Adjusted HTTP client transmission parameter configuration, increasing the maximum number of idle connections to accommodate higher concurrent requests. Improved error handling logic, adding special checks for common cases such as closing network connections to avoid log pollution. chore(writer): Expanded the FrameWriter queue length to improve batch write stability. Increased the FrameWriter queue size from 1024 to 2048, and released pooled resources after flushing, better handling sudden traffic spikes and reducing memory usage fluctuations.
This commit is contained in:
@@ -17,14 +17,8 @@ func getSysProcAttr() *syscall.SysProcAttr {
|
||||
|
||||
// isProcessRunningOS checks if a process is running using OS-specific method
|
||||
func isProcessRunningOS(process *os.Process) bool {
|
||||
// On Windows, we try to open the process to check if it exists
|
||||
// FindProcess doesn't actually check if process exists on Windows
|
||||
// We can try to send signal, but Windows doesn't support signal 0
|
||||
// Instead, we'll try to kill with signal 0 which returns an error if process doesn't exist
|
||||
err := process.Signal(os.Signal(syscall.Signal(0)))
|
||||
if err != nil {
|
||||
// Try alternative: check if we can get process info
|
||||
// If the process doesn't exist, Signal will fail
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
||||
@@ -9,9 +9,10 @@ import (
|
||||
|
||||
var (
|
||||
// Version information
|
||||
Version = "dev"
|
||||
GitCommit = "unknown"
|
||||
BuildTime = "unknown"
|
||||
Version = "dev"
|
||||
GitCommit = "unknown"
|
||||
BuildTime = "unknown"
|
||||
versionPlain bool
|
||||
|
||||
// Global flags
|
||||
serverURL string
|
||||
@@ -51,6 +52,8 @@ func init() {
|
||||
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Verbose output")
|
||||
rootCmd.PersistentFlags().BoolVarP(&insecure, "insecure", "k", false, "Skip TLS verification (testing only, NOT recommended)")
|
||||
|
||||
versionCmd.Flags().BoolVar(&versionPlain, "short", false, "Print version information without styling")
|
||||
|
||||
rootCmd.AddCommand(versionCmd)
|
||||
// http and tcp commands are added in their respective init() functions
|
||||
// config command is added in config.go init() function
|
||||
@@ -60,6 +63,11 @@ var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print version information",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if versionPlain {
|
||||
fmt.Printf("Version: %s\nGit Commit: %s\nBuild Time: %s\n", Version, GitCommit, BuildTime)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(ui.Info(
|
||||
"Drip Client",
|
||||
"",
|
||||
|
||||
@@ -23,7 +23,6 @@ var (
|
||||
// Box styles - Vercel-like clean box
|
||||
boxStyle = lipgloss.NewStyle().
|
||||
Border(lipgloss.RoundedBorder()).
|
||||
BorderForeground(lipgloss.Color("#333")).
|
||||
Padding(1, 2).
|
||||
MarginTop(1).
|
||||
MarginBottom(1)
|
||||
@@ -39,8 +38,7 @@ var (
|
||||
|
||||
// Text styles
|
||||
titleStyle = lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
Foreground(lipgloss.Color("#FFF"))
|
||||
Bold(true)
|
||||
|
||||
subtitleStyle = lipgloss.NewStyle().
|
||||
Foreground(mutedColor)
|
||||
|
||||
@@ -60,7 +60,7 @@ func RenderTunnelConnected(status *TunnelStatus) string {
|
||||
urlLine := lipgloss.JoinHorizontal(
|
||||
lipgloss.Left,
|
||||
urlStyle.Copy().Foreground(accent).Render(status.URL),
|
||||
lipgloss.NewStyle().MarginLeft(1).Foreground(mutedColor).Render("(forwarded link)"),
|
||||
lipgloss.NewStyle().MarginLeft(1).Foreground(mutedColor).Render("(forwarded address)"),
|
||||
)
|
||||
|
||||
forwardLine := lipgloss.NewStyle().
|
||||
|
||||
Reference in New Issue
Block a user