move UpdatableProvider define in here

This commit is contained in:
wwqgtxx 2024-09-12 11:18:28 +08:00
parent 3ce66040b3
commit bbe9dc42d2

View File

@ -5,7 +5,6 @@ import (
"fmt" "fmt"
"time" "time"
P "github.com/metacubex/mihomo/adapter/provider"
"github.com/metacubex/mihomo/constant/provider" "github.com/metacubex/mihomo/constant/provider"
"github.com/metacubex/mihomo/log" "github.com/metacubex/mihomo/log"
"github.com/metacubex/mihomo/tunnel" "github.com/metacubex/mihomo/tunnel"
@ -20,6 +19,10 @@ type Provider struct {
UpdatedAt int64 `json:"updatedAt"` UpdatedAt int64 `json:"updatedAt"`
} }
type UpdatableProvider interface {
UpdatedAt() time.Time
}
func QueryProviders() []*Provider { func QueryProviders() []*Provider {
r := tunnel.RuleProviders() r := tunnel.RuleProviders()
p := tunnel.Providers() p := tunnel.Providers()
@ -47,7 +50,7 @@ func QueryProviders() []*Provider {
for _, p := range providers { for _, p := range providers {
updatedAt := time.Time{} updatedAt := time.Time{}
if s, ok := p.(P.UpdatableProvider); ok { if s, ok := p.(UpdatableProvider); ok {
updatedAt = s.UpdatedAt() updatedAt = s.UpdatedAt()
} }