mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 20:52:33 +02:00
small refactor and update next-release readme
This commit is contained in:
parent
a587ada170
commit
9f71fc2dd5
4 changed files with 152 additions and 105 deletions
|
@ -1,6 +1,9 @@
|
|||
package task
|
||||
|
||||
import "strings"
|
||||
import (
|
||||
"slices"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// debug only.
|
||||
func (t *Task) listChildren() []string {
|
||||
|
@ -24,3 +27,17 @@ func (t *Task) listCallbacks() []string {
|
|||
}
|
||||
return callbacks
|
||||
}
|
||||
|
||||
// DebugTaskList returns list of all tasks.
|
||||
//
|
||||
// The returned string is suitable for printing to the console.
|
||||
func DebugTaskList() []string {
|
||||
l := make([]string, 0, allTasks.Size())
|
||||
|
||||
allTasks.RangeAll(func(t *Task) {
|
||||
l = append(l, t.name)
|
||||
})
|
||||
|
||||
slices.Sort(l)
|
||||
return l
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ type (
|
|||
|
||||
finished chan struct{}
|
||||
finishedCalled bool
|
||||
|
||||
mu sync.Mutex
|
||||
|
||||
ctx context.Context
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"slices"
|
||||
"time"
|
||||
|
||||
"github.com/yusing/go-proxy/internal/logging"
|
||||
|
@ -73,17 +72,3 @@ func GracefulShutdown(timeout time.Duration) (err error) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DebugTaskList returns list of all tasks.
|
||||
//
|
||||
// The returned string is suitable for printing to the console.
|
||||
func DebugTaskList() []string {
|
||||
l := make([]string, 0, allTasks.Size())
|
||||
|
||||
allTasks.RangeAll(func(t *Task) {
|
||||
l = append(l, t.name)
|
||||
})
|
||||
|
||||
slices.Sort(l)
|
||||
return l
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
GoDoxy v0.8 changes:
|
||||
# GoDoxy v0.8 changes:
|
||||
|
||||
## Breaking changes
|
||||
|
||||
- **Removed** `redirect_to_https` in `config.yml`, superseded by `redirectHTTP` as an entrypoint middleware
|
||||
|
||||
- **New** notification config format, support webhook notification, support multiple notification providers
|
||||
|
||||
- **Breaking** notification config format changed, support webhook notification, support multiple notification providers
|
||||
old
|
||||
|
||||
```yaml
|
||||
|
@ -49,13 +54,17 @@ Available payload variables:
|
|||
| $fields | extra fields in json format | json object |
|
||||
| $color | embed color by `color_mode` | `0xff0000` (hex) or `16711680` (dec) |
|
||||
|
||||
- **Breaking** removed `redirect_to_https` in `config.yml`, superseded by `redirectHTTP` as an entrypoint middleware
|
||||
## Non-breaking changes
|
||||
|
||||
- services health notification now in markdown format like `Uptime Kuma` for both webhook and Gotify
|
||||
|
||||
- docker services use docker now health check if possible, fallback to GoDoxy health check on failure / no docker health check
|
||||
- docker services now use docker health check if possible, fallback to GoDoxy health check on failure / no docker health check
|
||||
|
||||
- support entrypoint middlewares (applied to routes, before route middlewares)
|
||||
- `proxy.<alias>.path_patterns` fully support http.ServeMux patterns `[METHOD ][HOST]/[PATH]` (See https://pkg.go.dev/net/http#hdr-Patterns-ServeMux)
|
||||
|
||||
- caching ACME private key in order to reuse ACME account, to prevent from ACME rate limit
|
||||
|
||||
- **New:** support entrypoint middlewares (applied to routes, before route middlewares)
|
||||
|
||||
```yaml
|
||||
entrypoint:
|
||||
|
@ -69,7 +78,7 @@ entrypoint:
|
|||
message: "Forbidden"
|
||||
```
|
||||
|
||||
- support exact host matching, i.e.
|
||||
- **New:** support exact host matching, i.e.
|
||||
|
||||
```yaml
|
||||
app1.domain.tld:
|
||||
|
@ -77,9 +86,18 @@ app1.domain.tld:
|
|||
```
|
||||
|
||||
will only match exactly `app1.domain.tld`
|
||||
**If `match_domains` are used in config, `domain.tld` must be one of it**
|
||||
**`match_domains` in config will be ignored for this route**
|
||||
|
||||
- support `x-properties` (like in docker compose), example usage
|
||||
- **New:** support host matching without a subdomain, i.e.
|
||||
|
||||
```yaml
|
||||
app1:
|
||||
host: 10.0.0.1
|
||||
```
|
||||
|
||||
will now also match `app1.tld`
|
||||
|
||||
- **New:** support `x-properties` (like in docker compose), example usage
|
||||
|
||||
```yaml
|
||||
x-proxy: &proxy
|
||||
|
@ -105,7 +123,7 @@ api.groq.com:
|
|||
- `modifyRequest` = `request`
|
||||
- `modifyResponse` = `response`
|
||||
|
||||
- support `$` variables in `request` and `response` middlewares (like nginx config)
|
||||
- **New:** support `$` variables in `request` and `response` middlewares (like nginx config)
|
||||
|
||||
- `$req_method`: request http method
|
||||
- `$req_scheme`: request URL scheme (http/https)
|
||||
|
@ -134,12 +152,38 @@ api.groq.com:
|
|||
- `$resp_header(name)`: get response header by name
|
||||
- `$arg(name)`: get URL query parameter by name
|
||||
|
||||
- `proxy.<alias>.path_patterns` fully support http.ServeMux patterns `[METHOD ][HOST]/[PATH]` (See https://pkg.go.dev/net/http#hdr-Patterns-ServeMux)
|
||||
- **New:** Access Logging (entrypoint and per route), i.e.
|
||||
|
||||
- caching ACME private key in order to reuse ACME account, to prevent from ACME rate limit
|
||||
```yaml
|
||||
# config.yml
|
||||
entrypoint:
|
||||
access_log:
|
||||
format: json # common, combined, json
|
||||
path: /app/logs/access.json.log
|
||||
filters:
|
||||
cidr:
|
||||
negative: true # no log for local requests
|
||||
values:
|
||||
- 127.0.0.1/32
|
||||
- 172.0.0.0/8
|
||||
- 192.168.0.0/16
|
||||
- 10.0.0.0/16
|
||||
fields:
|
||||
headers:
|
||||
default: drop # drop app headers in log
|
||||
config: # keep only these
|
||||
X-Real-Ip: keep
|
||||
CF-Connecting-Ip: keep
|
||||
X-Forwarded-For: keep
|
||||
```
|
||||
|
||||
**mount logs directory before setting this**
|
||||
|
||||
## Fixes
|
||||
|
||||
- fixed
|
||||
- duplicated notification after config reload
|
||||
- `timeout` was defaulted to `0` in some cases causing health check to fail
|
||||
- `redirectHTTP` middleware may not work on non standard http port
|
||||
- various other small bugs
|
||||
- `realIP` and `cloudflareRealIP` middlewares
|
||||
- prometheus metrics gone after a single route reload
|
||||
|
|
Loading…
Add table
Reference in a new issue