new feature multi user auth with socks5

This commit is contained in:
zhangwei
2019-09-12 22:54:53 +08:00
parent a05995fba5
commit 11d185ad59
4 changed files with 26 additions and 26 deletions

View File

@@ -239,15 +239,15 @@ func dealTunnel(s string) *file.Tunnel {
t.LocalPath = item[1]
case "strip_pre":
t.StripPre = item[1]
case "multi_user":
t.MultiUser = new(file.MultiUser)
case "multi_account":
t.MultiAccount = &file.MultiAccount{}
if b, err := common.ReadAllFromFile(item[1]); err != nil {
panic(err)
} else {
if content, err := common.ParseStr(string(b)); err != nil {
panic(err)
} else {
t.MultiUser.UserMap = dealMultiUser(content)
t.MultiAccount.AccountMap = dealMultiUser(content)
}
}
}

View File

@@ -124,23 +124,23 @@ func (s *Client) HasHost(h *Host) bool {
}
type Tunnel struct {
Id int
Port int
ServerIp string
Mode string
Status bool
RunStatus bool
Client *Client
Ports string
Flow *Flow
Password string
Remark string
TargetAddr string
NoStore bool
LocalPath string
StripPre string
Target *Target
MultiUser *MultiUser
Id int
Port int
ServerIp string
Mode string
Status bool
RunStatus bool
Client *Client
Ports string
Flow *Flow
Password string
Remark string
TargetAddr string
NoStore bool
LocalPath string
StripPre string
Target *Target
MultiAccount *MultiAccount
Health
sync.RWMutex
}
@@ -185,8 +185,8 @@ type Target struct {
sync.RWMutex
}
type MultiUser struct {
UserMap map[string]string // multi user and pwd
type MultiAccount struct {
AccountMap map[string]string // multi account and pwd
}
func (s *Target) GetRandomTarget() (string, error) {