mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-01 22:53:05 +02:00
Rebased from main: Old CPU / Old docker version compatibility
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"github.com/bytedance/sonic"
|
||||
"github.com/moby/moby/api/types/container"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/yusing/ds/ordered"
|
||||
"github.com/yusing/godoxy/internal/agentpool"
|
||||
gperr "github.com/yusing/goutils/errs"
|
||||
@@ -11,7 +12,7 @@ import (
|
||||
type (
|
||||
LabelMap = map[string]any
|
||||
|
||||
PortMapping = map[int]container.PortSummary
|
||||
PortMapping = map[int]container.Port
|
||||
Container struct {
|
||||
DockerCfg DockerProviderConfig `json:"docker_cfg"`
|
||||
Image *ContainerImage `json:"image"`
|
||||
@@ -69,5 +70,5 @@ func (e *ContainerError) Unwrap() error {
|
||||
|
||||
func (e *ContainerError) MarshalJSON() ([]byte, error) {
|
||||
err := e.errs.Error().(gperr.PlainError)
|
||||
return sonic.Marshal(string(err.Plain()))
|
||||
return json.Marshal(string(err.Plain()))
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/bytedance/sonic"
|
||||
"github.com/yusing/goutils/task"
|
||||
)
|
||||
|
||||
@@ -162,7 +161,7 @@ func (s HealthStatus) MarshalJSON() ([]byte, error) {
|
||||
|
||||
func (s *HealthStatus) UnmarshalJSON(data []byte) error {
|
||||
var v string
|
||||
if err := sonic.Unmarshal(data, &v); err != nil {
|
||||
if err := json.Unmarshal(data, &v); err != nil {
|
||||
return fmt.Errorf("failed to unmarshal health status: %w", err)
|
||||
}
|
||||
|
||||
@@ -178,7 +177,7 @@ func (jsonRepr *HealthJSONRepr) MarshalJSON() ([]byte, error) {
|
||||
if url == "http://:0" {
|
||||
url = ""
|
||||
}
|
||||
return sonic.Marshal(HealthJSON{
|
||||
return json.Marshal(HealthJSON{
|
||||
Name: jsonRepr.Name,
|
||||
Config: jsonRepr.Config,
|
||||
Started: jsonRepr.Started.Unix(),
|
||||
|
||||
@@ -17,7 +17,7 @@ type (
|
||||
IdlewatcherConfigBase struct {
|
||||
// 0: no idle watcher.
|
||||
// Positive: idle watcher with idle timeout.
|
||||
// Negative: idle watcher as a dependency.
|
||||
// Negative: idle watcher as a dependency. IdleTimeout time.Duration `json:"idle_timeout" json_ext:"duration"`
|
||||
IdleTimeout time.Duration `json:"idle_timeout"`
|
||||
WakeTimeout time.Duration `json:"wake_timeout"`
|
||||
StopTimeout time.Duration `json:"stop_timeout"`
|
||||
|
||||
Reference in New Issue
Block a user