forked from lilendian0x00/xray-knife
-
Notifications
You must be signed in to change notification settings - Fork 0
/
root.go
48 lines (42 loc) · 1.26 KB
/
root.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package cmd
import (
"github.com/reenigneserever/xray-knife/cmd/net"
"github.com/reenigneserever/xray-knife/cmd/parse"
"github.com/reenigneserever/xray-knife/cmd/proxy"
"github.com/reenigneserever/xray-knife/cmd/scan"
"github.com/reenigneserever/xray-knife/cmd/subs"
"github.com/spf13/cobra"
"os"
)
// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "xray-knife",
Short: "Swiss Army Knife for xray-core",
Long: ``,
Version: "2.8.16",
// Main Tools:
//1. parse: Parses xray config link.
//2. net: Multiple network tests for xray configs.
//3. bot: A service to automatically switch outbound connections from a subscription or a file of configs.
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
},
}
// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
err := rootCmd.Execute()
if err != nil {
os.Exit(1)
}
}
func addSubcommandPalettes() {
rootCmd.AddCommand(parse.ParseCmd)
rootCmd.AddCommand(subs.SubsCmd)
rootCmd.AddCommand(net.NetCmd)
rootCmd.AddCommand(scan.ScanCmd)
rootCmd.AddCommand(proxy.ProxyCmd)
}
func init() {
addSubcommandPalettes()
}