2024-01-04 16:28:16 +07:00
|
|
|
/*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
* Copyright (c) 2022-2024, daeuniverse Organization <dae@v2raya.org>
|
|
|
|
*/
|
|
|
|
|
2023-01-27 01:10:27 +07:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
2023-11-15 13:58:52 +07:00
|
|
|
"fmt"
|
|
|
|
"runtime"
|
|
|
|
"strings"
|
|
|
|
|
2023-07-23 22:52:27 +07:00
|
|
|
"github.com/daeuniverse/dae/config"
|
2023-01-27 01:10:27 +07:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
2023-11-14 15:26:33 +07:00
|
|
|
const (
|
|
|
|
AbortFile = "/var/run/dae.abort"
|
|
|
|
)
|
|
|
|
|
2023-01-27 01:10:27 +07:00
|
|
|
var (
|
|
|
|
Version = "unknown"
|
|
|
|
rootCmd = &cobra.Command{
|
|
|
|
Use: "dae [flags] [command [argument ...]]",
|
2023-03-03 15:36:22 +07:00
|
|
|
Short: "dae is a high-performance transparent proxy solution.",
|
|
|
|
Long: `dae is a high-performance transparent proxy solution.`,
|
2023-01-27 01:10:27 +07:00
|
|
|
Version: Version,
|
2023-01-28 01:01:33 +07:00
|
|
|
CompletionOptions: cobra.CompletionOptions{
|
|
|
|
DisableDefaultCmd: true,
|
|
|
|
},
|
2023-01-27 01:10:27 +07:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2023-07-23 22:52:27 +07:00
|
|
|
func init() {
|
|
|
|
config.Version = Version
|
2023-11-15 13:58:52 +07:00
|
|
|
rootCmd.Version = strings.Join([]string{
|
|
|
|
Version,
|
|
|
|
fmt.Sprintf("go runtime %v %v/%v", runtime.Version(), runtime.GOOS, runtime.GOARCH),
|
2024-01-22 17:46:42 +07:00
|
|
|
"Copyright (c) 2022-2024 @daeuniverse",
|
2023-11-15 13:58:52 +07:00
|
|
|
"License GNU AGPLv3 <https://github.com/daeuniverse/dae/blob/main/LICENSE>",
|
|
|
|
}, "\n")
|
2023-07-23 22:52:27 +07:00
|
|
|
}
|
|
|
|
|
2023-01-27 01:10:27 +07:00
|
|
|
// Execute executes the root command.
|
|
|
|
func Execute() error {
|
|
|
|
return rootCmd.Execute()
|
|
|
|
}
|