Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,3 @@ LISTEN_ADDR=127.0.0.1:2375

# Debug mode
GODOXY_DEBUG=false

# use bytedance/sonic library for efficient json handling, disable if you see "SIGILL: illegal instructions"
USE_SONIC_JSON=true
3 changes: 0 additions & 3 deletions agent/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/yusing/godoxy/agent/pkg/env"
"github.com/yusing/godoxy/agent/pkg/handler"
"github.com/yusing/godoxy/internal/metrics/systeminfo"
"github.com/yusing/godoxy/internal/serialization"
_ "github.com/yusing/godoxy/internal/serialization"
socketproxy "github.com/yusing/godoxy/socketproxy/pkg"
strutils "github.com/yusing/goutils/strings"
Expand Down Expand Up @@ -59,13 +58,11 @@ func main() {
log.Info().Msgf("Agent name: %s", env.AgentName)
log.Info().Msgf("Agent port: %d", env.AgentPort)
log.Info().Msgf("Agent runtime: %s", env.Runtime)
log.Info().Msgf("Sonic enabled: %v", serialization.EnvUseSonic)

log.Info().Msg(`
Tips:
1. To change the agent name, you can set the AGENT_NAME environment variable.
2. To change the agent port, you can set the AGENT_PORT environment variable.
3. Set USE_SONIC_JSON to false when you see "SIGILL: illegal instructions" error.
`)

t := task.RootTask("agent", false)
Expand Down
2 changes: 1 addition & 1 deletion agent/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ replace (
exclude github.com/containerd/nerdctl/mod/tigron v0.0.0

require (
github.com/bytedance/sonic v1.15.2
github.com/gin-gonic/gin v1.12.0
github.com/gorilla/websocket v1.5.3
github.com/pion/dtls/v3 v3.1.5
Expand All @@ -34,6 +33,7 @@ require (
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/andybalholm/brotli v1.2.2 // indirect
github.com/bytedance/gopkg v0.1.4 // indirect
github.com/bytedance/sonic v1.15.2 // indirect
github.com/bytedance/sonic/loader v0.5.2 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cloudwego/base64x v0.1.7 // indirect
Expand Down
2 changes: 0 additions & 2 deletions agent/pkg/agent/templates/agent.compose.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ services:
AGENT_PORT: "{{.Port}}"
AGENT_CA_CERT: "{{.CACert}}"
AGENT_SSL_CERT: "{{.SSLCert}}"
# use bytedance/sonic library for efficient json handling, disable if you see "SIGILL: illegal instructions"
USE_SONIC_JSON: true
# use agent as a docker socket proxy: [host]:port
# set LISTEN_ADDR to enable (e.g. 127.0.0.1:2375)
LISTEN_ADDR:
Expand Down
10 changes: 7 additions & 3 deletions agent/pkg/handler/proxy_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
"sync"
"time"

"github.com/bytedance/sonic"
"github.com/yusing/godoxy/agent/pkg/agent"
"github.com/yusing/godoxy/agent/pkg/agentproxy"
"github.com/yusing/goutils/http/reverseproxy"
strutils "github.com/yusing/goutils/strings"
)

const maxCachedProxies = 64
Expand Down Expand Up @@ -40,6 +40,10 @@ func NewTransport() *http.Transport {
}
}

// ProxyHTTP forwards an HTTP request to the configured proxy destination.
// It reads the proxy configuration from request headers and responds with
// status 400 for invalid configuration or status 500 if the proxy cannot be
// built.
func ProxyHTTP(w http.ResponseWriter, r *http.Request) {
cfg, err := agentproxy.ConfigFromHeaders(r.Header)
if err != nil {
Expand Down Expand Up @@ -79,12 +83,12 @@ func ProxyHTTP(w http.ResponseWriter, r *http.Request) {
rp.ServeHTTP(w, r)
}

// cachedReverseProxy retrieves or creates a reverse proxy for the specified configuration and target URL, caching the result for reuse. It returns an error if the configuration cannot be serialized or its TLS configuration cannot be built.
func cachedReverseProxy(cfg agentproxy.Config, targetURL *url.URL) (*reverseproxy.ReverseProxy, error) {
keyBytes, err := sonic.Marshal(cfg)
key, err := strutils.MarshalString(cfg)
if err != nil {
return nil, fmt.Errorf("marshal proxy config: %w", err)
}
key := string(keyBytes)

proxyCache.Lock()
defer proxyCache.Unlock()
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ replace (
require (
github.com/PuerkitoBio/goquery v1.12.0 // parsing HTML for extract fav icon; modify_html middleware
github.com/bytedance/gopkg v0.1.4 // xxhash64 for fast hash
github.com/bytedance/sonic v1.15.2 // fast json parsing
github.com/cenkalti/backoff/v5 v5.0.3 // backoff for retrying operations
github.com/coreos/go-oidc/v3 v3.20.0 // oidc authentication
github.com/docker/cli v29.7.2+incompatible // needs docker/cli/cli/connhelper connection helper for docker client
Expand Down Expand Up @@ -83,6 +82,7 @@ require (
github.com/bodgit/tsig v1.3.1 // indirect
github.com/boombuler/barcode v1.1.0 // indirect
github.com/buger/goterm v1.0.4 // indirect
github.com/bytedance/sonic v1.15.2 // indirect
github.com/bytedance/sonic/loader v0.5.2 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cloudwego/base64x v0.1.7 // indirect
Expand Down
2 changes: 1 addition & 1 deletion goutils
7 changes: 0 additions & 7 deletions internal/dnsproviders/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@ require (
github.com/bodgit/gssapi v0.0.4 // indirect
github.com/bodgit/tsig v1.3.1 // indirect
github.com/boombuler/barcode v1.1.0 // indirect
github.com/bytedance/gopkg v0.1.4 // indirect
github.com/bytedance/sonic v1.15.2 // indirect
github.com/bytedance/sonic/loader v0.5.2 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cloudwego/base64x v0.1.7 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/felixge/httpsnoop v1.1.0 // indirect
Expand Down Expand Up @@ -67,7 +63,6 @@ require (
github.com/jcmturner/goidentity/v6 v6.0.1 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/klauspost/cpuid/v2 v2.4.0 // indirect
github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/leodido/go-urn v1.5.0 // indirect
Expand Down Expand Up @@ -96,7 +91,6 @@ require (
github.com/spf13/afero v1.15.0 // indirect
github.com/stretchr/objx v0.5.3 // indirect
github.com/stretchr/testify v1.11.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/vultr/govultr/v3 v3.32.0 // indirect
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
github.com/yusing/gointernals v0.2.1 // indirect
Expand All @@ -107,7 +101,6 @@ require (
go.opentelemetry.io/otel/metric v1.45.0 // indirect
go.opentelemetry.io/otel/trace v1.45.0 // indirect
go.uber.org/ratelimit v0.3.1 // indirect
golang.org/x/arch v0.30.0 // indirect
golang.org/x/crypto v0.55.0 // indirect
golang.org/x/mod v0.40.0 // indirect
golang.org/x/net v0.58.0 // indirect
Expand Down
15 changes: 0 additions & 15 deletions internal/dnsproviders/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,10 @@ github.com/bodgit/tsig v1.3.1/go.mod h1:Ez+xu0W5Ew/D28XqthucLOX8k9A0UGVPETvagYxb
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/boombuler/barcode v1.1.0 h1:ChaYjBR63fr4LFyGn8E8nt7dBSt3MiU3zMOZqFvVkHo=
github.com/boombuler/barcode v1.1.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/bytedance/gopkg v0.1.4 h1:oZnQwnX82KAIWb7033bEwtxvTqXcYMxDBaQxo5JJHWM=
github.com/bytedance/gopkg v0.1.4/go.mod h1:v1zWfPm21Fb+OsyXN2VAHdL6TBb2L88anLQgdyje6R4=
github.com/bytedance/sonic v1.15.2 h1:90H+rcF/FwLXwfB1cudOLq/je83n683Utf4Cbp0xHCo=
github.com/bytedance/sonic v1.15.2/go.mod h1:mT2NbXunuaEbnZ+mRIX/vYqKISmgEuHFDI4UzmKx2SA=
github.com/bytedance/sonic/loader v0.5.2 h1:0QtP1gevc1OZ6/H8Lb9BRZiCXd1Ftjd3OKuj1T1lBIo=
github.com/bytedance/sonic/loader v0.5.2/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo=
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cloudwego/base64x v0.1.7 h1:NppS+Fgzg5ovhn4NkUXaDT3x9jldgH5ToMCqzBSi2zI=
github.com/cloudwego/base64x v0.1.7/go.mod h1:Cu1PV9zfrSf7ET2tIbWbbEy7jO7HHJ13q4X2SQ8aWYg=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
Expand Down Expand Up @@ -146,8 +138,6 @@ github.com/jcmturner/rpc/v2 v2.0.3 h1:7FXXj8Ti1IaVFpSAziCZWNzbNuZmnvw/i6CqLNdWfZ
github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc=
github.com/keybase/go-keychain v0.0.1 h1:way+bWYa6lDppZoZcgMbYsvC7GxljxrskdNInRtuthU=
github.com/keybase/go-keychain v0.0.1/go.mod h1:PdEILRW3i9D8JcdM+FmY6RwkHGnhHxXwkPPMeUgOK1k=
github.com/klauspost/cpuid/v2 v2.4.0 h1:S6Hrbc7+ywsr0r+RLapfGBHfyefhCTwEh3A0tV913Dw=
github.com/klauspost/cpuid/v2 v2.4.0/go.mod h1:19jmZ9mjzoF//ddRSUsv0zfBTJWh3QJh9FNxZTMrGxU=
github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b h1:udzkj9S/zlT5X367kqJis0QP7YMxobob6zhzq6Yre00=
github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b/go.mod h1:pcaDhQK0/NJZEvtCO0qQPPropqV0sJOJ6YW7X+9kRwM=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
Expand Down Expand Up @@ -219,11 +209,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/vultr/govultr/v3 v3.32.0 h1:QS9IAeSB3BIhSoP0jIYtmGAvtsYkprjWTZAGPx8keo8=
github.com/vultr/govultr/v3 v3.32.0/go.mod h1:2zyUw9yADQaGwKnwDesmIOlBNLrm7edsCfWHFJpWKf8=
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM=
Expand Down Expand Up @@ -251,8 +238,6 @@ go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/ratelimit v0.3.1 h1:K4qVE+byfv/B3tC+4nYWP7v/6SimcO7HzHekoMNBma0=
go.uber.org/ratelimit v0.3.1/go.mod h1:6euWsTB6U/Nb3X++xEUXA8ciPJvr19Q/0h1+oDcJhRk=
golang.org/x/arch v0.30.0 h1:sB9h+1gRGa2+LauFSV0tm8bK1J2yo1bx6/Uyi/P6DTU=
golang.org/x/arch v0.30.0/go.mod h1:0X+GdSIP+kL5wPmpK7sdkEVTt2XoYP0cSjQSbZBwOi8=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
Expand Down
2 changes: 1 addition & 1 deletion internal/homepage/integrations/qbittorrent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,4 @@ if resp.StatusCode != http.StatusOK {
## Related Packages

- `internal/homepage/widgets` - Widget framework and interface
- `github.com/yusing/goutils/strings` - String utilities and JSON helpers (`MarshalJSON`, `NewJSONDecoder`; backend: sonic via `internal/serialization`)
- `github.com/yusing/goutils/strings` - String utilities and JSON helpers (`MarshalJSON`, `NewJSONDecoder`; `encoding/json/v2`)
4 changes: 2 additions & 2 deletions internal/homepage/override_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
// The periodic jsonstore flush marshals the config while the API keeps writing
// to it, so marshaling must hold the lock.
//
// encoding/json is used instead of the sonic-backed strutils.MarshalJSON
// because sonic's generated encoder is not instrumented for the race detector.
// encoding/json is used instead of strutils.MarshalJSON so the test stays on
// the standard library encoder under the race detector.
func TestOverrideConfigMarshalIsConcurrentSafe(t *testing.T) {
aliases := []string{"a", "b", "c"}

Expand Down
3 changes: 2 additions & 1 deletion internal/jsonstore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,5 +363,6 @@ if err := strutils.UnmarshalJSON(data, &tmp); err != nil {

- Uses `xsync.Map` for lock-free reads
- Presizes maps based on input data
- JSON via `github.com/yusing/goutils/strings` helpers (in godoxy, sonic is registered as the backend from `internal/serialization`)
- JSON via `github.com/yusing/goutils/strings` helpers (`encoding/json/v2`)

- Background periodic save plus a save on program exit; unchanged namespaces are skipped
3 changes: 2 additions & 1 deletion internal/metrics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ No explicit configuration. Pollers respect `common.MetricsDisable*` flags:

- `github.com/shirou/gopsutil/v4` - System metrics collection
- `github.com/puzpuzpuz/xsync/v4` - Atomic value storage
- `github.com/yusing/goutils/strings` - JSON serialization helpers (backend: sonic via `internal/serialization`)
- `github.com/yusing/goutils/strings` - JSON serialization helpers (`encoding/json/v2`)


## Observability

Expand Down
3 changes: 2 additions & 1 deletion internal/metrics/period/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ None.
| ------------------------------------------ | ------------------------ |
| `github.com/gin-gonic/gin` | HTTP handling |
| `github.com/yusing/goutils/http/websocket` | WebSocket streaming |
| `github.com/yusing/goutils/strings` | JSON serialization (backend: sonic via `internal/serialization`) |
| `github.com/yusing/goutils/strings` | JSON serialization (`encoding/json/v2`) |

| `github.com/yusing/goutils/task` | Lifetime management |
| `github.com/puzpuzpuz/xsync/v4` | Concurrent value storage |

Expand Down
3 changes: 2 additions & 1 deletion internal/metrics/uptime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ No explicit configuration. The poller uses period package defaults:
| Dependency | Purpose |
| ---------------------------------------- | ---------------- |
| `github.com/lithammer/fuzzysearch/fuzzy` | Keyword matching |
| `github.com/yusing/goutils/strings` | JSON marshaling (backend: sonic via `internal/serialization`) |
| `github.com/yusing/goutils/strings` | JSON marshaling (`encoding/json/v2`) |


### Integration Points

Expand Down
3 changes: 2 additions & 1 deletion internal/notif/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ func (webhook *Webhook) MarshalMessage(logMsg *LogMessage) ([]byte, error) {
return []byte(pl), nil
}

// validateJSONPayload reports whether a webhook payload is valid JSON after replacing supported placeholders with JSON-compatible values.
func validateJSONPayload(payload string) bool {
replacer := strings.NewReplacer(
"$title", `""`,
Expand All @@ -149,5 +150,5 @@ func validateJSONPayload(payload string) bool {
"$color", "",
)
payload = replacer.Replace(payload)
return strutils.ValidJSON([]byte(payload))
return strutils.ValidJSONString(payload)
}
12 changes: 1 addition & 11 deletions internal/serialization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,8 @@ autocert:
- `github.com/goccy/go-yaml` - YAML parsing
- `github.com/go-playground/validator/v10` - Validation
- `github.com/puzpuzpuz/xsync/v4` - Type cache
- `github.com/yusing/goutils/strings` - Pluggable JSON marshal/unmarshal/streaming API used across godoxy
- `github.com/bytedance/sonic` - Optional JSON backend for that API: registered in `init()` when **`USE_SONIC_JSON`** is true (process env via `env.GetEnvBool`, default **true**).
- Set **`USE_SONIC_JSON=false`** if the binary hits **`SIGILL: illegal instruction`** on hardware that lacks the assumptions Sonic relies on.
- `github.com/yusing/goutils/strings` - JSON marshal/unmarshal/streaming API (`encoding/json/v2`; `time.Duration` as nanosecond numbers)

### `USE_SONIC_JSON`

| Value | Behavior |
| ---------------- | ----------------------------------------------------------------------------------------------- |
| `true` (default) | `setupSonic()` wires Sonic into `strutils` for marshal, unmarshal, indent, and encoder helpers. |
| `false` | Sonic is not registered; JSON uses whatever default `strutils` provides without explicit setup. |

Documented in repository `.env.example`, `rootless.env.example`, agent compose template (`agent/pkg/agent/templates/agent.compose.yml.tmpl`), and `scripts/install-agent.sh`.

### Internal Dependencies

Expand Down
24 changes: 0 additions & 24 deletions internal/serialization/serialization.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"errors"
"fmt"
"io"
"os"
"reflect"
"regexp"
Expand All @@ -13,7 +12,6 @@ import (
"time"
"unsafe"

"github.com/bytedance/sonic"
"github.com/go-playground/validator/v10"
"github.com/goccy/go-yaml"
"github.com/puzpuzpuz/xsync/v4"
Expand All @@ -23,8 +21,6 @@ import (
strutils "github.com/yusing/goutils/strings"
)

var EnvUseSonic = env.GetEnvBool("USE_SONIC_JSON", true)

type SerializedObject = map[string]any

// ToSerializedObject converts a map[string]VT to a SerializedObject.
Expand All @@ -37,30 +33,10 @@ func ToSerializedObject[VT any](m map[string]VT) SerializedObject {
}

func init() {
if EnvUseSonic {
setupSonic()
}
// default values uses std json
strutils.SetYAMLMarshaler(yaml.Marshal)
strutils.SetYAMLUnmarshaler(yaml.Unmarshal)
}

func setupSonic() {
strutils.SetJSONMarshaler(sonic.Marshal)
strutils.SetJSONUnmarshaler(sonic.Unmarshal)
strutils.SetJSONMarshalIndent(sonic.MarshalIndent)
strutils.SetJSONNewEncoder(func(w io.Writer) strutils.Encoder {
return sonic.ConfigDefault.NewEncoder(w)
})
strutils.SetJSONNewDecoder(func(r io.Reader) strutils.Decoder {
return sonic.ConfigDefault.NewDecoder(r)
})
strutils.SetJSONValid(sonic.Valid)
strutils.SetJSONMarshalString(sonic.MarshalString)
strutils.SetJSONUnmarshalString(sonic.UnmarshalString)
strutils.SetJSONValidString(sonic.ValidString)
}

type MapUnmarshaller interface {
UnmarshalMap(m map[string]any) error
}
Expand Down
3 changes: 0 additions & 3 deletions rootless.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,3 @@ GODOXY_METRICS_DISABLE_SENSORS=false

# Debug mode
GODOXY_DEBUG=false

# use bytedance/sonic library for efficient json handling, disable if you see "SIGILL: illegal instructions"
USE_SONIC_JSON=true
2 changes: 0 additions & 2 deletions scripts/install-agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,6 @@ AGENT_CA_CERT="${AGENT_CA_CERT}"
AGENT_SSL_CERT="${AGENT_SSL_CERT}"
DOCKER_SOCKET="${DOCKER_SOCKET}"
RUNTIME="${RUNTIME}"
# use bytedance/sonic library for efficient json handling, disable if you see "SIGILL: illegal instructions"
USE_SONIC_JSON=true
EOF
chmod 600 $env_file

Expand Down
2 changes: 1 addition & 1 deletion webui
Submodule webui updated 2 files
+1 −1 Dockerfile
+1 −1 wiki
Loading