mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-02-23 06:53:13 +08:00
chore: code cleanup
This commit is contained in:
parent
012e448562
commit
81c832ef9e
@ -46,18 +46,13 @@ type proxySetProvider struct {
|
||||
}
|
||||
|
||||
func (pp *proxySetProvider) MarshalJSON() ([]byte, error) {
|
||||
expectedStatus := "*"
|
||||
if pp.healthCheck.expectedStatus != nil {
|
||||
expectedStatus = pp.healthCheck.expectedStatus.ToString()
|
||||
}
|
||||
|
||||
return json.Marshal(map[string]any{
|
||||
"name": pp.Name(),
|
||||
"type": pp.Type().String(),
|
||||
"vehicleType": pp.VehicleType().String(),
|
||||
"proxies": pp.Proxies(),
|
||||
"testUrl": pp.healthCheck.url,
|
||||
"expectedStatus": expectedStatus,
|
||||
"expectedStatus": pp.healthCheck.expectedStatus.String(),
|
||||
"updatedAt": pp.UpdatedAt,
|
||||
"subscriptionInfo": pp.subscriptionInfo,
|
||||
})
|
||||
@ -221,18 +216,13 @@ type compatibleProvider struct {
|
||||
}
|
||||
|
||||
func (cp *compatibleProvider) MarshalJSON() ([]byte, error) {
|
||||
expectedStatus := "*"
|
||||
if cp.healthCheck.expectedStatus != nil {
|
||||
expectedStatus = cp.healthCheck.expectedStatus.ToString()
|
||||
}
|
||||
|
||||
return json.Marshal(map[string]any{
|
||||
"name": cp.Name(),
|
||||
"type": cp.Type().String(),
|
||||
"vehicleType": cp.VehicleType().String(),
|
||||
"proxies": cp.Proxies(),
|
||||
"testUrl": cp.healthCheck.url,
|
||||
"expectedStatus": expectedStatus,
|
||||
"expectedStatus": cp.healthCheck.expectedStatus.String(),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ func (ranges IntRanges[T]) Check(status T) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (ranges IntRanges[T]) ToString() string {
|
||||
func (ranges IntRanges[T]) String() string {
|
||||
if len(ranges) == 0 {
|
||||
return "*"
|
||||
}
|
||||
@ -134,6 +134,10 @@ func (ranges IntRanges[T]) ToString() string {
|
||||
}
|
||||
|
||||
func (ranges IntRanges[T]) Range(f func(t T) bool) {
|
||||
if len(ranges) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
for _, r := range ranges {
|
||||
for i := r.Start(); i <= r.End(); i++ {
|
||||
if !f(i) {
|
||||
|
Loading…
Reference in New Issue
Block a user