package cmd import ( "fmt" "github.com/spf13/cobra" "os" "shadowTLS/shadow" ) var ( rootCmd = &cobra.Command{ Use: "shadowTLS", Short: "Pack TCP connection and perform real TLS handshake to confuse firewall", } ) func init() { rootCmd.CompletionOptions.DisableDefaultCmd = true rootCmd.PersistentFlags().StringVarP(&shadow.HandshakePassword, "password", "p", "", "Password for probe resist.Probe resist will be disabled if password is empty.") rootCmd.PersistentFlags().StringVarP(&shadow.Key, "key", "k", "", "Encryption key for AES-CBC.Encryption will be enabled if key is set.Length of key must be 16,24 or 32.") } func Execute() { if err := rootCmd.Execute(); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } } func verifyAndParseEncryptionKey() bool { if shadow.Key != "" && len(shadow.Key) != 16 && len(shadow.Key) != 24 && len(shadow.Key) != 32 { return false } shadow.EncryptKey = []byte(shadow.Key) return true }