mirror of
https://github.com/p4gefau1t/trojan-go.git
synced 2024-04-21 12:21:34 +00:00
share_link.go: improve standard coherence
- we now support "none" encryption - tested with 100% code coverage
This commit is contained in:
+4
-4
@@ -19,7 +19,8 @@ var validTypes = map[string]struct{}{
|
||||
}
|
||||
|
||||
var validEncryptionProviders = map[string]struct{}{
|
||||
"ss": {},
|
||||
"ss": {},
|
||||
"none": {},
|
||||
}
|
||||
|
||||
var validSSEncryptionMap = map[string]struct{}{
|
||||
@@ -179,9 +180,8 @@ func NewShareInfoFromURL(shareLink string) (info ShareInfo, e error) {
|
||||
e = errors.New("ss password cannot be empty")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
e = errors.New(fmt.Sprintf("encryption param %s is not supported", info.Encryption))
|
||||
return
|
||||
} else if encryptionProviderName == "none" {
|
||||
// no encryption. do nothing.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -219,6 +219,11 @@ func TestNewShareInfoFromURL_Encryption_Unknown(t *testing.T) {
|
||||
assert.Error(t, e, "unknown encryption should not be supported")
|
||||
}
|
||||
|
||||
func TestNewShareInfoFromURL_Encryption_None(t *testing.T) {
|
||||
_, e := NewShareInfoFromURL("trojan-go://what@ever.me?encryption=none")
|
||||
assert.Nil(t, e, "should support none encryption")
|
||||
}
|
||||
|
||||
func TestNewShareInfoFromURL_Encryption_SS_NotSupportedMethods(t *testing.T) {
|
||||
invalidMethods := []string{"rc4-md5", "rc4", "des-cfb", "table", "salsa20-ctr"}
|
||||
for _, invalidMethod := range invalidMethods {
|
||||
|
||||
Reference in New Issue
Block a user