mirror of
https://github.com/fatedier/frp.git
synced 2026-01-10 10:13:16 +00:00
config: add enabled field for individual proxy and visitor (#5048)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
## Features
|
## Features
|
||||||
|
|
||||||
* HTTPS proxies now support load balancing groups. Multiple HTTPS proxies can be configured with the same `loadBalancer.group` and `loadBalancer.groupKey` to share the same custom domain and distribute traffic across multiple backend services, similar to the existing TCP and HTTP load balancing capabilities.
|
* HTTPS proxies now support load balancing groups. Multiple HTTPS proxies can be configured with the same `loadBalancer.group` and `loadBalancer.groupKey` to share the same custom domain and distribute traffic across multiple backend services, similar to the existing TCP and HTTP load balancing capabilities.
|
||||||
|
* Individual frpc proxies and visitors now accept an `enabled` flag (defaults to true), letting you disable specific entries without relying on the global `start` list—disabled blocks are skipped when client configs load.
|
||||||
|
|
||||||
## Improvements
|
## Improvements
|
||||||
|
|
||||||
|
|||||||
@@ -143,6 +143,11 @@ transport.tls.enable = true
|
|||||||
# Default is empty, means all proxies.
|
# Default is empty, means all proxies.
|
||||||
# start = ["ssh", "dns"]
|
# start = ["ssh", "dns"]
|
||||||
|
|
||||||
|
# Alternative to 'start': You can control each proxy individually using the 'enabled' field.
|
||||||
|
# Set 'enabled = false' in a proxy configuration to disable it.
|
||||||
|
# If 'enabled' is not set or set to true, the proxy is enabled by default.
|
||||||
|
# The 'enabled' field provides more granular control and is recommended over 'start'.
|
||||||
|
|
||||||
# Specify udp packet size, unit is byte. If not set, the default value is 1500.
|
# Specify udp packet size, unit is byte. If not set, the default value is 1500.
|
||||||
# This parameter should be same between client and server.
|
# This parameter should be same between client and server.
|
||||||
# It affects the udp and sudp proxy.
|
# It affects the udp and sudp proxy.
|
||||||
@@ -169,6 +174,8 @@ metadatas.var2 = "123"
|
|||||||
# If global user is not empty, it will be changed to {user}.{proxy} such as 'your_name.ssh'
|
# If global user is not empty, it will be changed to {user}.{proxy} such as 'your_name.ssh'
|
||||||
name = "ssh"
|
name = "ssh"
|
||||||
type = "tcp"
|
type = "tcp"
|
||||||
|
# Enable or disable this proxy. true or omit this field to enable, false to disable.
|
||||||
|
# enabled = true
|
||||||
localIP = "127.0.0.1"
|
localIP = "127.0.0.1"
|
||||||
localPort = 22
|
localPort = 22
|
||||||
# Limit bandwidth for this proxy, unit is KB and MB
|
# Limit bandwidth for this proxy, unit is KB and MB
|
||||||
@@ -253,6 +260,8 @@ healthCheck.httpHeaders=[
|
|||||||
[[proxies]]
|
[[proxies]]
|
||||||
name = "web02"
|
name = "web02"
|
||||||
type = "https"
|
type = "https"
|
||||||
|
# Disable this proxy by setting enabled to false
|
||||||
|
# enabled = false
|
||||||
localIP = "127.0.0.1"
|
localIP = "127.0.0.1"
|
||||||
localPort = 8000
|
localPort = 8000
|
||||||
subdomain = "web02"
|
subdomain = "web02"
|
||||||
|
|||||||
@@ -281,6 +281,17 @@ func LoadClientConfig(path string, strict bool) (
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Filter by enabled field in each proxy
|
||||||
|
// nil or true means enabled, false means disabled
|
||||||
|
proxyCfgs = lo.Filter(proxyCfgs, func(c v1.ProxyConfigurer, _ int) bool {
|
||||||
|
enabled := c.GetBaseConfig().Enabled
|
||||||
|
return enabled == nil || *enabled
|
||||||
|
})
|
||||||
|
visitorCfgs = lo.Filter(visitorCfgs, func(c v1.VisitorConfigurer, _ int) bool {
|
||||||
|
enabled := c.GetBaseConfig().Enabled
|
||||||
|
return enabled == nil || *enabled
|
||||||
|
})
|
||||||
|
|
||||||
if cliCfg != nil {
|
if cliCfg != nil {
|
||||||
if err := cliCfg.Complete(); err != nil {
|
if err := cliCfg.Complete(); err != nil {
|
||||||
return nil, nil, nil, isLegacyFormat, err
|
return nil, nil, nil, isLegacyFormat, err
|
||||||
|
|||||||
@@ -108,8 +108,11 @@ type DomainConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ProxyBaseConfig struct {
|
type ProxyBaseConfig struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
|
// Enabled controls whether this proxy is enabled. nil or true means enabled, false means disabled.
|
||||||
|
// This allows individual control over each proxy, complementing the global "start" field.
|
||||||
|
Enabled *bool `json:"enabled,omitempty"`
|
||||||
Annotations map[string]string `json:"annotations,omitempty"`
|
Annotations map[string]string `json:"annotations,omitempty"`
|
||||||
Transport ProxyTransport `json:"transport,omitempty"`
|
Transport ProxyTransport `json:"transport,omitempty"`
|
||||||
// metadata info for each proxy
|
// metadata info for each proxy
|
||||||
|
|||||||
@@ -32,8 +32,11 @@ type VisitorTransport struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type VisitorBaseConfig struct {
|
type VisitorBaseConfig struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
|
// Enabled controls whether this visitor is enabled. nil or true means enabled, false means disabled.
|
||||||
|
// This allows individual control over each visitor, complementing the global "start" field.
|
||||||
|
Enabled *bool `json:"enabled,omitempty"`
|
||||||
Transport VisitorTransport `json:"transport,omitempty"`
|
Transport VisitorTransport `json:"transport,omitempty"`
|
||||||
SecretKey string `json:"secretKey,omitempty"`
|
SecretKey string `json:"secretKey,omitempty"`
|
||||||
// if the server user is not set, it defaults to the current user
|
// if the server user is not set, it defaults to the current user
|
||||||
|
|||||||
Reference in New Issue
Block a user