update config

This commit is contained in:
ginuerzh
2022-01-03 23:45:49 +08:00
parent 14537d16ea
commit 566e930010
42 changed files with 412 additions and 521 deletions

View File

@ -2,8 +2,6 @@ package v5
import (
"crypto/tls"
"net/url"
"strings"
"time"
mdata "github.com/go-gost/gost/pkg/metadata"
@ -11,7 +9,6 @@ import (
type metadata struct {
connectTimeout time.Duration
User *url.Userinfo
tlsConfig *tls.Config
noTLS bool
}
@ -19,19 +16,9 @@ type metadata struct {
func (c *socks5Connector) parseMetadata(md mdata.Metadata) (err error) {
const (
connectTimeout = "timeout"
user = "user"
noTLS = "notls"
)
if v := mdata.GetString(md, user); v != "" {
ss := strings.SplitN(v, ":", 2)
if len(ss) == 1 {
c.md.User = url.User(ss[0])
} else {
c.md.User = url.UserPassword(ss[0], ss[1])
}
}
c.md.connectTimeout = mdata.GetDuration(md, connectTimeout)
c.md.noTLS = mdata.GetBool(md, noTLS)