From 660b59d8b141df40470ae72e02c4dda98842cb62 Mon Sep 17 00:00:00 2001 From: LouisKamsky Date: Thu, 10 Oct 2024 07:50:36 +0800 Subject: [PATCH] Added support to protocol: 2022-blake3-aes-128-gcm and 2 more. Fixed bug while using xray-core. --- gui/src/components/modalServer.vue | 12 ++++++++++-- service/core/serverObj/shadowsocks.go | 5 ++++- service/pkg/plugin/ss/ss.go | 3 +++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/gui/src/components/modalServer.vue b/gui/src/components/modalServer.vue index 503af0c6..0737fb11 100644 --- a/gui/src/components/modalServer.vue +++ b/gui/src/components/modalServer.vue @@ -34,8 +34,13 @@ + + + + + @@ -183,6 +188,9 @@ + + + @@ -628,7 +636,7 @@ export default { key: "none", }, ss: { - method: "aes-128-gcm", + method: "2022-blake3-aes-128-gcm", plugin: "", obfs: "http", tls: "", @@ -955,7 +963,7 @@ export default { method: "origin", net: u.params.type || "tcp", obfs: "none", - ssCipher: "aes-128-gcm", + ssCipher: "2022-blake3-aes-128-gcm", path: u.params.path || u.params.serviceName || "", protocol: "trojan", }; diff --git a/service/core/serverObj/shadowsocks.go b/service/core/serverObj/shadowsocks.go index aa5b6c3b..ea5c1c0d 100644 --- a/service/core/serverObj/shadowsocks.go +++ b/service/core/serverObj/shadowsocks.go @@ -327,7 +327,7 @@ func (s *Shadowsocks) ConfigurationMT(info PriorInfo) (c Configuration, err erro func (s *Shadowsocks) Configuration(info PriorInfo) (c Configuration, err error) { switch s.Cipher { - case "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "plain", "none": + case "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305", "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "xchacha20-poly1305", "xchacha20-ietf-poly1305", "plain", "none": default: return c, fmt.Errorf("unsupported shadowsocks encryption method: %v", s.Cipher) } @@ -380,6 +380,9 @@ func (s *Shadowsocks) ProtoToShow() string { if ciph == "chacha20-ietf-poly1305" || ciph == "chacha20-poly1305" { ciph = "c20p1305" } + if ciph == "xchacha20-ietf-poly1305" || ciph == "xchacha20-poly1305" { + ciph = "xc20p1305" + } if s.Plugin.Name != "" { return fmt.Sprintf("SS(%v+%v)", ciph, s.Plugin.Name) } diff --git a/service/pkg/plugin/ss/ss.go b/service/pkg/plugin/ss/ss.go index ac891ed7..b97c79e1 100644 --- a/service/pkg/plugin/ss/ss.go +++ b/service/pkg/plugin/ss/ss.go @@ -34,6 +34,9 @@ func NewShadowsocks(s string, d plugin.Dialer) (*Shadowsocks, error) { if method == "chacha20-poly1305" { method = "chacha20-ietf-poly1305" } + if method == "xchacha20-poly1305" { + method = "xchacha20-ietf-poly1305" + } cipher, err := ss.PickCipher(method, nil, pass) if err != nil { return nil, fmt.Errorf("NewShadowsocks: %w", err)