()
| 16 | } |
| 17 | |
| 18 | func newRootCmd() *cobra.Command { |
| 19 | g := &globalFlags{} |
| 20 | |
| 21 | root := &cobra.Command{ |
| 22 | Use: "snix", |
| 23 | Short: "Cross-platform SNI-spoofing DPI-bypass proxy", |
| 24 | Long: "snix spoofs the TLS ClientHello SNI during the TCP handshake to bypass DPI-based censorship.\nIt is a Go rewrite of patterniha/SNI-Spoofing with multi-profile, TUI, and cross-platform support.", |
| 25 | Version: version, |
| 26 | SilenceUsage: true, |
| 27 | SilenceErrors: true, |
| 28 | } |
| 29 | root.PersistentFlags().StringVarP(&g.configPath, "config", "c", defaultConfigPath(), "config file path") |
| 30 | root.PersistentFlags().BoolVarP(&g.verbose, "verbose", "v", false, "verbose logging") |
| 31 | |
| 32 | root.AddCommand( |
| 33 | newStartCmd(g), |
| 34 | newStatusCmd(g), |
| 35 | newProfileCmd(g), |
| 36 | newScanRootCmd(g), |
| 37 | newInitCmd(g), |
| 38 | newTUICmd(g), |
| 39 | newUpdateCmd(g), |
| 40 | ) |
| 41 | return root |
| 42 | } |
| 43 | |
| 44 | func defaultConfigPath() string { |
| 45 | // Follows XDG on Linux/macOS, %APPDATA% on Windows. |
no test coverage detected