增加防探测功能,增加流量加密功能

This commit is contained in:
wenyifan
2022-09-09 15:29:41 +08:00
parent c2ab6cbe5f
commit a064f72104
12 changed files with 185 additions and 79 deletions

View File

@ -4,6 +4,7 @@ import (
"fmt"
"github.com/spf13/cobra"
"os"
"shadowTLS/shadow"
)
var (
@ -15,6 +16,8 @@ var (
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() {
@ -23,3 +26,11 @@ func Execute() {
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
}