mirror of
https://github.com/yhl452493373/frps-panel.git
synced 2026-04-04 06:16:59 +08:00
@@ -77,7 +77,7 @@ func (c *HandleController) JudgePort(content *plugin.NewProxyContent) plugin.Res
|
|||||||
"tcp", "tcpmux", "udp", "http", "https",
|
"tcp", "tcpmux", "udp", "http", "https",
|
||||||
}
|
}
|
||||||
proxyType := content.ProxyType
|
proxyType := content.ProxyType
|
||||||
if stringContains(proxyType, supportProxyTypes) {
|
if !stringContains(proxyType, supportProxyTypes) {
|
||||||
log.Printf("proxy type [%v] not support, plugin do nothing", proxyType)
|
log.Printf("proxy type [%v] not support, plugin do nothing", proxyType)
|
||||||
res.Unchange = true
|
res.Unchange = true
|
||||||
return res
|
return res
|
||||||
@@ -115,6 +115,10 @@ func (c *HandleController) JudgePort(content *plugin.NewProxyContent) plugin.Res
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if str == "" {
|
||||||
|
portAllowed = true
|
||||||
|
break
|
||||||
|
}
|
||||||
allowed, err := strconv.Atoi(str)
|
allowed, err := strconv.Atoi(str)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
portErr = fmt.Errorf("user [%v] allowed port [%v] is not a number", user, port)
|
portErr = fmt.Errorf("user [%v] allowed port [%v] is not a number", user, port)
|
||||||
@@ -148,13 +152,17 @@ func (c *HandleController) JudgePort(content *plugin.NewProxyContent) plugin.Res
|
|||||||
if proxyType == "http" || proxyType == "https" || proxyType == "tcpmux" {
|
if proxyType == "http" || proxyType == "https" || proxyType == "tcpmux" {
|
||||||
if portAllowed {
|
if portAllowed {
|
||||||
if token, exist := c.Tokens[user]; exist {
|
if token, exist := c.Tokens[user]; exist {
|
||||||
|
if stringContains("", token.Domains) {
|
||||||
|
domainAllowed = true
|
||||||
|
} else {
|
||||||
for _, userDomain := range userDomains {
|
for _, userDomain := range userDomains {
|
||||||
if stringContains(userDomain, token.Domains) {
|
if !stringContains(userDomain, token.Domains) {
|
||||||
domainAllowed = false
|
domainAllowed = false
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if !domainAllowed {
|
if !domainAllowed {
|
||||||
portErr = fmt.Errorf("user [%v] domain [%v] is not allowed", user, strings.Join(userDomains, ","))
|
portErr = fmt.Errorf("user [%v] domain [%v] is not allowed", user, strings.Join(userDomains, ","))
|
||||||
reject = true
|
reject = true
|
||||||
@@ -167,12 +175,16 @@ func (c *HandleController) JudgePort(content *plugin.NewProxyContent) plugin.Res
|
|||||||
subdomainAllowed = false
|
subdomainAllowed = false
|
||||||
if portAllowed && domainAllowed {
|
if portAllowed && domainAllowed {
|
||||||
if token, exist := c.Tokens[user]; exist {
|
if token, exist := c.Tokens[user]; exist {
|
||||||
|
if stringContains("", token.Subdomains) {
|
||||||
|
subdomainAllowed = true
|
||||||
|
} else {
|
||||||
for _, subdomain := range token.Subdomains {
|
for _, subdomain := range token.Subdomains {
|
||||||
if subdomain == userSubdomain {
|
if subdomain == userSubdomain {
|
||||||
subdomainAllowed = true
|
subdomainAllowed = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
subdomainAllowed = true
|
subdomainAllowed = true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user