mirror of
https://github.com/yhl452493373/frps-panel.git
synced 2026-04-04 14:27:00 +08:00
Compare commits
7 Commits
1.7.1
...
cbd9611c3d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbd9611c3d | ||
|
|
8d54567c0f | ||
|
|
245f4fa32f | ||
| 4a714dcd0e | |||
| 43d3ef275e | |||
| d581a65002 | |||
| f6d2362f48 |
@@ -12,7 +12,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const version = "1.7.1"
|
const version = "1.7.2"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
showVersion bool
|
showVersion bool
|
||||||
@@ -87,7 +87,7 @@ func parseConfigFile(configFile, tokensFile string) (controller.HandleController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
common.Common.DashboardTls = strings.HasPrefix("https://", strings.ToLower(common.Common.DashboardAddr))
|
common.Common.DashboardTls = strings.HasPrefix(strings.ToLower(common.Common.DashboardAddr), "https://")
|
||||||
|
|
||||||
tls := server.TLS{
|
tls := server.TLS{
|
||||||
Enable: common.Common.TlsMode,
|
Enable: common.Common.TlsMode,
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -8,7 +8,6 @@ require (
|
|||||||
github.com/gin-contrib/i18n v1.0.0
|
github.com/gin-contrib/i18n v1.0.0
|
||||||
github.com/gin-contrib/sessions v0.0.5
|
github.com/gin-contrib/sessions v0.0.5
|
||||||
github.com/gin-gonic/gin v1.9.1
|
github.com/gin-gonic/gin v1.9.1
|
||||||
github.com/pelletier/go-toml/v2 v2.0.9
|
|
||||||
github.com/spf13/cobra v0.0.3
|
github.com/spf13/cobra v0.0.3
|
||||||
golang.org/x/text v0.11.0
|
golang.org/x/text v0.11.0
|
||||||
)
|
)
|
||||||
@@ -36,6 +35,7 @@ require (
|
|||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
github.com/nicksnyder/go-i18n/v2 v2.2.1 // indirect
|
github.com/nicksnyder/go-i18n/v2 v2.2.1 // indirect
|
||||||
|
github.com/pelletier/go-toml/v2 v2.0.9 // indirect
|
||||||
github.com/spf13/pflag v1.0.5 // indirect
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||||
github.com/ugorji/go/codec v1.2.11 // indirect
|
github.com/ugorji/go/codec v1.2.11 // indirect
|
||||||
|
|||||||
@@ -556,6 +556,9 @@ func (c *HandleController) MakeProxyFunc() func(context *gin.Context) {
|
|||||||
res := ProxyResponse{}
|
res := ProxyResponse{}
|
||||||
host := c.CommonInfo.DashboardAddr
|
host := c.CommonInfo.DashboardAddr
|
||||||
port := c.CommonInfo.DashboardPort
|
port := c.CommonInfo.DashboardPort
|
||||||
|
|
||||||
|
host, _ = strings.CutPrefix(host, protocol)
|
||||||
|
|
||||||
requestUrl := protocol + host + ":" + strconv.Itoa(port) + context.Param("serverApi")
|
requestUrl := protocol + host + ":" + strconv.Itoa(port) + context.Param("serverApi")
|
||||||
request, _ := http.NewRequest("GET", requestUrl, nil)
|
request, _ := http.NewRequest("GET", requestUrl, nil)
|
||||||
username := c.CommonInfo.DashboardUser
|
username := c.CommonInfo.DashboardUser
|
||||||
|
|||||||
@@ -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,10 +152,14 @@ 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 {
|
||||||
for _, userDomain := range userDomains {
|
if stringContains("", token.Domains) {
|
||||||
if stringContains(userDomain, token.Domains) {
|
domainAllowed = true
|
||||||
domainAllowed = false
|
} else {
|
||||||
break
|
for _, userDomain := range userDomains {
|
||||||
|
if !stringContains(userDomain, token.Domains) {
|
||||||
|
domainAllowed = false
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -167,10 +175,14 @@ 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 {
|
||||||
for _, subdomain := range token.Subdomains {
|
if stringContains("", token.Subdomains) {
|
||||||
if subdomain == userSubdomain {
|
subdomainAllowed = true
|
||||||
subdomainAllowed = true
|
} else {
|
||||||
break
|
for _, subdomain := range token.Subdomains {
|
||||||
|
if subdomain == userSubdomain {
|
||||||
|
subdomainAllowed = true
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user