Chore: improve code architecture
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
package adapters
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"sort"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
@ -46,6 +48,19 @@ func (u *URLTest) Generator(metadata *C.Metadata) (adapter C.ProxyAdapter, err e
|
||||
return a, err
|
||||
}
|
||||
|
||||
func (u *URLTest) MarshalJSON() ([]byte, error) {
|
||||
var all []string
|
||||
for _, proxy := range u.proxies {
|
||||
all = append(all, proxy.Name())
|
||||
}
|
||||
sort.Strings(all)
|
||||
return json.Marshal(map[string]interface{}{
|
||||
"type": u.Type().String(),
|
||||
"now": u.Now(),
|
||||
"all": all,
|
||||
})
|
||||
}
|
||||
|
||||
func (u *URLTest) Close() {
|
||||
u.done <- struct{}{}
|
||||
}
|
||||
|
Reference in New Issue
Block a user