32 lines
652 B
Go
32 lines
652 B
Go
package kernel
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/cedar2025/xboard-node/internal/panel"
|
|
)
|
|
|
|
// NeedsGeoIP returns true when any panel route rule contains a "geoip:" match entry.
|
|
func NeedsGeoIP(routes []panel.RouteRule) bool {
|
|
for _, r := range routes {
|
|
for _, m := range r.Match {
|
|
if strings.HasPrefix(m, "geoip:") {
|
|
return true
|
|
}
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// NeedsGeoSite returns true when any panel route rule contains a "geosite:" match entry.
|
|
func NeedsGeoSite(routes []panel.RouteRule) bool {
|
|
for _, r := range routes {
|
|
for _, m := range r.Match {
|
|
if strings.HasPrefix(m, "geosite:") {
|
|
return true
|
|
}
|
|
}
|
|
}
|
|
return false
|
|
}
|