mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-15 13:41:23 +08:00
31 lines
376 B
Go
31 lines
376 B
Go
package dns
|
|
|
|
type Policy struct {
|
|
data []dnsClient
|
|
}
|
|
|
|
func (p *Policy) GetData() []dnsClient {
|
|
return p.data
|
|
}
|
|
|
|
func (p *Policy) Compare(p2 *Policy) int {
|
|
if p2 == nil {
|
|
return 1
|
|
}
|
|
l1 := len(p.data)
|
|
l2 := len(p2.data)
|
|
if l1 == l2 {
|
|
return 0
|
|
}
|
|
if l1 > l2 {
|
|
return 1
|
|
}
|
|
return -1
|
|
}
|
|
|
|
func NewPolicy(data []dnsClient) *Policy {
|
|
return &Policy{
|
|
data: data,
|
|
}
|
|
}
|