feat: custom json marshaling implementation, replace json and yaml library (#89)

* chore: replace gopkg.in/yaml.v3 vs goccy/go-yaml; replace encoding/json with bytedance/sonic

* fix: yaml unmarshal panic

* feat: custom json marshaler implementation

* chore: fix import and err marshal handling

---------

Co-authored-by: yusing <yusing@6uo.me>
This commit is contained in:
Yuzerion
2025-04-16 15:02:11 +08:00
committed by GitHub
parent 57292f0fe8
commit 80bc018a7f
65 changed files with 1749 additions and 205 deletions

View File

@@ -1,11 +1,12 @@
package monitor
import (
"encoding/json"
"errors"
"net/http"
"net/url"
"github.com/yusing/go-proxy/pkg/json"
agentPkg "github.com/yusing/go-proxy/agent/pkg/agent"
"github.com/yusing/go-proxy/internal/watcher/health"
)

View File

@@ -1,6 +1,8 @@
package health
import "encoding/json"
import (
"github.com/yusing/go-proxy/pkg/json"
)
type Status uint8
@@ -35,10 +37,6 @@ func (s Status) String() string {
}
}
func (s Status) MarshalJSON() ([]byte, error) {
return []byte(`"` + s.String() + `"`), nil
}
func (s *Status) UnmarshalJSON(data []byte) error {
var str string
if err := json.Unmarshal(data, &str); err != nil {