mirror of
https://github.com/fatedier/frp.git
synced 2025-06-18 01:28:21 +00:00
Compare commits
1 Commits
9e4e9e377f
...
753ee10e3d
Author | SHA1 | Date | |
---|---|---|---|
|
753ee10e3d |
@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
This will create 8 proxies such as `tcp-6000, tcp-6001, ... tcp-6007`.
|
This will create 8 proxies such as `tcp-6000, tcp-6001, ... tcp-6007`.
|
||||||
|
|
||||||
* Health check supports custom request headers.
|
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|
||||||
* Fix the issue of incorrect interval time for rotating the log by day.
|
* Fix the issue of incorrect interval time for rotating the log by day.
|
||||||
|
@ -41,7 +41,7 @@ type Monitor struct {
|
|||||||
|
|
||||||
// For http
|
// For http
|
||||||
url string
|
url string
|
||||||
header http.Header
|
|
||||||
failedTimes uint64
|
failedTimes uint64
|
||||||
statusOK bool
|
statusOK bool
|
||||||
statusNormalFn func()
|
statusNormalFn func()
|
||||||
@ -73,11 +73,6 @@ func NewMonitor(ctx context.Context, cfg v1.HealthCheckConfig, addr string,
|
|||||||
}
|
}
|
||||||
url = s + cfg.Path
|
url = s + cfg.Path
|
||||||
}
|
}
|
||||||
header := make(http.Header)
|
|
||||||
for _, h := range cfg.HTTPHeaders {
|
|
||||||
header.Set(h.Name, h.Value)
|
|
||||||
}
|
|
||||||
|
|
||||||
return &Monitor{
|
return &Monitor{
|
||||||
checkType: cfg.Type,
|
checkType: cfg.Type,
|
||||||
interval: time.Duration(cfg.IntervalSeconds) * time.Second,
|
interval: time.Duration(cfg.IntervalSeconds) * time.Second,
|
||||||
@ -85,7 +80,6 @@ func NewMonitor(ctx context.Context, cfg v1.HealthCheckConfig, addr string,
|
|||||||
maxFailedTimes: cfg.MaxFailed,
|
maxFailedTimes: cfg.MaxFailed,
|
||||||
addr: addr,
|
addr: addr,
|
||||||
url: url,
|
url: url,
|
||||||
header: header,
|
|
||||||
statusOK: false,
|
statusOK: false,
|
||||||
statusNormalFn: statusNormalFn,
|
statusNormalFn: statusNormalFn,
|
||||||
statusFailedFn: statusFailedFn,
|
statusFailedFn: statusFailedFn,
|
||||||
@ -169,8 +163,6 @@ func (monitor *Monitor) doHTTPCheck(ctx context.Context) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
req.Header = monitor.header
|
|
||||||
req.Host = monitor.header.Get("Host")
|
|
||||||
resp, err := http.DefaultClient.Do(req)
|
resp, err := http.DefaultClient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -216,10 +216,6 @@ healthCheck.path = "/status"
|
|||||||
healthCheck.intervalSeconds = 10
|
healthCheck.intervalSeconds = 10
|
||||||
healthCheck.maxFailed = 3
|
healthCheck.maxFailed = 3
|
||||||
healthCheck.timeoutSeconds = 3
|
healthCheck.timeoutSeconds = 3
|
||||||
# set health check headers
|
|
||||||
healthCheck.httpHeaders=[
|
|
||||||
{ name = "x-from-where", value = "frp" }
|
|
||||||
]
|
|
||||||
|
|
||||||
[[proxies]]
|
[[proxies]]
|
||||||
name = "web02"
|
name = "web02"
|
||||||
|
@ -129,8 +129,3 @@ type HTTPPluginOptions struct {
|
|||||||
type HeaderOperations struct {
|
type HeaderOperations struct {
|
||||||
Set map[string]string `json:"set,omitempty"`
|
Set map[string]string `json:"set,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type HTTPHeader struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Value string `json:"value"`
|
|
||||||
}
|
|
||||||
|
@ -97,9 +97,6 @@ type HealthCheckConfig struct {
|
|||||||
// Path specifies the path to send health checks to if the
|
// Path specifies the path to send health checks to if the
|
||||||
// health check type is "http".
|
// health check type is "http".
|
||||||
Path string `json:"path,omitempty"`
|
Path string `json:"path,omitempty"`
|
||||||
// HTTPHeaders specifies the headers to send with the health request, if
|
|
||||||
// the health check type is "http".
|
|
||||||
HTTPHeaders []HTTPHeader `json:"httpHeaders,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type DomainConfig struct {
|
type DomainConfig struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user