From 4cf39799376e6302ae22717c668e67550c491e70 Mon Sep 17 00:00:00 2001 From: yusing Date: Thu, 20 Aug 2026 15:10:59 +0800 Subject: [PATCH 1/3] chore: bump modules to Go 1.27 Update Go module and Docker builder versions to 1.27, refresh dependencies and checksums, and update the goutils submodule. Simplify JWT claim initialization and icon reference parsing with go1.27 anonymous struct promotion. --- Dockerfile | 2 +- agent/go.mod | 4 +- agent/go.sum | 4 +- cmd/bench_server/Dockerfile | 2 +- cmd/bench_server/go.mod | 2 +- cmd/cli/go.mod | 2 +- cmd/h2c_test_server/Dockerfile | 2 +- cmd/h2c_test_server/go.mod | 2 +- cmd/h3bench/go.mod | 2 +- cmd/tcp_echo_server/Dockerfile | 2 +- go.mod | 175 ++++++++++----------- go.sum | 4 +- goutils | 2 +- internal/auth/oauth_refresh.go | 8 +- internal/auth/userpass.go | 6 +- internal/dnsproviders/go.mod | 4 +- internal/dnsproviders/go.sum | 66 +------- internal/homepage/icons/list/list_icons.go | 4 +- internal/homepage/icons/list/resolve.go | 6 +- socket-proxy/go.mod | 2 +- 20 files changed, 117 insertions(+), 184 deletions(-) diff --git a/Dockerfile b/Dockerfile index d6d33258..9e9bf9ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Stage 1: go-base -FROM golang:1.26.5-alpine AS go-base +FROM golang:1.27.0-alpine AS go-base HEALTHCHECK NONE # package version does not matter diff --git a/agent/go.mod b/agent/go.mod index 217438c8..6f45fe10 100644 --- a/agent/go.mod +++ b/agent/go.mod @@ -1,6 +1,6 @@ module github.com/yusing/godoxy/agent -go 1.26.5 +go 1.27.0 replace ( github.com/shirou/gopsutil/v4 => ../internal/gopsutil @@ -92,7 +92,7 @@ require ( github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasthttp v1.73.0 // indirect github.com/yusing/ds v0.4.1 // indirect - github.com/yusing/gointernals v0.2.0 // indirect + github.com/yusing/gointernals v0.2.1 // indirect github.com/yusing/goutils/http/websocket v0.0.0-20260729070603-e4c7e978cbc2 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.mongodb.org/mongo-driver/v2 v2.8.0 // indirect diff --git a/agent/go.sum b/agent/go.sum index 38bcaf16..691acca7 100644 --- a/agent/go.sum +++ b/agent/go.sum @@ -196,8 +196,8 @@ github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZ github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= github.com/yusing/ds v0.4.1 h1:syMCh7hO6Yw8xfcFkEaln3W+lVeWB/U/meYv6Wf2/Ig= github.com/yusing/ds v0.4.1/go.mod h1:XhKV4l7cZwBbbl7lRzNC9zX27zvCM0frIwiuD40ULRk= -github.com/yusing/gointernals v0.2.0 h1:jyWB3kdUPkuU6s0r8QY/sS5h2WNBF4Kfisly8dtSVvg= -github.com/yusing/gointernals v0.2.0/go.mod h1:xGzNbPGMm5Z8kG0t4JYISMscw+gMQlgghkLxlgRZv5Y= +github.com/yusing/gointernals v0.2.1 h1:QlajBlRG6qbqfzjHmRq774pi+CUW/DILjFM6GjveHuM= +github.com/yusing/gointernals v0.2.1/go.mod h1:xGzNbPGMm5Z8kG0t4JYISMscw+gMQlgghkLxlgRZv5Y= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.mongodb.org/mongo-driver/v2 v2.8.0 h1:CxWDGQYY8QQwNjAl/aq2sfWakdnWZynnqJ9F4DhHbP8= diff --git a/cmd/bench_server/Dockerfile b/cmd/bench_server/Dockerfile index 8eb80202..9b859636 100644 --- a/cmd/bench_server/Dockerfile +++ b/cmd/bench_server/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.26.5-alpine AS builder +FROM golang:1.27.0-alpine AS builder HEALTHCHECK NONE diff --git a/cmd/bench_server/go.mod b/cmd/bench_server/go.mod index e5ca0c3d..f08031b4 100644 --- a/cmd/bench_server/go.mod +++ b/cmd/bench_server/go.mod @@ -1,6 +1,6 @@ module github.com/yusing/godoxy/cmd/bench_server -go 1.26.5 +go 1.27.0 require ( github.com/gorilla/websocket v1.5.3 diff --git a/cmd/cli/go.mod b/cmd/cli/go.mod index 6833189e..d431f45c 100644 --- a/cmd/cli/go.mod +++ b/cmd/cli/go.mod @@ -1,6 +1,6 @@ module github.com/yusing/godoxy/cli -go 1.26.5 +go 1.27.0 require ( github.com/gorilla/websocket v1.5.3 diff --git a/cmd/h2c_test_server/Dockerfile b/cmd/h2c_test_server/Dockerfile index 2513629c..3b99ef56 100644 --- a/cmd/h2c_test_server/Dockerfile +++ b/cmd/h2c_test_server/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.26.5-alpine AS builder +FROM golang:1.27.0-alpine AS builder HEALTHCHECK NONE diff --git a/cmd/h2c_test_server/go.mod b/cmd/h2c_test_server/go.mod index 514fff49..1ef0b8bd 100644 --- a/cmd/h2c_test_server/go.mod +++ b/cmd/h2c_test_server/go.mod @@ -1,6 +1,6 @@ module github.com/yusing/godoxy/cmd/h2c_test_server -go 1.26.5 +go 1.27.0 require golang.org/x/net v0.58.0 diff --git a/cmd/h3bench/go.mod b/cmd/h3bench/go.mod index 47258c91..f51a9d49 100644 --- a/cmd/h3bench/go.mod +++ b/cmd/h3bench/go.mod @@ -1,6 +1,6 @@ module h3bench -go 1.26.5 +go 1.27.0 require github.com/quic-go/quic-go v0.61.0 diff --git a/cmd/tcp_echo_server/Dockerfile b/cmd/tcp_echo_server/Dockerfile index 4e6054f0..bc2f35eb 100644 --- a/cmd/tcp_echo_server/Dockerfile +++ b/cmd/tcp_echo_server/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.26.5-alpine AS builder +FROM golang:1.27.0-alpine AS builder HEALTHCHECK NONE diff --git a/go.mod b/go.mod index 0fbb58ae..0e5f04d0 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/yusing/godoxy -go 1.26.5 +go 1.27.0 replace ( github.com/coreos/go-oidc/v3 => ./internal/go-oidc @@ -16,48 +16,49 @@ 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 + github.com/docker/docker v28.5.2+incompatible + github.com/docker/go-connections v0.8.1 github.com/fsnotify/fsnotify v1.10.1 // file watcher github.com/gin-gonic/gin v1.12.0 // api server github.com/go-acme/lego/v4 v4.35.2 // acme client github.com/go-playground/validator/v10 v10.30.3 // validator github.com/gobwas/glob v0.2.3 // glob matcher for route rules + github.com/goccy/go-yaml v1.19.2 // yaml parsing for different config files + github.com/golang-jwt/jwt/v5 v5.3.1 // jwt authentication github.com/gorilla/websocket v1.5.3 // websocket for API and agent github.com/gotify/server/v2 v2.9.1 // reference the Message struct for json response github.com/lithammer/fuzzysearch v1.1.8 // fuzzy search for searching icons and filtering metrics + github.com/luthermonson/go-proxmox v0.8.1 // proxmox API client + github.com/oschwald/maxminddb-golang v1.13.1 // maxminddb for geoip database github.com/pires/go-proxyproto v0.15.0 // proxy protocol support github.com/puzpuzpuz/xsync/v4 v4.5.0 // lock free map for concurrent operations github.com/rs/zerolog v1.35.1 // logging - github.com/vincent-petithory/dataurl v1.0.0 // data url for fav icon - golang.org/x/crypto v0.55.0 // encrypting password with bcrypt - golang.org/x/net v0.58.0 // HTTP header utilities - golang.org/x/oauth2 v0.36.0 // oauth2 authentication - golang.org/x/sync v0.22.0 // errgroup and singleflight for concurrent operations - golang.org/x/time v0.15.0 // time utilities -) - -require ( - github.com/bytedance/gopkg v0.1.4 // xxhash64 for fast hash - github.com/bytedance/sonic v1.15.2 // fast json parsing - github.com/docker/cli v29.7.2+incompatible // needs docker/cli/cli/connhelper connection helper for docker client - github.com/goccy/go-yaml v1.19.2 // yaml parsing for different config files - github.com/golang-jwt/jwt/v5 v5.3.1 // jwt authentication - github.com/luthermonson/go-proxmox v0.8.1 // proxmox API client - github.com/oschwald/maxminddb-golang v1.13.1 // maxminddb for geoip database - github.com/quic-go/quic-go v0.61.0 // indirect; http3 support github.com/shirou/gopsutil/v4 v4.26.7 // system information - github.com/spf13/afero v1.15.0 // indirect github.com/stretchr/testify v1.11.1 // testing framework github.com/valyala/fasthttp v1.73.0 // fast http for health check + github.com/vincent-petithory/dataurl v1.0.0 // data url for fav icon github.com/yusing/ds v0.4.1 // data structures and algorithms github.com/yusing/godoxy/agent v0.0.0-20260815090440-878444888e37 github.com/yusing/godoxy/internal/dnsproviders v0.0.0-20260815090440-878444888e37 - github.com/yusing/gointernals v0.2.0 + github.com/yusing/gointernals v0.2.1 github.com/yusing/goutils v0.7.0 + github.com/yusing/goutils/cache v0.0.0-20260729070603-e4c7e978cbc2 github.com/yusing/goutils/http/reverseproxy v0.0.0-20260729070603-e4c7e978cbc2 github.com/yusing/goutils/http/websocket v0.0.0-20260729070603-e4c7e978cbc2 github.com/yusing/goutils/server v0.0.0-20260729070603-e4c7e978cbc2 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0 + go.uber.org/atomic v1.11.0 + golang.org/x/crypto v0.55.0 // encrypting password with bcrypt + golang.org/x/net v0.58.0 // HTTP header utilities + golang.org/x/oauth2 v0.36.0 // oauth2 authentication + golang.org/x/sync v0.22.0 // errgroup and singleflight for concurrent operations + golang.org/x/sys v0.47.0 + golang.org/x/time v0.15.0 // time utilities ) require ( @@ -70,68 +71,126 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns v1.2.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.3.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph v0.10.0 // indirect + github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.8.0 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect + github.com/akamai/AkamaiOPEN-edgegrid-golang/v13 v13.4.0 // indirect + github.com/alexbrainman/sspi v0.0.0-20250919150558-7d374ff0d59e // indirect + github.com/andybalholm/brotli v1.2.2 // indirect github.com/andybalholm/cascadia v1.3.4 // indirect github.com/benbjohnson/clock v1.3.5 // indirect + 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/buger/goterm v1.0.4 // 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 + github.com/containerd/errdefs v1.0.0 // indirect + github.com/containerd/errdefs/pkg v0.3.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/diskfs/go-diskfs v1.9.4 // indirect github.com/distribution/reference v0.6.0 // indirect github.com/djherbis/times v1.6.0 // indirect - github.com/docker/go-connections v0.8.1 github.com/docker/go-units v0.5.0 // indirect github.com/ebitengine/purego v0.10.2 // indirect + github.com/fatih/structs v1.1.0 // indirect github.com/felixge/httpsnoop v1.1.0 // indirect github.com/gabriel-vasile/mimetype v1.4.15 // indirect + github.com/gin-contrib/sse v1.1.1 // indirect github.com/go-jose/go-jose/v4 v4.1.4 // indirect github.com/go-logr/logr v1.4.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-ole/go-ole v1.3.0 // indirect + github.com/go-ozzo/ozzo-validation/v4 v4.4.1 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-resty/resty/v2 v2.17.2 // indirect + github.com/go-viper/mapstructure/v2 v2.5.0 // indirect + github.com/goccy/go-json v0.10.6 // indirect github.com/gofrs/flock v0.13.0 // indirect + github.com/google/go-querystring v1.2.0 // indirect github.com/google/s2a-go v0.1.9 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.21 // indirect github.com/googleapis/gax-go/v2 v2.23.0 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-retryablehttp v0.7.8 // indirect + github.com/hashicorp/go-uuid v1.0.3 // indirect + github.com/jcmturner/aescts/v2 v2.0.0 // indirect + github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect + github.com/jcmturner/gofork v1.7.6 // indirect + 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/jinzhu/copier v0.4.0 // indirect github.com/json-iterator/go v1.1.13-0.20220915233716-71ac16282d12 // indirect + github.com/klauspost/compress v1.19.2 // 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 + github.com/linode/linodego v1.69.1 // indirect + github.com/lufia/plan9stats v0.0.0-20260802145828-341c2f0c90b5 // indirect github.com/magefile/mage v1.17.2 // indirect github.com/mattn/go-colorable v0.1.15 // indirect github.com/mattn/go-isatty v0.0.24 // indirect github.com/miekg/dns v1.1.72 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect + github.com/moby/sys/sequential v0.6.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect + github.com/nrdcg/desec v0.11.2 // indirect github.com/nrdcg/goacmedns v0.2.0 // indirect + github.com/nrdcg/goinwx v0.12.0 // indirect + github.com/nrdcg/oci-go-sdk/common/v1065 v1065.123.1 // indirect + github.com/nrdcg/oci-go-sdk/dns/v1065 v1065.123.1 // indirect github.com/nrdcg/porkbun v0.4.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.1 // indirect + github.com/openshift/gssapi v0.0.0-20161010215902-5fb4217df13b // indirect github.com/ovh/go-ovh v1.9.0 // indirect github.com/pelletier/go-toml/v2 v2.4.3 // indirect + github.com/peterhellberg/link v1.2.0 // indirect + github.com/pion/dtls/v3 v3.1.5 // indirect + github.com/pion/logging v0.2.4 // indirect + github.com/pion/transport/v4 v4.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/power-devops/perfstat v0.0.0-20260805114148-88456608a4f6 // indirect + github.com/pquerna/otp v1.5.0 // indirect github.com/quic-go/qpack v0.6.0 // indirect + github.com/quic-go/quic-go v0.61.0 // indirect; http3 support github.com/samber/lo v1.53.0 // indirect github.com/samber/slog-common v0.22.0 // indirect github.com/samber/slog-zerolog/v2 v2.9.2 // indirect github.com/scaleway/scaleway-sdk-go v1.0.0-beta.37 // indirect github.com/sirupsen/logrus v1.10.0 // indirect + github.com/sony/gobreaker/v2 v2.4.0 // indirect + github.com/spf13/afero v1.15.0 // indirect + github.com/stretchr/objx v0.5.3 // indirect + github.com/tklauser/go-sysconf v0.4.0 // indirect + github.com/tklauser/numcpus v0.12.0 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.3.2 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/vultr/govultr/v3 v3.32.0 // indirect github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect + github.com/yusufpapurcu/wmi v1.2.4 // indirect + go.mongodb.org/mongo-driver/v2 v2.8.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0 go.opentelemetry.io/otel v1.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 // indirect go.opentelemetry.io/otel/metric v1.45.0 // indirect go.opentelemetry.io/otel/trace v1.45.0 // indirect - go.uber.org/atomic v1.11.0 + go.opentelemetry.io/proto/otlp v1.10.0 // indirect go.uber.org/ratelimit v0.3.1 // indirect + golang.org/x/arch v0.30.0 // indirect golang.org/x/mod v0.40.0 // indirect - golang.org/x/sys v0.47.0 golang.org/x/text v0.41.0 // indirect golang.org/x/tools v0.49.0 // indirect google.golang.org/api v0.293.0 // indirect @@ -142,71 +201,3 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - -require ( - github.com/docker/docker v28.5.2+incompatible - github.com/yusing/goutils/cache v0.0.0-20260729070603-e4c7e978cbc2 -) - -require ( - github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect - github.com/akamai/AkamaiOPEN-edgegrid-golang/v13 v13.4.0 // indirect - github.com/alexbrainman/sspi v0.0.0-20250919150558-7d374ff0d59e // indirect - github.com/andybalholm/brotli v1.2.2 // indirect - 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/sonic/loader v0.5.2 // indirect - github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/cloudwego/base64x v0.1.7 // indirect - github.com/containerd/errdefs v1.0.0 // indirect - github.com/containerd/errdefs/pkg v0.3.0 // indirect - github.com/fatih/structs v1.1.0 // indirect - github.com/gin-contrib/sse v1.1.1 // indirect - github.com/go-ole/go-ole v1.3.0 // indirect - github.com/go-ozzo/ozzo-validation/v4 v4.4.1 // indirect - github.com/go-resty/resty/v2 v2.17.2 // indirect - github.com/go-viper/mapstructure/v2 v2.5.0 // indirect - github.com/goccy/go-json v0.10.6 // indirect - github.com/google/go-querystring v1.2.0 // indirect - github.com/hashicorp/errwrap v1.1.0 // indirect - github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-uuid v1.0.3 // indirect - github.com/jcmturner/aescts/v2 v2.0.0 // indirect - github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect - github.com/jcmturner/gofork v1.7.6 // indirect - 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/compress v1.19.2 // indirect - github.com/klauspost/cpuid/v2 v2.4.0 // indirect - github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b // indirect - github.com/linode/linodego v1.69.1 // indirect - github.com/lufia/plan9stats v0.0.0-20260802145828-341c2f0c90b5 // indirect - github.com/moby/sys/sequential v0.6.0 // indirect - github.com/nrdcg/desec v0.11.2 // indirect - github.com/nrdcg/goinwx v0.12.0 // indirect - github.com/nrdcg/oci-go-sdk/common/v1065 v1065.123.1 // indirect - github.com/nrdcg/oci-go-sdk/dns/v1065 v1065.123.1 // indirect - github.com/openshift/gssapi v0.0.0-20161010215902-5fb4217df13b // indirect - github.com/peterhellberg/link v1.2.0 // indirect - github.com/pion/dtls/v3 v3.1.5 // indirect - github.com/pion/logging v0.2.4 // indirect - github.com/pion/transport/v4 v4.1.0 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/power-devops/perfstat v0.0.0-20260805114148-88456608a4f6 // indirect - github.com/pquerna/otp v1.5.0 // indirect - github.com/sony/gobreaker/v2 v2.4.0 // indirect - github.com/stretchr/objx v0.5.3 // indirect - github.com/tklauser/go-sysconf v0.4.0 // indirect - github.com/tklauser/numcpus v0.12.0 // indirect - github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/ugorji/go/codec v1.3.2 // indirect - github.com/valyala/bytebufferpool v1.0.0 // indirect - github.com/vultr/govultr/v3 v3.32.0 // indirect - github.com/yusufpapurcu/wmi v1.2.4 // indirect - go.mongodb.org/mongo-driver/v2 v2.8.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 // indirect - go.opentelemetry.io/proto/otlp v1.10.0 // indirect - golang.org/x/arch v0.30.0 // indirect -) diff --git a/go.sum b/go.sum index 3e384a0b..866c7919 100644 --- a/go.sum +++ b/go.sum @@ -378,8 +378,8 @@ github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfS github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusing/ds v0.4.1 h1:syMCh7hO6Yw8xfcFkEaln3W+lVeWB/U/meYv6Wf2/Ig= github.com/yusing/ds v0.4.1/go.mod h1:XhKV4l7cZwBbbl7lRzNC9zX27zvCM0frIwiuD40ULRk= -github.com/yusing/gointernals v0.2.0 h1:jyWB3kdUPkuU6s0r8QY/sS5h2WNBF4Kfisly8dtSVvg= -github.com/yusing/gointernals v0.2.0/go.mod h1:xGzNbPGMm5Z8kG0t4JYISMscw+gMQlgghkLxlgRZv5Y= +github.com/yusing/gointernals v0.2.1 h1:QlajBlRG6qbqfzjHmRq774pi+CUW/DILjFM6GjveHuM= +github.com/yusing/gointernals v0.2.1/go.mod h1:xGzNbPGMm5Z8kG0t4JYISMscw+gMQlgghkLxlgRZv5Y= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.mongodb.org/mongo-driver/v2 v2.8.0 h1:CxWDGQYY8QQwNjAl/aq2sfWakdnWZynnqJ9F4DhHbP8= diff --git a/goutils b/goutils index fb9193e4..ce24de9a 160000 --- a/goutils +++ b/goutils @@ -1 +1 @@ -Subproject commit fb9193e494e9b12698084a25f9f0070f22ad4dd0 +Subproject commit ce24de9afae3686edabc92be447d4e3a5149b649 diff --git a/internal/auth/oauth_refresh.go b/internal/auth/oauth_refresh.go index 66620fd0..22e565f5 100644 --- a/internal/auth/oauth_refresh.go +++ b/internal/auth/oauth_refresh.go @@ -112,11 +112,9 @@ func invalidateOAuthRefreshToken(sessionID sessionID) { func (auth *OIDCProvider) setSessionTokenCookie(w http.ResponseWriter, r *http.Request, session Session) { claims := &sessionClaims{ - Session: session, - RegisteredClaims: jwt.RegisteredClaims{ - Issuer: sessionTokenIssuer, - ExpiresAt: jwt.NewNumericDate(time.Now().Add(common.APIJWTTokenTTL)), - }, + Session: session, + Issuer: sessionTokenIssuer, + ExpiresAt: jwt.NewNumericDate(time.Now().Add(common.APIJWTTokenTTL)), } jwtToken := jwt.NewWithClaims(jwt.SigningMethodHS512, claims) signed, err := jwtToken.SignedString(common.APIJWTSecret) diff --git a/internal/auth/userpass.go b/internal/auth/userpass.go index 2e92ef57..fb31ee37 100644 --- a/internal/auth/userpass.go +++ b/internal/auth/userpass.go @@ -59,10 +59,8 @@ func (auth *UserPassAuth) TokenCookieName() string { func (auth *UserPassAuth) NewToken() (token string, err error) { claim := &UserPassClaims{ - Username: auth.username, - RegisteredClaims: jwt.RegisteredClaims{ - ExpiresAt: jwt.NewNumericDate(time.Now().Add(auth.tokenTTL)), - }, + Username: auth.username, + ExpiresAt: jwt.NewNumericDate(time.Now().Add(auth.tokenTTL)), } tok := jwt.NewWithClaims(jwt.SigningMethodHS512, claim) token, err = tok.SignedString(auth.secret) diff --git a/internal/dnsproviders/go.mod b/internal/dnsproviders/go.mod index db8849d2..81f9605d 100644 --- a/internal/dnsproviders/go.mod +++ b/internal/dnsproviders/go.mod @@ -1,6 +1,6 @@ module github.com/yusing/godoxy/internal/dnsproviders -go 1.26.5 +go 1.27.0 replace github.com/yusing/godoxy => ../.. @@ -99,7 +99,7 @@ require ( 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.0 // indirect + github.com/yusing/gointernals v0.2.1 // indirect github.com/yusing/goutils v0.7.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0 // indirect diff --git a/internal/dnsproviders/go.sum b/internal/dnsproviders/go.sum index 0cfbb92f..1f04eeb4 100644 --- a/internal/dnsproviders/go.sum +++ b/internal/dnsproviders/go.sum @@ -1,5 +1,3 @@ -cloud.google.com/go/auth v0.22.0 h1:Xp9wAKkLoeaYb5pYZZoQGz4E9sdPxIbzS3gywZE3ciQ= -cloud.google.com/go/auth v0.22.0/go.mod h1:M9o2Oz+YI2jAfxewJgb1vyI3vceHF+eohmxyzmrl+9s= cloud.google.com/go/auth v0.23.1 h1:1tPpBPG02lQHmoiAvs9egyCASqXP0xgobptjZzov/Jg= cloud.google.com/go/auth v0.23.1/go.mod h1:4DhBRcqvtljQN3dJ57qtqbib5ZGCYE5f2crfiiC2EM0= cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc= @@ -7,8 +5,6 @@ cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3R cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.22.0 h1:aokoqcHvaGjiM3VpjKDfMMnF/8epJ+Q1HLJ7CudztqE= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.22.0/go.mod h1:/WYEx9pcM9Y+Dd/APJaNlSvVSvzl54rrMdZT5+Oi2LM= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.0 h1:4gRPBpN1f6xt88yi4WR26m7XaD9OlWtVT6bWPdGUIok= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.23.0/go.mod h1:G7QVLxw1j1JVyrO1MA95S8m8HStaaleDZYTcfGgjB2o= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.14.0 h1:CU4+EJeJi3TKYWEcYuSdWsjzw0nVsK/H0MSQOiPcymU= @@ -29,17 +25,12 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1. github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0/go.mod h1:5kakwfW5CjC9KK+Q4wjXAg+ShuIm2mBMua0ZFj2C8PE= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= -github.com/AzureAD/microsoft-authentication-library-for-go v1.7.2 h1:RHK7bS+HQMslb1sZpAokUt+zTVmue0hKSs2C791hhzU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.7.2/go.mod h1:HKpQxkWaGLJ+D/5H8QRpyQXA1eKjxkFlOMwck5+33Jk= github.com/AzureAD/microsoft-authentication-library-for-go v1.8.0 h1:Nljr4q1GRA/5vCrMONS+g4u4LRHNgOXVSh3O43J2CnI= github.com/AzureAD/microsoft-authentication-library-for-go v1.8.0/go.mod h1:Y33QHnf0FfdVewFFISOGe20mkZbxX4H839o955/PoeI= -github.com/akamai/AkamaiOPEN-edgegrid-golang/v13 v13.3.0 h1:1BOa2yVTnPTyGO14yvcsVCoIJKhbOFTsetZM0V9I5yo= -github.com/akamai/AkamaiOPEN-edgegrid-golang/v13 v13.3.0/go.mod h1:1LcshixfhGMwsr+gg+vSHe2P046/L/kCYluPWKrAC3I= github.com/akamai/AkamaiOPEN-edgegrid-golang/v13 v13.4.0 h1:oLqV1HbQrojeWkpI9aFI1SYJ53x8L12eqwcDHxmWrrE= github.com/akamai/AkamaiOPEN-edgegrid-golang/v13 v13.4.0/go.mod h1:l2ajjow2JNoL6HjejeHmkdMEm98uL4MveXwb9Z3FoNk= github.com/alexbrainman/sspi v0.0.0-20250919150558-7d374ff0d59e h1:4dAU9FXIyQktpoUAgOJK3OTFc/xug0PCXYCqU0FgDKI= github.com/alexbrainman/sspi v0.0.0-20250919150558-7d374ff0d59e/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4= -github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= @@ -56,8 +47,6 @@ 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.1 h1:Ygpfa9zwRCCKSlrp5bBP/b/Xzc3VxsAW+5NIYXrOOpI= -github.com/bytedance/sonic/loader v0.5.1/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo= 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= @@ -76,8 +65,6 @@ github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc= github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE= -github.com/gabriel-vasile/mimetype v1.4.14 h1:8eyElddS5wbWNDG4sIupw+IX2jEjHX2aqAAq/9C3M8s= -github.com/gabriel-vasile/mimetype v1.4.14/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= github.com/gabriel-vasile/mimetype v1.4.15 h1:05iP/CYtZ/w455R/KZM6rZ5ieAdh99UPtd+d3YzLmaI= github.com/gabriel-vasile/mimetype v1.4.15/go.mod h1:azpTcoLcDZRNgFou5j+APrqQx9HqVPWa6ijYQIIVswQ= github.com/go-acme/lego/v4 v4.35.2 h1:uVQg+KC/yj9R2g7Q9W5wDqhvQvxV5SMu5eqFVoN5xZU= @@ -89,8 +76,6 @@ github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-ozzo/ozzo-validation/v4 v4.3.0 h1:byhDUpfEwjsVQb1vBunvIjh2BHQ9ead57VkAEY4V+Es= -github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRiTzuqKbvfrL2RxCj6Ew= github.com/go-ozzo/ozzo-validation/v4 v4.4.1 h1:AQ3X8zHnXEuNE04pyc1H/nmIlroNjgZ7hcY7Xv/IgH8= github.com/go-ozzo/ozzo-validation/v4 v4.4.1/go.mod h1:4ZtPNefSnNq39wjL+2We8y2ysqEX/S4D5mPybufHd7Y= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= @@ -122,8 +107,6 @@ github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0= github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.3.18 h1:hvVi34VucdrV1IIsiWuqYM8kutw/92MxNEFxCJZEh0k= -github.com/googleapis/enterprise-certificate-proxy v0.3.18/go.mod h1:rSEsBUemEBZEexP2y6jPp16LUmUbjmSbcPMQizR0o4k= github.com/googleapis/enterprise-certificate-proxy v0.3.21 h1:OFdQ3tnCX/zaQ0Cedur3D3z7kI6HiLX9g3TiAN4/DFU= github.com/googleapis/enterprise-certificate-proxy v0.3.21/go.mod h1:L3D/IQExI6LqEjBdXcZQ1WluSgigQmSwBboFstVPM4w= github.com/googleapis/gax-go/v2 v2.23.0 h1:Tchl7qkvE7Ip3y+ztvNufYFvkfqTe7NfLTYGIdJRLuE= @@ -180,8 +163,6 @@ github.com/linode/linodego v1.69.1 h1:f45N2MHR/oece2/ktTTCYmrlfse4//k3NgwcF5zbGZ github.com/linode/linodego v1.69.1/go.mod h1:Fha0NYsQSx5VZK1HQNJY/z/dIxxkFp+vb5veawbmAUw= github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY= github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= -github.com/mattn/go-isatty v0.0.23 h1:cYwCQTQf3HB6xUC+BtyCLZNr7IzbOmoZbmssVNzSyiQ= -github.com/mattn/go-isatty v0.0.23/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A= github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI= github.com/mattn/go-isatty v0.0.24/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A= github.com/maxatome/go-testdeep v1.14.0 h1:rRlLv1+kI8eOI3OaBXZwb3O7xY3exRzdW5QyX48g9wI= @@ -196,12 +177,8 @@ github.com/nrdcg/goacmedns v0.2.0 h1:ADMbThobzEMnr6kg2ohs4KGa3LFqmgiBA22/6jUWJR0 github.com/nrdcg/goacmedns v0.2.0/go.mod h1:T5o6+xvSLrQpugmwHvrSNkzWht0UGAwj2ACBMhh73Cg= github.com/nrdcg/goinwx v0.12.0 h1:ujdUqDBnaRSFwzVnImvPHYw3w3m9XgmGImNUw1GyMb4= github.com/nrdcg/goinwx v0.12.0/go.mod h1:IrVKd3ZDbFiMjdPgML4CSxZAY9wOoqLvH44zv3NodJ0= -github.com/nrdcg/oci-go-sdk/common/v1065 v1065.121.1 h1:lBL4VJ3TA7CAiUviwv8WCAKTW1wg6GRJCx/C8Lksf/k= -github.com/nrdcg/oci-go-sdk/common/v1065 v1065.121.1/go.mod h1:AfU68xUvqP5fC8MKk5S/tVXHO7G8eOliYhzBQ4sYhck= github.com/nrdcg/oci-go-sdk/common/v1065 v1065.123.1 h1:E+hv6CAQHCFOBANToJlJlserSikS67NpynomTBgulsM= github.com/nrdcg/oci-go-sdk/common/v1065 v1065.123.1/go.mod h1:AfU68xUvqP5fC8MKk5S/tVXHO7G8eOliYhzBQ4sYhck= -github.com/nrdcg/oci-go-sdk/dns/v1065 v1065.121.1 h1:rBYZ9sp2PrQjinBuuoMjdBD9I7lsiG7IrdN1bAisxMs= -github.com/nrdcg/oci-go-sdk/dns/v1065 v1065.121.1/go.mod h1:/lhbkUFZuNqBQgrMBEukASQIhVPWno/QY7SFnaY+aGc= github.com/nrdcg/oci-go-sdk/dns/v1065 v1065.123.1 h1:rYmvcq9m1AYUuUxMUL9uLoYln9UBPY5Il5C0o/iyAGs= github.com/nrdcg/oci-go-sdk/dns/v1065 v1065.123.1/go.mod h1:1JDXcfLhnF8cPo/4P/ZVA8sKcAwGwutrX5bnZ8g90UQ= github.com/nrdcg/porkbun v0.4.0 h1:rWweKlwo1PToQ3H+tEO9gPRW0wzzgmI/Ob3n2Guticw= @@ -225,11 +202,8 @@ github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0t github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/rs/zerolog v1.35.1 h1:m7xQeoiLIiV0BCEY4Hs+j2NG4Gp2o2KPKmhnnLiazKI= github.com/rs/zerolog v1.35.1/go.mod h1:EjML9kdfa/RMA7h/6z6pYmq1ykOuA8/mjWaEvGI+jcw= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.36 h1:ObX9hZmK+VmijreZO/8x9pQ8/P/ToHD/bdSb4Eg4tUo= -github.com/scaleway/scaleway-sdk-go v1.0.0-beta.36/go.mod h1:LEsDu4BubxK7/cWhtlQWfuxwL4rf/2UEpxXz1o1EMtM= github.com/scaleway/scaleway-sdk-go v1.0.0-beta.37 h1:1Q6K8D0BagYYEnCTkT9fn3YHUFb06bS1OvIHWcc3JQM= github.com/scaleway/scaleway-sdk-go v1.0.0-beta.37/go.mod h1:Rtb4r3WZ5x4AqmL3t/wiF/DmQi+7GlU/nCRdqFbClV4= -github.com/sony/gobreaker v1.0.0 h1:feX5fGGXSl3dYd4aHZItw+FpHLvvoaqkawKjVNiFMNQ= github.com/sony/gobreaker/v2 v2.4.0 h1:g2KJRW1Ubty3+ZOcSEUN7K+REQJdN6yo6XvaML+jptg= github.com/sony/gobreaker/v2 v2.4.0/go.mod h1:pTyFJgcZ3h2tdQVLZZruK2C0eoFL1fb/G83wK1ZQl+s= github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I= @@ -256,50 +230,36 @@ github.com/vultr/govultr/v3 v3.32.0/go.mod h1:2zyUw9yADQaGwKnwDesmIOlBNLrm7edsCf github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM= github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yusing/gointernals v0.2.0 h1:jyWB3kdUPkuU6s0r8QY/sS5h2WNBF4Kfisly8dtSVvg= -github.com/yusing/gointernals v0.2.0/go.mod h1:xGzNbPGMm5Z8kG0t4JYISMscw+gMQlgghkLxlgRZv5Y= +github.com/yusing/gointernals v0.2.1 h1:QlajBlRG6qbqfzjHmRq774pi+CUW/DILjFM6GjveHuM= +github.com/yusing/gointernals v0.2.1/go.mod h1:xGzNbPGMm5Z8kG0t4JYISMscw+gMQlgghkLxlgRZv5Y= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 h1:yI1/OhfEPy7J9eoa6Sj051C7n5dvpj0QX8g4sRchg04= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0/go.mod h1:NoUCKYWK+3ecatC4HjkRktREheMeEtrXoQxrqYFeHSc= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0 h1:8tvICD4vSTOOsNrsI4Ljf6C+6UKvpTEH5XY3JMoyPoo= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0/go.mod h1:z9+yiacE0IHRqM4qFfkbt/JYlmYXgss8GY/jXoNuPJI= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0 h1:LMuyCAyfalSjDyjdC65nK6N0zoTT63+E/u95X0JovZI= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0/go.mod h1:085m8qbm4hgc8rZWGDEa4vmyyo2c3nPxUslYUKUIU04= -go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU= -go.opentelemetry.io/otel v1.44.0/go.mod h1:BMgjTHL9WPRlRjL2oZCBTL4whCGtXch2H4BhOPIAyYc= go.opentelemetry.io/otel v1.45.0 h1:pdrWmLHofpubmArBv1LgFSv1Z0Ie/ppdZzu+kUN5EeU= go.opentelemetry.io/otel v1.45.0/go.mod h1:XZxIqPapzEYnhNSScF5DIqXhm/rYi0FzCe2XddAwZfQ= -go.opentelemetry.io/otel/metric v1.44.0 h1:1w0gILTcHdr3YI+ixLyjemwrVnsMURbTZFrSYCdDdmc= -go.opentelemetry.io/otel/metric v1.44.0/go.mod h1:8O7hanEPBNgEMmybD3s2VBKcgWOCsA6tzHBPODAiquo= go.opentelemetry.io/otel/metric v1.45.0 h1:7Eg1uH7CJ5cXv9is6tnBe1FI6rj1nwUdbFypRm3br/M= go.opentelemetry.io/otel/metric v1.45.0/go.mod h1:HAPbm1nd3p1PmFH7v2dR+6BjXxw+Lq4a2+pndMAm08s= -go.opentelemetry.io/otel/sdk v1.44.0 h1:nHYwb9lK+fJPU/dnT6s7W7Z8itMWyqrnVfbheVYrZ58= -go.opentelemetry.io/otel/sdk v1.44.0/go.mod h1:Osuydd3Se74nqjAKxid74N5eC+jfEqfTegHRnq58oK0= -go.opentelemetry.io/otel/sdk/metric v1.44.0 h1:3LlKgI+VjbVsjNRFZJZAJ30WjXC5VkNRks6si09iEfI= -go.opentelemetry.io/otel/sdk/metric v1.44.0/go.mod h1:5B5pMARnXxKhltooO4xUuCBorl65a4EpnTalObqOigA= -go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk= -go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE= +go.opentelemetry.io/otel/sdk v1.45.0 h1:4VVSMgQ83dUgW2aoX5f6JgLvHwIvzcuLnF9lUdCSpCw= +go.opentelemetry.io/otel/sdk v1.45.0/go.mod h1:Sr40LgXV7DsKMMJMKOhUWOgMWTfAaqvm2kF0g7ilwuA= +go.opentelemetry.io/otel/sdk/metric v1.45.0 h1:oVFszMfyj1Am6s24Vtc7wBb8BKLcwepJjNEYILuiE3o= +go.opentelemetry.io/otel/sdk/metric v1.45.0/go.mod h1:vUWUxDZvu1WVRj8JA8S0AdhsPrZoDpA2DdZauIh4mDA= go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOyVhxag= go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc= 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.29.0 h1:8sSET5wB0+exBm0FGmOtdHMqjlRdV2DRD3/IV6OZgho= -golang.org/x/arch v0.29.0/go.mod h1:0X+GdSIP+kL5wPmpK7sdkEVTt2XoYP0cSjQSbZBwOi8= 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= -golang.org/x/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw= -golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk= golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M= golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk= -golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40= golang.org/x/mod v0.40.0 h1:hUv+3cXcdRHz08UmSiOob7sadHig73uo5bkXxQ/tvUs= golang.org/x/mod v0.40.0/go.mod h1:0/weTWkPWGBikyTWAX3dkjVztMmBA5hM0DH6BElSupE= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -308,8 +268,6 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= -golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= @@ -334,8 +292,6 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= -golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8= golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= @@ -343,31 +299,21 @@ golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.48.0 h1:3+hClM1aLL5mjMKm5ovokw9epgRXPuu2tILgismM6RE= -golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk= golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI= golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= -google.golang.org/api v0.290.0 h1:eMw0Xo+IfbbMlKmW7aHvpyQRv9RCXuWx/vs8AD+0x9A= -google.golang.org/api v0.290.0/go.mod h1:weJZ3lldHFYI0DBFNKpJelUDNnusTt5YaOEgxvt8ci8= google.golang.org/api v0.293.0 h1:p9XIWOf63U4OgYx120ZwVU8+vl4XTPmWfgVPnmOAS9w= google.golang.org/api v0.293.0/go.mod h1:6n5tjEB1gzwniZTepZ0g5u+wM7Bof5GeULCx/zh8ZE0= google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 h1:XzmzkmB14QhVhgnawEVsOn6OFsnpyxNPRY9QV01dNB0= google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7/go.mod h1:L43LFes82YgSonw6iTXTxXUX1OlULt4AQtkik4ULL/I= google.golang.org/genproto/googleapis/api v0.0.0-20260630182238-925bb5da69e7 h1:jQ9p21COKWjP3VwuFrNRiiOTMh3mPpN45R7SLrH/HUU= google.golang.org/genproto/googleapis/api v0.0.0-20260630182238-925bb5da69e7/go.mod h1:KqHwBx2upmfa1XSi1WuRvC+2VGCLtooKkfmyvRbUmqA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260720211330-0afa2a65878a h1:qI/YMH1ep2qQtqcp00gMQyoU7mjvbhg88GJKCvfoLj0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260720211330-0afa2a65878a/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= google.golang.org/genproto/googleapis/rpc v0.0.0-20260810153831-ec0a7760b754 h1:k5CJw9e5ONCcA/u0webKt092npXuY+KeGh3Q8NAVf0g= google.golang.org/genproto/googleapis/rpc v0.0.0-20260810153831-ec0a7760b754/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= -google.golang.org/grpc v1.82.1 h1:NnAxzGRA0677vCa4BUkOAnO5+FfQqVl9iUXeD0IqcGE= -google.golang.org/grpc v1.82.1/go.mod h1:yzTZ1TB1Z3SG+LIYaI+WiE8D5+PZ3ArnrSp8zF3+/ZA= google.golang.org/grpc v1.83.0 h1:JeNZEKJFbQxArAMl+hiytHauacDNqJUllNfmIMmpqnQ= google.golang.org/grpc v1.83.0/go.mod h1:kDyl6SKsiHKt0uylY5gtn5cEjkrIOhQOGDgIc4JGwzQ= -google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= -google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/homepage/icons/list/list_icons.go b/internal/homepage/icons/list/list_icons.go index 9d1f546f..ace96153 100644 --- a/internal/homepage/icons/list/list_icons.go +++ b/internal/homepage/icons/list/list_icons.go @@ -153,8 +153,8 @@ func parseKeyword(keyword string) (icons.Source, string) { default: return "", keyword } - if dot := strings.LastIndexByte(ref, '.'); dot != -1 && isExtensionPrefix(ref[dot+1:]) { - ref = ref[:dot] + if name, extension, ok := strings.CutLast(ref, "."); ok && isExtensionPrefix(extension) { + ref = name } for _, variant := range []string{"-light", "-dark"} { if strutils.HasSuffixFold(ref, variant) { diff --git a/internal/homepage/icons/list/resolve.go b/internal/homepage/icons/list/resolve.go index d8b71504..0e542860 100644 --- a/internal/homepage/icons/list/resolve.go +++ b/internal/homepage/icons/list/resolve.go @@ -38,11 +38,11 @@ func ExpandRefs(refs []string) []string { ref = sanitizeRef(ref) add(ref) for { - dash := strings.LastIndexByte(ref, '-') - if dash <= 0 { + prefix, _, ok := strings.CutLast(ref, "-") + if !ok || prefix == "" { break } - ref = ref[:dash] + ref = prefix add(ref) } } diff --git a/socket-proxy/go.mod b/socket-proxy/go.mod index ae46633d..94955974 100644 --- a/socket-proxy/go.mod +++ b/socket-proxy/go.mod @@ -1,6 +1,6 @@ module github.com/yusing/godoxy/socketproxy -go 1.26.5 +go 1.27.0 replace github.com/yusing/goutils => ../goutils From 649942ffbcbc690aac6b893ae30016112d81de62 Mon Sep 17 00:00:00 2001 From: yusing Date: Thu, 20 Aug 2026 15:18:38 +0800 Subject: [PATCH 2/3] chore(go): apply Go 1.27 code modernizations Replace manual reverse loops and errors.As patterns with newer standard-library APIs, and flatten composite literals to initialize promoted fields directly. --- internal/api/v1/agent/verify_test.go | 8 +- internal/autocert/sni_matcher.go | 11 +-- internal/config/events_test.go | 8 +- internal/config/state.go | 8 +- internal/config/state_diagnostics_test.go | 5 +- internal/config/types/lifecycle_test.go | 8 +- internal/entrypoint/query.go | 16 ++-- internal/health/monitor/docker_test.go | 30 ++++---- internal/homepage/homepage_test.go | 60 ++++++--------- internal/homepage/icons/fetch/fetch.go | 4 +- .../homepage/icons/list/list_icons_test.go | 76 ++++++++----------- internal/idlewatcher/handle_http_debug.go | 6 +- internal/idlewatcher/handle_http_test.go | 14 ++-- internal/idlewatcher/health_test.go | 8 +- internal/idlewatcher/watcher.go | 6 +- .../idlewatcher/watcher_dependencies_test.go | 18 ++--- internal/logging/accesslog/config.go | 10 +-- internal/logging/accesslog/rotate.go | 5 +- internal/logging/accesslog/rotate_test.go | 36 +++------ internal/maxmind/maxmind.go | 3 +- .../net/gphttp/loadbalancer/server_test.go | 4 +- internal/notif/config_test.go | 28 +++---- internal/route/provider/docker.go | 12 +-- internal/route/provider/event_handler_test.go | 8 +- internal/route/route_test.go | 26 +++---- internal/routeimpl/fileserver_test.go | 8 +- internal/routeimpl/reverse_proxy.go | 4 +- internal/routeimpl/stream_test.go | 12 +-- internal/routeimpl/webui_smoke_test.go | 22 +++--- internal/routevalidate/finalize_test.go | 26 +++---- internal/routevalidate/proxmox_test.go | 8 +- internal/serialization/serialization.go | 3 +- 32 files changed, 199 insertions(+), 302 deletions(-) diff --git a/internal/api/v1/agent/verify_test.go b/internal/api/v1/agent/verify_test.go index c1202f19..ca8c6249 100644 --- a/internal/api/v1/agent/verify_test.go +++ b/internal/api/v1/agent/verify_test.go @@ -137,11 +137,9 @@ func TestVerifyReturnsManagedResponseAndSkipsConfigPersistence(t *testing.T) { listAgentsFunc = func(context.Context) []*agent.AgentConfig { return []*agent.AgentConfig{ { - AgentInfo: agent.AgentInfo{ - Name: "agent-1", - Runtime: agent.ContainerRuntimeDocker, - }, - Addr: "10.0.0.1:8890", + Name: "agent-1", + Runtime: agent.ContainerRuntimeDocker, + Addr: "10.0.0.1:8890", }, } } diff --git a/internal/autocert/sni_matcher.go b/internal/autocert/sni_matcher.go index 022a0ddf..57af6a93 100644 --- a/internal/autocert/sni_matcher.go +++ b/internal/autocert/sni_matcher.go @@ -2,6 +2,7 @@ package autocert import ( "crypto/x509" + "slices" "strings" ) @@ -36,11 +37,11 @@ func (m *sniMatcher) matchSuffixTree(serverName string) *Provider { labels := strings.Split(serverName, ".") var best *Provider - for i := len(labels) - 1; i >= 0; i-- { + for i, label := range slices.Backward(labels) { if n.children == nil { break } - next := n.children[labels[i]] + next := n.children[label] if next == nil { break } @@ -116,14 +117,14 @@ func (m *sniMatcher) insertWildcardSuffix(suffix string, p *Provider) { } n := &m.root labels := strings.Split(suffix, ".") - for i := len(labels) - 1; i >= 0; i-- { + for _, label := range slices.Backward(labels) { if n.children == nil { n.children = make(map[string]*sniTreeNode) } - next := n.children[labels[i]] + next := n.children[label] if next == nil { next = &sniTreeNode{} - n.children[labels[i]] = next + n.children[label] = next } n = next } diff --git a/internal/config/events_test.go b/internal/config/events_test.go index 58dfafda..18ba23df 100644 --- a/internal/config/events_test.go +++ b/internal/config/events_test.go @@ -127,11 +127,9 @@ func newNotificationTestState(t *testing.T, url string) *state { { ProviderName: notif.ProviderWebhook, Provider: ¬if.Webhook{ - ProviderBase: notif.ProviderBase{ - Name: "test", - URL: url, - Format: notif.LogFormatPlain, - }, + Name: "test", + URL: url, + Format: notif.LogFormatPlain, Payload: "$message", Method: http.MethodPost, MIMEType: notif.MimeTypeText, diff --git a/internal/config/state.go b/internal/config/state.go index fa6286a4..c39b2372 100644 --- a/internal/config/state.go +++ b/internal/config/state.go @@ -874,11 +874,9 @@ func (state *state) newWebUIRoute() (*routeimpl.Route, error) { Homepage: &homepage.ItemConfig{ Show: false, }, - Metadata: routeimpl.Metadata{ - Provider: "webui", - RootFS: webui.Dist(), - ForceConflictWin: true, - }, + Provider: "webui", + RootFS: webui.Dist(), + ForceConflictWin: true, InboundMTLSProfile: state.WebUI.InboundMTLSProfile, Middlewares: state.WebUI.Middlewares, AccessLog: state.WebUI.AccessLog, diff --git a/internal/config/state_diagnostics_test.go b/internal/config/state_diagnostics_test.go index ba062a89..d03930b1 100644 --- a/internal/config/state_diagnostics_test.go +++ b/internal/config/state_diagnostics_test.go @@ -133,11 +133,10 @@ func TestStartupDiagnosticsAllowlist(t *testing.T) { } state.Config.Providers.Notification = []*notif.NotificationConfig{{ ProviderName: notif.ProviderWebhook, - Provider: ¬if.Webhook{ProviderBase: notif.ProviderBase{ + Provider: ¬if.Webhook{ Name: "operations", URL: "https://notifications.example.com", - Token: notificationToken, - }}, + Token: notificationToken}, }} const providerName = "password-reset-token-service" diff --git a/internal/config/types/lifecycle_test.go b/internal/config/types/lifecycle_test.go index 0b233266..4352f2f9 100644 --- a/internal/config/types/lifecycle_test.go +++ b/internal/config/types/lifecycle_test.go @@ -25,11 +25,9 @@ func TestLifecycleErrorsNeedNoCustomJSONMarshalers(t *testing.T) { Severity: IssueDegraded, Err: gperr.Wrap(sentinel), }}, - ActivationReport: ActivationReport{ - Metrics: ComponentActivation{ - Configured: true, - Err: gperr.Wrap(sentinel), - }, + Metrics: ComponentActivation{ + Configured: true, + Err: gperr.Wrap(sentinel), }, } diff --git a/internal/entrypoint/query.go b/internal/entrypoint/query.go index 86accc36..7f43cea5 100644 --- a/internal/entrypoint/query.go +++ b/internal/entrypoint/query.go @@ -56,20 +56,16 @@ func getHealthInfo(r routing.Route) health.HealthInfo { mon := r.HealthMonitor() if mon == nil { return health.HealthInfo{ - HealthInfoWithoutDetail: health.HealthInfoWithoutDetail{ - Status: health.StatusUnknown, - }, + Status: health.StatusUnknown, Detail: "n/a", } } return health.HealthInfo{ - HealthInfoWithoutDetail: health.HealthInfoWithoutDetail{ - Status: mon.Status(), - Uptime: mon.Uptime(), - Latency: mon.Latency(), - SleepIn: sleepIn(mon), - }, - Detail: mon.Detail(), + Status: mon.Status(), + Uptime: mon.Uptime(), + Latency: mon.Latency(), + SleepIn: sleepIn(mon), + Detail: mon.Detail(), } } diff --git a/internal/health/monitor/docker_test.go b/internal/health/monitor/docker_test.go index 2a1b631d..40ea2d76 100644 --- a/internal/health/monitor/docker_test.go +++ b/internal/health/monitor/docker_test.go @@ -161,16 +161,14 @@ func TestNewMonitorDoesNotProbeWhenDockerClientInitializationFails(t *testing.T) Alias: "test", Scheme: route.SchemeHTTP, HealthCheck: testHealthConfig(disabled), - Metadata: route.Metadata{ - ProxyURL: targetURL, - Container: &docker.Container{ - ContainerID: "test", - HealthCheckEnabled: true, - DockerCfg: types.DockerProviderConfig{ - URL: "https://127.0.0.1:2376", - }, - Running: true, + ProxyURL: targetURL, + Container: &docker.Container{ + ContainerID: "test", + HealthCheckEnabled: true, + DockerCfg: types.DockerProviderConfig{ + URL: "https://127.0.0.1:2376", }, + Running: true, }, } reverseProxyRoute, err := routeimpl.NewReverseProxyRoute(base) @@ -199,15 +197,13 @@ func TestNewMonitorSkipsDockerWhenHealthCheckWasNotEnabledAtLoad(t *testing.T) { Alias: "test", Scheme: route.SchemeHTTP, HealthCheck: testHealthConfig(false), - Metadata: route.Metadata{ - ProxyURL: targetURL, - Container: &docker.Container{ - ContainerID: "test", - DockerCfg: types.DockerProviderConfig{ - URL: "https://127.0.0.1:2376", - }, - Running: true, + ProxyURL: targetURL, + Container: &docker.Container{ + ContainerID: "test", + DockerCfg: types.DockerProviderConfig{ + URL: "https://127.0.0.1:2376", }, + Running: true, }, } reverseProxyRoute, err := routeimpl.NewReverseProxyRoute(base) diff --git a/internal/homepage/homepage_test.go b/internal/homepage/homepage_test.go index fc762885..c38ac397 100644 --- a/internal/homepage/homepage_test.go +++ b/internal/homepage/homepage_test.go @@ -12,15 +12,13 @@ import ( func TestOverrideItem(t *testing.T) { a := &Item{ Alias: "foo", - ItemConfig: ItemConfig{ - Show: false, - Name: "Foo", - Icon: &icons.URL{ - FullURL: new("/favicon.ico"), - Source: icons.SourceRelative, - }, - Category: "App", + Show: false, + Name: "Foo", + Icon: &icons.URL{ + FullURL: new("/favicon.ico"), + Source: icons.SourceRelative, }, + Category: "App", } want := ItemConfig{ Show: true, @@ -44,11 +42,9 @@ func TestOverrideItem(t *testing.T) { func TestOverrideItem_PreservesURL(t *testing.T) { a := &Item{ Alias: "svc", - ItemConfig: ItemConfig{ - Show: true, - Name: "Service", - URL: "http://origin.local", - }, + Show: true, + Name: "Service", + URL: "http://origin.local", } wantCfg := ItemConfig{ Show: true, @@ -66,13 +62,11 @@ func TestOverrideItem_PreservesURL(t *testing.T) { func TestVisibilityFavoriteAndSortOrders(t *testing.T) { a := &Item{ - Alias: "alpha", - ItemConfig: ItemConfig{ - Show: true, - Name: "Alpha", - Category: "Apps", - Favorite: false, - }, + Alias: "alpha", + Show: true, + Name: "Alpha", + Category: "Apps", + Favorite: false, } overrides := GetOverrideConfig() overrides.Initialize() @@ -93,10 +87,8 @@ func TestVisibilityFavoriteAndSortOrders(t *testing.T) { func TestCategoryDefaultedWhenEmpty(t *testing.T) { a := &Item{ Alias: "no-cat", - ItemConfig: ItemConfig{ - Show: true, - Name: "NoCat", - }, + Show: true, + Name: "NoCat", } got := a.GetOverride() expect.Equal(t, got.Category, CategoryOthers) @@ -104,20 +96,16 @@ func TestCategoryDefaultedWhenEmpty(t *testing.T) { func TestOverrideItems_Bulk(t *testing.T) { a := &Item{ - Alias: "bulk-1", - ItemConfig: ItemConfig{ - Show: true, - Name: "Bulk1", - Category: "X", - }, + Alias: "bulk-1", + Show: true, + Name: "Bulk1", + Category: "X", } b := &Item{ - Alias: "bulk-2", - ItemConfig: ItemConfig{ - Show: true, - Name: "Bulk2", - Category: "Y", - }, + Alias: "bulk-2", + Show: true, + Name: "Bulk2", + Category: "Y", } overrides := GetOverrideConfig() diff --git a/internal/homepage/icons/fetch/fetch.go b/internal/homepage/icons/fetch/fetch.go index b09feef3..e6dfa929 100644 --- a/internal/homepage/icons/fetch/fetch.go +++ b/internal/homepage/icons/fetch/fetch.go @@ -131,8 +131,8 @@ var FetchIconAbsolute = cache.NewKeyFunc(func(ctx context.Context, url string) ( } } - res := Result{Icon: icon} - res.contentType = ct + res := Result{Icon: icon, + contentType: ct} // else leave it empty return res, nil }).WithMaxEntries(200).WithRetriesExponentialBackoff(3).WithTTL(4 * time.Hour).Build() diff --git a/internal/homepage/icons/list/list_icons_test.go b/internal/homepage/icons/list/list_icons_test.go index 58085ac6..dcc185c1 100644 --- a/internal/homepage/icons/list/list_icons_test.go +++ b/internal/homepage/icons/list/list_icons_test.go @@ -109,29 +109,23 @@ func TestListWalkxCodeIcons(t *testing.T) { } test := []testCases{ { - Key: NewKey(SourceWalkXCode, "app1"), - Meta: Meta{ - SVG: true, - PNG: true, - WebP: true, - Light: true, - }, + Key: NewKey(SourceWalkXCode, "app1"), + SVG: true, + PNG: true, + WebP: true, + Light: true, }, { - Key: NewKey(SourceWalkXCode, "app2"), - Meta: Meta{ - PNG: true, - WebP: true, - }, + Key: NewKey(SourceWalkXCode, "app2"), + PNG: true, + WebP: true, }, { - Key: NewKey(SourceWalkXCode, "karakeep"), - Meta: Meta{ - SVG: true, - PNG: true, - WebP: true, - Dark: true, - }, + Key: NewKey(SourceWalkXCode, "karakeep"), + SVG: true, + PNG: true, + WebP: true, + Dark: true, }, } runTests(t, m, test) @@ -148,35 +142,29 @@ func TestListSelfhstIcons(t *testing.T) { } test := []testCases{ { - Key: NewKey(SourceSelfhSt, "2fauth"), - Meta: Meta{ - SVG: true, - PNG: true, - WebP: true, - Light: true, - Dark: true, - DisplayName: "2FAuth", - }, + Key: NewKey(SourceSelfhSt, "2fauth"), + SVG: true, + PNG: true, + WebP: true, + Light: true, + Dark: true, + DisplayName: "2FAuth", }, { - Key: NewKey(SourceSelfhSt, "dittofeed"), - Meta: Meta{ - PNG: true, - WebP: true, - DisplayName: "Dittofeed", - }, + Key: NewKey(SourceSelfhSt, "dittofeed"), + PNG: true, + WebP: true, + DisplayName: "Dittofeed", }, { - Key: NewKey(SourceSelfhSt, "ars-technica"), - Meta: Meta{ - SVG: true, - PNG: true, - WebP: true, - Light: true, - Dark: true, - DisplayName: "Ars Technica", - Tag: "News", - }, + Key: NewKey(SourceSelfhSt, "ars-technica"), + SVG: true, + PNG: true, + WebP: true, + Light: true, + Dark: true, + DisplayName: "Ars Technica", + Tag: "News", }, } runTests(t, m, test) diff --git a/internal/idlewatcher/handle_http_debug.go b/internal/idlewatcher/handle_http_debug.go index 1603aeba..8f7c2b41 100644 --- a/internal/idlewatcher/handle_http_debug.go +++ b/internal/idlewatcher/handle_http_debug.go @@ -15,10 +15,8 @@ func DebugHandler(rw http.ResponseWriter, r *http.Request) { w := &Watcher{ events: gevents.NewHistory(), cfg: &idlewatcher.Config{ - IdlewatcherProviderConfig: idlewatcher.ProviderConfig{ - Docker: &idlewatcher.DockerConfig{ - ContainerName: "test", - }, + Docker: &idlewatcher.DockerConfig{ + ContainerName: "test", }, }, } diff --git a/internal/idlewatcher/handle_http_test.go b/internal/idlewatcher/handle_http_test.go index 511ebd79..6c0629df 100644 --- a/internal/idlewatcher/handle_http_test.go +++ b/internal/idlewatcher/handle_http_test.go @@ -817,16 +817,12 @@ func newTestWatcher(t *testing.T) *Watcher { w := &Watcher{ cfg: &idlewatchertypes.Config{ - IdlewatcherProviderConfig: idlewatchertypes.ProviderConfig{ - Docker: &idlewatchertypes.DockerConfig{ - ContainerID: containerName, - ContainerName: containerName, - }, - }, - IdlewatcherConfigBase: idlewatchertypes.ConfigBase{ - IdleTimeout: time.Hour, - WakeTimeout: time.Second, + Docker: &idlewatchertypes.DockerConfig{ + ContainerID: containerName, + ContainerName: containerName, }, + IdleTimeout: time.Hour, + WakeTimeout: time.Second, }, idleTicker: idleTicker, healthTicker: healthTicker, diff --git a/internal/idlewatcher/health_test.go b/internal/idlewatcher/health_test.go index 4d808656..b28d1f80 100644 --- a/internal/idlewatcher/health_test.go +++ b/internal/idlewatcher/health_test.go @@ -12,9 +12,7 @@ import ( func TestSleepIn(t *testing.T) { w := &Watcher{ cfg: &Config{ - IdlewatcherConfigBase: idlewatchertypes.ConfigBase{ - IdleTimeout: time.Minute, - }, + IdleTimeout: time.Minute, }, } w.state.Store(&containerState{ @@ -31,9 +29,7 @@ func TestSleepIn(t *testing.T) { func TestSleepInHiddenWhenNotReadyOrExpired(t *testing.T) { w := &Watcher{ cfg: &Config{ - IdlewatcherConfigBase: idlewatchertypes.ConfigBase{ - IdleTimeout: time.Minute, - }, + IdleTimeout: time.Minute, }, } w.state.Store(&containerState{ diff --git a/internal/idlewatcher/watcher.go b/internal/idlewatcher/watcher.go index b48c598a..6d6cce81 100644 --- a/internal/idlewatcher/watcher.go +++ b/internal/idlewatcher/watcher.go @@ -150,10 +150,8 @@ func NewWatcher(parent task.Parent, r routing.Route, cfg *Config) (*Watcher, err stateChangedCh: make(chan struct{}), events: gevents.NewHistory(), cfg: cfg, - routeHelper: routeHelper{ - hc: monitor.NewMonitor(r), - }, - dependsOn: make([]*dependency, 0, len(cfg.DependsOn)), + hc: monitor.NewMonitor(r), + dependsOn: make([]*dependency, 0, len(cfg.DependsOn)), } } diff --git a/internal/idlewatcher/watcher_dependencies_test.go b/internal/idlewatcher/watcher_dependencies_test.go index 6062bc14..d168a372 100644 --- a/internal/idlewatcher/watcher_dependencies_test.go +++ b/internal/idlewatcher/watcher_dependencies_test.go @@ -147,18 +147,14 @@ func newDependencyReloadTest(t *testing.T, id string, dependsOn []string) (*Watc func idlewatcherTestConfig(id string, dependsOn []string) *idlewatchertypes.Config { return &idlewatchertypes.Config{ - IdlewatcherProviderConfig: idlewatchertypes.ProviderConfig{ - Docker: &idlewatchertypes.DockerConfig{ - ContainerID: id, - ContainerName: id + "-container", - }, - }, - IdlewatcherConfigBase: idlewatchertypes.ConfigBase{ - IdleTimeout: time.Hour, - WakeTimeout: time.Second, - StopTimeout: time.Second, + Docker: &idlewatchertypes.DockerConfig{ + ContainerID: id, + ContainerName: id + "-container", }, - DependsOn: dependsOn, + IdleTimeout: time.Hour, + WakeTimeout: time.Second, + StopTimeout: time.Second, + DependsOn: dependsOn, } } diff --git a/internal/logging/accesslog/config.go b/internal/logging/accesslog/config.go index d039a266..aec96eb6 100644 --- a/internal/logging/accesslog/config.go +++ b/internal/logging/accesslog/config.go @@ -110,10 +110,8 @@ func (cfg *Config) ShouldLogRequest(req *http.Request, res *http.Response) bool func DefaultRequestLoggerConfig() *RequestLoggerConfig { return &RequestLoggerConfig{ - ConfigBase: ConfigBase{ - Retention: &Retention{Days: 30}, - }, - Format: FormatCombined, + Retention: &Retention{Days: 30}, + Format: FormatCombined, Fields: Fields{ Headers: FieldConfig{ Default: FieldModeDrop, @@ -130,9 +128,7 @@ func DefaultRequestLoggerConfig() *RequestLoggerConfig { func DefaultACLLoggerConfig() *ACLLoggerConfig { return &ACLLoggerConfig{ - ConfigBase: ConfigBase{ - Retention: &Retention{Days: 30}, - }, + Retention: &Retention{Days: 30}, } } diff --git a/internal/logging/accesslog/rotate.go b/internal/logging/accesslog/rotate.go index c026090d..5213f5a8 100644 --- a/internal/logging/accesslog/rotate.go +++ b/internal/logging/accesslog/rotate.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "io/fs" + "slices" "time" "github.com/rs/zerolog" @@ -196,8 +197,8 @@ func rotateLogFileByPolicy(file supportRotate, config *Retention, result *Rotate // Read each line and write it to the beginning of the file writePos := int64(0) // in reverse order to keep the order of the lines (from old to new) - for i := len(linesToKeep) - 1; i >= 0; i-- { - line := linesToKeep[i] + for _, line := range slices.Backward(linesToKeep) { + n := line.Size if err := fileContentMove(file, line.Pos, writePos, int(n)); err != nil { diff --git a/internal/logging/accesslog/rotate_test.go b/internal/logging/accesslog/rotate_test.go index 6a12d08b..7948556b 100644 --- a/internal/logging/accesslog/rotate_test.go +++ b/internal/logging/accesslog/rotate_test.go @@ -162,10 +162,8 @@ func TestRotateKeepDaysRollsRealFile(t *testing.T) { expect.NoError(t, err) logger := NewFileAccessLogger(task.RootTask("test", false), file, &RequestLoggerConfig{ - Format: FormatJSON, - ConfigBase: ConfigBase{ - Retention: strutils.MustParse[*Retention]("30 days"), - }, + Format: FormatJSON, + Retention: strutils.MustParse[*Retention]("30 days"), }) defer logger.Close() @@ -209,10 +207,8 @@ func TestRotateKeepDaysPreservesActiveFileMode(t *testing.T) { expect.NoError(t, err) logger := NewFileAccessLogger(task.RootTask("test", false), file, &RequestLoggerConfig{ - Format: FormatJSON, - ConfigBase: ConfigBase{ - Retention: strutils.MustParse[*Retention]("30 days"), - }, + Format: FormatJSON, + Retention: strutils.MustParse[*Retention]("30 days"), }) defer logger.Close() @@ -238,10 +234,8 @@ func TestRotateKeepDaysFlushesSharedFileLoggers(t *testing.T) { expect.NoError(t, err) cfg := &RequestLoggerConfig{ - Format: FormatJSON, - ConfigBase: ConfigBase{ - Retention: strutils.MustParse[*Retention]("30 days"), - }, + Format: FormatJSON, + Retention: strutils.MustParse[*Retention]("30 days"), } logger1 := NewFileAccessLogger(task.RootTask("test", false), file1, cfg) defer logger1.Close() @@ -269,10 +263,8 @@ func TestRotateKeepDaysDeletesExpiredArchives(t *testing.T) { expect.NoError(t, err) logger := NewFileAccessLogger(task.RootTask("test", false), file, &RequestLoggerConfig{ - Format: FormatJSON, - ConfigBase: ConfigBase{ - Retention: strutils.MustParse[*Retention]("30 days"), - }, + Format: FormatJSON, + Retention: strutils.MustParse[*Retention]("30 days"), }) defer logger.Close() @@ -410,10 +402,8 @@ func BenchmarkRotate(b *testing.B) { b.Run(fmt.Sprintf("retention_%s", retention.String()), func(b *testing.B) { file := newMockFile(true) logger := NewFileAccessLogger(task.RootTask("test", false), file, &RequestLoggerConfig{ - ConfigBase: ConfigBase{ - Retention: retention, - }, - Format: FormatJSON, + Retention: retention, + Format: FormatJSON, }) for i := range 100 { mockable.MockTimeNow(testTime.AddDate(0, 0, -100+i+1)) @@ -444,10 +434,8 @@ func BenchmarkRotateWithInvalidTime(b *testing.B) { b.Run(fmt.Sprintf("retention_%s", retention.String()), func(b *testing.B) { file := newMockFile(true) logger := NewFileAccessLogger(task.RootTask("test", false), file, &RequestLoggerConfig{ - ConfigBase: ConfigBase{ - Retention: retention, - }, - Format: FormatJSON, + Retention: retention, + Format: FormatJSON, }) for i := range 10000 { mockable.MockTimeNow(testTime.AddDate(0, 0, -10000+i+1)) diff --git a/internal/maxmind/maxmind.go b/internal/maxmind/maxmind.go index 69d0be30..c9873e78 100644 --- a/internal/maxmind/maxmind.go +++ b/internal/maxmind/maxmind.go @@ -92,8 +92,7 @@ func (cfg *MaxMind) LoadMaxMindDB(parent task.Parent) error { case errors.Is(err, os.ErrNotExist): default: // ignore invalid error, just download it again - var invalidErr maxminddb.InvalidDatabaseError - if !errors.As(err, &invalidErr) { + if _, ok := errors.AsType[maxminddb.InvalidDatabaseError](err); !ok { return err } } diff --git a/internal/net/gphttp/loadbalancer/server_test.go b/internal/net/gphttp/loadbalancer/server_test.go index 8a6d83a2..c159191a 100644 --- a/internal/net/gphttp/loadbalancer/server_test.go +++ b/internal/net/gphttp/loadbalancer/server_test.go @@ -1,13 +1,11 @@ package loadbalancer import ( - "net/url" - nettypes "github.com/yusing/godoxy/internal/net/types" "github.com/yusing/godoxy/internal/types" ) -var testServerURL = nettypes.URL{URL: url.URL{Scheme: "http", Host: "localhost"}} +var testServerURL = nettypes.URL{Scheme: "http", Host: "localhost"} func newTestServer(weight float64) types.LoadBalancerServer { u := testServerURL diff --git a/internal/notif/config_test.go b/internal/notif/config_test.go index 67f04d5d..23957c09 100644 --- a/internal/notif/config_test.go +++ b/internal/notif/config_test.go @@ -24,11 +24,9 @@ func TestNotificationConfig(t *testing.T) { "url": "https://example.com", }, expected: &Webhook{ - ProviderBase: ProviderBase{ - Name: "test", - URL: "https://example.com", - Format: LogFormatMarkdown, - }, + Name: "test", + URL: "https://example.com", + Format: LogFormatMarkdown, Template: "discord", Method: http.MethodPost, MIMEType: "application/json", @@ -47,12 +45,10 @@ func TestNotificationConfig(t *testing.T) { "format": "plain", }, expected: &GotifyClient{ - ProviderBase: ProviderBase{ - Name: "test", - URL: "https://example.com", - Token: "token", - Format: LogFormatPlain, - }, + Name: "test", + URL: "https://example.com", + Token: "token", + Format: LogFormatPlain, }, wantErr: false, }, @@ -65,12 +61,10 @@ func TestNotificationConfig(t *testing.T) { "url": "https://example.com", }, expected: &GotifyClient{ - ProviderBase: ProviderBase{ - Name: "test", - URL: "https://example.com", - Token: "token", - Format: LogFormatMarkdown, - }, + Name: "test", + URL: "https://example.com", + Token: "token", + Format: LogFormatMarkdown, }, wantErr: false, }, diff --git a/internal/route/provider/docker.go b/internal/route/provider/docker.go index 5220d82e..d847c4c4 100755 --- a/internal/route/provider/docker.go +++ b/internal/route/provider/docker.go @@ -122,10 +122,8 @@ func (p *DockerProvider) routesFromContainerLabels(container *docker.Container) // init entries map for all aliases for _, a := range container.Aliases { routes[a] = &route.Route{ - Alias: a, - Metadata: route.Metadata{ - Container: container, - }, + Alias: a, + Container: container, } } @@ -174,10 +172,8 @@ func (p *DockerProvider) routesFromContainerLabels(container *docker.Container) r, ok := routes[alias] if !ok { r = &route.Route{ - Alias: alias, - Metadata: route.Metadata{ - Container: container, - }, + Alias: alias, + Container: container, } routes[alias] = r } diff --git a/internal/route/provider/event_handler_test.go b/internal/route/provider/event_handler_test.go index 1c5f5242..3c6c6894 100644 --- a/internal/route/provider/event_handler_test.go +++ b/internal/route/provider/event_handler_test.go @@ -87,11 +87,9 @@ func TestEventHandlerShouldUpdateRouteOnForceReloadEvenWithoutMatchingContainerE ActorID: "other-id", ActorName: "other-name", }}, &route.Route{ - Metadata: route.Metadata{ - Container: &docker.Container{ - ContainerID: "app-id", - ContainerName: "app-name", - }, + Container: &docker.Container{ + ContainerID: "app-id", + ContainerName: "app-name", }, }) diff --git a/internal/route/route_test.go b/internal/route/route_test.go index dd4189b1..8125d36d 100644 --- a/internal/route/route_test.go +++ b/internal/route/route_test.go @@ -39,8 +39,8 @@ func TestHomepageItemContainerControls(t *testing.T) { { name: "docker container", route: &route.Route{ - Homepage: &homepage.ItemConfig{}, - Metadata: route.Metadata{Container: &docker.Container{ContainerID: "container-id"}}, + Homepage: &homepage.ItemConfig{}, + Container: &docker.Container{ContainerID: "container-id"}, }, wantContainerID: "container-id", }, @@ -77,7 +77,7 @@ func TestProxmoxDiscoveryRequiresSuccessfulMark(t *testing.T) { r := &route.Route{ Alias: "radarr", Proxmox: &proxmox.NodeConfig{Node: "pve", VMID: &vmid, VMName: "radarr-service"}, - Metadata: route.Metadata{ProxyURL: target}, + ProxyURL: target, } _, ok := r.ProxmoxDiscovery() @@ -222,12 +222,10 @@ func TestRouteValidate(t *testing.T) { Scheme: route.SchemeHTTP, Host: "example.com", Port: route.Port{Proxy: 80}, - Metadata: route.Metadata{ - Container: &docker.Container{ - ContainerID: "test-id", - Image: &docker.Image{ - Name: "test-image", - }, + Container: &docker.Container{ + ContainerID: "test-id", + Image: &docker.Image{ + Name: "test-image", }, }, } @@ -269,12 +267,10 @@ func TestDockerRouteDisallowAgent(t *testing.T) { Host: "example.com", Port: route.Port{Proxy: 80}, Agent: "test-agent", - Metadata: route.Metadata{ - Container: &docker.Container{ - ContainerID: "test-id", - Image: &docker.Image{ - Name: "test-image", - }, + Container: &docker.Container{ + ContainerID: "test-id", + Image: &docker.Image{ + Name: "test-image", }, }, } diff --git a/internal/routeimpl/fileserver_test.go b/internal/routeimpl/fileserver_test.go index d77b22ec..04a2d797 100644 --- a/internal/routeimpl/fileserver_test.go +++ b/internal/routeimpl/fileserver_test.go @@ -133,10 +133,10 @@ func TestEmbeddedFileServerUsesNginxTryFilesOrder(t *testing.T) { } fileServer, err := NewFileServer(&route.Route{ - Root: "embed://webui", - Metadata: route.Metadata{RootFS: fsys}, - SPA: true, - Index: "_shell.html", + Root: "embed://webui", + RootFS: fsys, + SPA: true, + Index: "_shell.html", }) expect.NoError(t, err) diff --git a/internal/routeimpl/reverse_proxy.go b/internal/routeimpl/reverse_proxy.go index c2e72c0f..a1729599 100755 --- a/internal/routeimpl/reverse_proxy.go +++ b/internal/routeimpl/reverse_proxy.go @@ -245,9 +245,7 @@ func (r *ReverseProxyRoute) addToLoadBalancer(parent task.Parent, ep routing.Ent Alias: cfg.Link, Homepage: r.Homepage, Bind: r.Bind, - Metadata: route.Metadata{ - LisURL: r.ListenURL(), - }, + LisURL: r.ListenURL(), }, loadBalancer: lb, handler: lb, diff --git a/internal/routeimpl/stream_test.go b/internal/routeimpl/stream_test.go index c17c4d66..746a91a9 100644 --- a/internal/routeimpl/stream_test.go +++ b/internal/routeimpl/stream_test.go @@ -81,10 +81,8 @@ func TestStreamRouteCancelFinishesTask(t *testing.T) { Alias: "echo-" + tt.name, Scheme: tt.scheme, HealthCheck: health.HealthCheckConfig{Disable: true}, - Metadata: route.Metadata{ - LisURL: lisURL, - ProxyURL: proxyURL, - }, + LisURL: lisURL, + ProxyURL: proxyURL, }) require.NoError(t, err) require.NoError(t, impl.Start(parent)) @@ -151,10 +149,8 @@ func TestStreamRouteListenErrorFinishesTask(t *testing.T) { Alias: "busy-tcp", Scheme: route.SchemeTCP, HealthCheck: health.HealthCheckConfig{Disable: true}, - Metadata: route.Metadata{ - LisURL: lisURL, - ProxyURL: proxyURL, - }, + LisURL: lisURL, + ProxyURL: proxyURL, }) require.NoError(t, err) require.Error(t, impl.Start(parent)) diff --git a/internal/routeimpl/webui_smoke_test.go b/internal/routeimpl/webui_smoke_test.go index 1cc5f3ee..a0ffcc2c 100644 --- a/internal/routeimpl/webui_smoke_test.go +++ b/internal/routeimpl/webui_smoke_test.go @@ -43,11 +43,11 @@ func TestEmbeddedWebUIRouteSmoke(t *testing.T) { require.True(t, ok) fileServer, err := NewFileServer(&route.Route{ - Root: "embed://webui", - Metadata: route.Metadata{RootFS: webui.Dist()}, - SPA: true, - Index: "_shell.html", - Rules: webuiRules, + Root: "embed://webui", + RootFS: webui.Dist(), + SPA: true, + Index: "_shell.html", + Rules: webuiRules, }) require.NoError(t, err) @@ -142,12 +142,12 @@ func TestEmbeddedWebUIRouteMiddlewaresWrapRules(t *testing.T) { require.True(t, ok) fileServer, err := NewFileServer(&route.Route{ - Alias: "godoxy", - Root: "embed://webui", - Metadata: route.Metadata{RootFS: webui.Dist()}, - SPA: true, - Index: "_shell.html", - Rules: webuiRules, + Alias: "godoxy", + Root: "embed://webui", + RootFS: webui.Dist(), + SPA: true, + Index: "_shell.html", + Rules: webuiRules, Middlewares: map[string]types.LabelMap{ "themed": { "css": "https://css.tyleo.dev/gdx/global.css", diff --git a/internal/routevalidate/finalize_test.go b/internal/routevalidate/finalize_test.go index e8ea1058..c7f22ede 100644 --- a/internal/routevalidate/finalize_test.go +++ b/internal/routevalidate/finalize_test.go @@ -23,13 +23,11 @@ func TestPreferredPort(t *testing.T) { func TestDockerRouteWithResolvablePortIsNotExcludedBeforeFinalize(t *testing.T) { r := &route.Route{ Alias: "app", - Metadata: route.Metadata{ - Container: &docker.Container{ - Image: &docker.Image{Name: "custom-app"}, - PrivateHostname: "172.18.0.2", - PrivatePortMapping: docker.PortMapping{ - 8080: container.Port{PrivatePort: 8080, Type: "tcp"}, - }, + Container: &docker.Container{ + Image: &docker.Image{Name: "custom-app"}, + PrivateHostname: "172.18.0.2", + PrivatePortMapping: docker.PortMapping{ + 8080: container.Port{PrivatePort: 8080, Type: "tcp"}, }, }, } @@ -45,14 +43,12 @@ func TestDockerRouteWithResolvablePortIsNotExcludedBeforeFinalize(t *testing.T) func TestFinalizeHomepage_ImmichServerUsesImmichCategory(t *testing.T) { r := &route.Route{ Alias: "immich-server", - Metadata: route.Metadata{ - Container: &docker.Container{ - ContainerName: "immich-server", - Image: &docker.Image{Name: "immich-server"}, - PrivateHostname: "172.18.0.2", - PrivatePortMapping: docker.PortMapping{ - 2283: container.Port{PrivatePort: 2283, Type: "tcp"}, - }, + Container: &docker.Container{ + ContainerName: "immich-server", + Image: &docker.Image{Name: "immich-server"}, + PrivateHostname: "172.18.0.2", + PrivatePortMapping: docker.PortMapping{ + 2283: container.Port{PrivatePort: 2283, Type: "tcp"}, }, }, } diff --git a/internal/routevalidate/proxmox_test.go b/internal/routevalidate/proxmox_test.go index fe12a980..f254ffb5 100644 --- a/internal/routevalidate/proxmox_test.go +++ b/internal/routevalidate/proxmox_test.go @@ -30,11 +30,9 @@ func TestResolveProxmoxBindsResolvedRouteToIdlewatcher(t *testing.T) { func TestResolveProxmoxUsesExplicitIdlewatcherBindingForRoute(t *testing.T) { r := &route.Route{ Idlewatcher: &idlewatcher.Config{ - IdlewatcherProviderConfig: idlewatcher.ProviderConfig{ - Proxmox: &idlewatcher.ProxmoxConfig{ - Node: "pve", - VMID: 119, - }, + Proxmox: &idlewatcher.ProxmoxConfig{ + Node: "pve", + VMID: 119, }, }, } diff --git a/internal/serialization/serialization.go b/internal/serialization/serialization.go index 5cc7e578..f017dfd8 100644 --- a/internal/serialization/serialization.go +++ b/internal/serialization/serialization.go @@ -115,8 +115,7 @@ func initPtr(dst reflect.Value) { func ValidateWithFieldTags(s any) error { var errs gperr.Builder err := validate.Struct(s) - var valErrs validator.ValidationErrors - if errors.As(err, &valErrs) { + if valErrs, ok := errors.AsType[validator.ValidationErrors](err); ok { for _, e := range valErrs { detail := e.ActualTag() if e.Param() != "" { From 63a381020cf0a966adf9e21a7d07ddf7db1327ea Mon Sep 17 00:00:00 2001 From: yusing Date: Thu, 20 Aug 2026 15:18:48 +0800 Subject: [PATCH 3/3] chore(deps): update goutils submodule goutils - fb8566d: refactor: apply `go fix` modernization --- goutils | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/goutils b/goutils index ce24de9a..fb8566d3 160000 --- a/goutils +++ b/goutils @@ -1 +1 @@ -Subproject commit ce24de9afae3686edabc92be447d4e3a5149b649 +Subproject commit fb8566d3f3e3347dd6939f9215ab7890f12272a3