feat(shadowsocks): implement support for SIP022 AEAD-2022 ciphers
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package singbox
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/perfect-panel/server/pkg/adapter/proxy"
|
||||
)
|
||||
|
||||
@@ -14,7 +17,15 @@ type ShadowsocksOptions struct {
|
||||
}
|
||||
|
||||
func ParseShadowsocks(data proxy.Proxy, uuid string) (*Proxy, error) {
|
||||
config := data.Option.(proxy.Shadowsocks)
|
||||
ss := data.Option.(proxy.Shadowsocks)
|
||||
|
||||
password := uuid
|
||||
// SIP022 AEAD-2022 Ciphers
|
||||
if strings.Contains(ss.Method, "2022") {
|
||||
serverKey, userKey := proxy.GenerateShadowsocks2022Password(ss, uuid)
|
||||
password = fmt.Sprintf("%s:%s", serverKey, userKey)
|
||||
}
|
||||
|
||||
p := &Proxy{
|
||||
Tag: data.Name,
|
||||
Type: Shadowsocks,
|
||||
@@ -25,8 +36,8 @@ func ParseShadowsocks(data proxy.Proxy, uuid string) (*Proxy, error) {
|
||||
Server: data.Server,
|
||||
ServerPort: data.Port,
|
||||
},
|
||||
Method: config.Method,
|
||||
Password: uuid,
|
||||
Method: ss.Method,
|
||||
Password: password,
|
||||
Network: "tcp",
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user