update cmd

This commit is contained in:
ginuerzh
2021-11-22 23:57:07 +08:00
parent fa8375f763
commit ece51cb0b8
18 changed files with 135 additions and 80 deletions

View File

@ -1,6 +1,7 @@
package ss
import (
"strings"
"time"
"github.com/go-gost/gost/pkg/common/util/ss"
@ -16,18 +17,22 @@ type metadata struct {
func (c *ssConnector) parseMetadata(md md.Metadata) (err error) {
const (
method = "method"
password = "password"
user = "user"
key = "key"
connectTimeout = "timeout"
noDelay = "nodelay"
)
c.md.cipher, err = ss.ShadowCipher(
md.GetString(method),
md.GetString(password),
md.GetString(key),
)
var method, password string
if v := md.GetString(user); v != "" {
ss := strings.SplitN(v, ":", 2)
if len(ss) == 1 {
method = ss[0]
} else {
method, password = ss[0], ss[1]
}
}
c.md.cipher, err = ss.ShadowCipher(method, password, md.GetString(key))
if err != nil {
return
}