mirror of
https://github.com/yusing/godoxy.git
synced 2026-05-13 00:48:39 -05:00
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.
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -43,7 +43,6 @@ type Route struct {
|
||||
// Route rules and middleware
|
||||
HTTPConfig
|
||||
InboundMTLSProfile string
|
||||
PathPatterns []string
|
||||
Rules rules.Rules
|
||||
RuleFile string
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
+1
-1
Submodule webui updated: 2a937ccfa1...77af25899f
Reference in New Issue
Block a user