mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-15 21:51:23 +08:00
34 lines
616 B
Go
34 lines
616 B
Go
package hub
|
|
|
|
import (
|
|
"github.com/Dreamacro/clash/config"
|
|
"github.com/Dreamacro/clash/proxy"
|
|
T "github.com/Dreamacro/clash/tunnel"
|
|
)
|
|
|
|
var (
|
|
tunnel = T.Instance()
|
|
cfg = config.Instance()
|
|
listener = proxy.Instance()
|
|
)
|
|
|
|
type Error struct {
|
|
Error string `json:"error"`
|
|
}
|
|
|
|
type Errors struct {
|
|
Errors map[string]string `json:"errors"`
|
|
}
|
|
|
|
func formatErrors(errorsMap map[string]error) (bool, Errors) {
|
|
errors := make(map[string]string)
|
|
hasError := false
|
|
for key, err := range errorsMap {
|
|
if err != nil {
|
|
errors[key] = err.Error()
|
|
hasError = true
|
|
}
|
|
}
|
|
return hasError, Errors{Errors: errors}
|
|
}
|