From f8d025701150b77af91eb59bea378e805a2eb6bf Mon Sep 17 00:00:00 2001 From: yusing Date: Tue, 5 May 2026 17:53:22 +0800 Subject: [PATCH] refactor(route): remove path_patterns; sync OpenAPI and webui submodule Drop PathPatterns from the Route model and remove FileServer path-pattern mux wiring. Strip path_patterns from provider examples and docker label tests. Refresh Swagger (max_conns_per_host, remove path_patterns; reorder load_avg fields) and bump webui to 77af2589. submodule webui: 77af25899ff4c4de7de5bb81b9bf4ac7d276e4aa chore(types,ui): remove path_patterns from types and ui Regenerated json schema f64b2e8f85eec683b8e9258c23e3398c4ba828ed chore: update wiki 2e5ea789845032b4ad99325e824db8d6dc351fd0 chore(godoxy): sync impl docs and swagger ec840613ae7a9a5fb0e3c79caf2aa88ee1cef202 docs(godoxy): inline docker stats in benchmarks and refresh gallery images Replace the resource usage screenshot with a fenced `docker stats` excerpt and drop `docker-stats.png`. Update gallery assets for idlesleeper, routes, servers, and webui. --- internal/api/v1/docs/swagger.json | 13 +++++-------- internal/api/v1/docs/swagger.yaml | 12 ++++-------- internal/route/README.md | 1 - internal/route/fileserver.go | 18 ------------------ internal/route/provider/all_fields.yaml | 4 ---- internal/route/provider/docker_labels.yaml | 9 --------- internal/route/provider/docker_test.go | 14 -------------- internal/route/route.go | 1 - providers.example.yml | 4 ---- webui | 2 +- 10 files changed, 10 insertions(+), 68 deletions(-) diff --git a/internal/api/v1/docs/swagger.json b/internal/api/v1/docs/swagger.json index 58add9cd..1fe9425c 100644 --- a/internal/api/v1/docs/swagger.json +++ b/internal/api/v1/docs/swagger.json @@ -5435,10 +5435,14 @@ "x-nullable": true }, "lurl": { - "description": "private fields", "type": "string", "x-nullable": true }, + "max_conns_per_host": { + "type": "integer", + "x-nullable": false, + "x-omitempty": false + }, "middlewares": { "type": "object", "additionalProperties": { @@ -5451,13 +5455,6 @@ "x-nullable": false, "x-omitempty": false }, - "path_patterns": { - "type": "array", - "items": { - "type": "string" - }, - "x-nullable": true - }, "port": { "$ref": "#/definitions/Port", "x-nullable": false, diff --git a/internal/api/v1/docs/swagger.yaml b/internal/api/v1/docs/swagger.yaml index 186e2f30..8d827e88 100644 --- a/internal/api/v1/docs/swagger.yaml +++ b/internal/api/v1/docs/swagger.yaml @@ -1022,9 +1022,10 @@ definitions: - $ref: '#/definitions/LoadBalancerConfig' x-nullable: true lurl: - description: private fields type: string x-nullable: true + max_conns_per_host: + type: integer middlewares: additionalProperties: $ref: '#/definitions/types.LabelMap' @@ -1032,11 +1033,6 @@ definitions: x-nullable: true no_tls_verify: type: boolean - path_patterns: - items: - type: string - type: array - x-nullable: true port: $ref: '#/definitions/Port' provider: @@ -1809,12 +1805,12 @@ definitions: type: string kernel_version: type: string + load_avg_15m: + type: string load_avg_1m: type: string load_avg_5m: type: string - load_avg_15m: - type: string mem_pct: type: string mem_total: diff --git a/internal/route/README.md b/internal/route/README.md index 47e8d9ab..1c451501 100644 --- a/internal/route/README.md +++ b/internal/route/README.md @@ -43,7 +43,6 @@ type Route struct { // Route rules and middleware HTTPConfig InboundMTLSProfile string - PathPatterns []string Rules rules.Rules RuleFile string diff --git a/internal/route/fileserver.go b/internal/route/fileserver.go index 4a632aa4..eb6f409f 100644 --- a/internal/route/fileserver.go +++ b/internal/route/fileserver.go @@ -13,10 +13,8 @@ import ( entrypoint "github.com/yusing/godoxy/internal/entrypoint/types" "github.com/yusing/godoxy/internal/health/monitor" "github.com/yusing/godoxy/internal/logging/accesslog" - gphttp "github.com/yusing/godoxy/internal/net/gphttp" "github.com/yusing/godoxy/internal/net/gphttp/middleware" "github.com/yusing/godoxy/internal/types" - gperr "github.com/yusing/goutils/errs" "github.com/yusing/goutils/task" ) @@ -175,22 +173,6 @@ func (s *FileServer) Start(parent task.Parent) error { } func (s *FileServer) prepareHandler() error { - pathPatterns := s.PathPatterns - switch { - case len(pathPatterns) == 0: - case len(pathPatterns) == 1 && pathPatterns[0] == "/": - default: - mux := gphttp.NewServeMux() - patErrs := gperr.NewBuilder("invalid path pattern(s)") - for _, p := range pathPatterns { - patErrs.Add(mux.Handle(p, s.handler)) - } - if err := patErrs.Error(); err != nil { - return err - } - s.handler = mux - } - if len(s.Rules) > 0 { s.handler = s.Rules.BuildHandler(s.handler.ServeHTTP) } diff --git a/internal/route/provider/all_fields.yaml b/internal/route/provider/all_fields.yaml index dc7cf57c..7484d770 100644 --- a/internal/route/provider/all_fields.yaml +++ b/internal/route/provider/all_fields.yaml @@ -18,10 +18,6 @@ example: # matching `example.y.z` ssl_protocols: - tlsv1.2 - tlsv1.3 - path_patterns: # Check https://pkg.go.dev/net/http#hdr-Patterns-ServeMux for syntax - - GET / # accept any GET request - - POST /auth # for /auth and /auth/* accept only POST - - GET /home/{$} # for exactly /home rules: - name: default do: pass diff --git a/internal/route/provider/docker_labels.yaml b/internal/route/provider/docker_labels.yaml index 1ccdad22..bfd57ffa 100644 --- a/internal/route/provider/docker_labels.yaml +++ b/internal/route/provider/docker_labels.yaml @@ -4,10 +4,6 @@ proxy.app: | scheme: http host: 10.0.0.254 port: 80 - path_patterns: # Check https://pkg.go.dev/net/http#hdr-Patterns-ServeMux for syntax - - GET / # accept any GET request - - POST /auth # for /auth and /auth/* accept only POST - - GET /home/{$} # for exactly /home healthcheck: disabled: false path: / @@ -69,11 +65,6 @@ proxy.app: | proxy.app1.scheme: http proxy.app1.host: 10.0.0.254 proxy.app1.port: 80 -proxy.app1.path_patterns: - | # Check https://pkg.go.dev/net/http#hdr-Patterns-ServeMux for syntax - - GET / # accept any GET request - - POST /auth # for /auth and /auth/* accept only POST - - GET /home/{$} # for exactly /home proxy.app1.healthcheck.disabled: false proxy.app1.healthcheck.path: / proxy.app1.healthcheck.interval: 5s diff --git a/internal/route/provider/docker_test.go b/internal/route/provider/docker_test.go index 4b2ae9eb..8bf8231d 100644 --- a/internal/route/provider/docker_test.go +++ b/internal/route/provider/docker_test.go @@ -44,16 +44,6 @@ func TestExplicitOnly(t *testing.T) { } func TestApplyLabel(t *testing.T) { - pathPatterns := ` -- / -- POST /upload/{$} -- GET /static -`[1:] - pathPatternsExpect := []string{ - "/", - "POST /upload/{$}", - "GET /static", - } middlewaresExpect := map[string]map[string]any{ "request": { "set_headers": map[string]any{ @@ -77,7 +67,6 @@ func TestApplyLabel(t *testing.T) { "proxy.*.scheme": "https", "proxy.*.host": "app", "proxy.*.port": "4567", - "proxy.a.path_patterns": pathPatterns, "proxy.a.middlewares.request.set_headers.X-Header": "value1", "proxy.a.middlewares.request.add_headers.X-Header2": "value2", "proxy.a.homepage.show": "true", @@ -104,9 +93,6 @@ func TestApplyLabel(t *testing.T) { expect.True(t, a.NoTLSVerify) expect.True(t, b.NoTLSVerify) - expect.Equal(t, a.PathPatterns, pathPatternsExpect) - expect.Equal(t, len(b.PathPatterns), 0) - expect.Equal(t, a.Middlewares, middlewaresExpect) expect.Equal(t, len(b.Middlewares), 0) diff --git a/internal/route/route.go b/internal/route/route.go index 7a65560a..80070866 100644 --- a/internal/route/route.go +++ b/internal/route/route.go @@ -58,7 +58,6 @@ type ( route.HTTPConfig InboundMTLSProfile string `json:"inbound_mtls_profile,omitempty"` // HTTP-based routes only: must match a configured inbound_mtls_profiles entry and is ignored when entrypoint.inbound_mtls_profile is set - PathPatterns []string `json:"path_patterns,omitempty" extensions:"x-nullable"` Rules rules.Rules `json:"rules,omitempty" extensions:"x-nullable"` RuleFile string `json:"rule_file,omitempty" extensions:"x-nullable"` HealthCheck types.HealthCheckConfig `json:"healthcheck,omitzero" extensions:"x-nullable"` // null on load-balancer routes diff --git a/providers.example.yml b/providers.example.yml index ed897ebc..4652d7c5 100644 --- a/providers.example.yml +++ b/providers.example.yml @@ -2,10 +2,6 @@ example: # matching `example.y.z` scheme: https host: 10.0.0.1 port: 80 - path_patterns: # Check https://pkg.go.dev/net/http#hdr-Patterns-ServeMux for syntax - - GET / # accept any GET request - - POST /auth # for /auth and /auth/* accept only POST - - GET /home/{$} # for exactly /home no_tls_verify: false middlewares: cidr_whitelist: diff --git a/webui b/webui index 2a937ccf..77af2589 160000 --- a/webui +++ b/webui @@ -1 +1 @@ -Subproject commit 2a937ccfa1b612d64aeedc9f63ce6bb76feda079 +Subproject commit 77af25899ff4c4de7de5bb81b9bf4ac7d276e4aa