chore(lint): fix golines formatting in gateway files
This commit is contained in:
parent
8c1b1feaad
commit
be39b34b7b
3 changed files with 30 additions and 13 deletions
|
|
@ -10,10 +10,10 @@ import (
|
|||
const DefaultGatewayLogLevel = "warn"
|
||||
|
||||
type GatewayConfig struct {
|
||||
Host string `json:"host" env:"PICOCLAW_GATEWAY_HOST"`
|
||||
Port int `json:"port" env:"PICOCLAW_GATEWAY_PORT"`
|
||||
HotReload bool `json:"hot_reload" env:"PICOCLAW_GATEWAY_HOT_RELOAD"`
|
||||
LogLevel string `json:"log_level,omitempty" env:"PICOCLAW_LOG_LEVEL"`
|
||||
Host string `json:"host" env:"PICOCLAW_GATEWAY_HOST"`
|
||||
Port int `json:"port" env:"PICOCLAW_GATEWAY_PORT"`
|
||||
HotReload bool `json:"hot_reload" env:"PICOCLAW_GATEWAY_HOT_RELOAD"`
|
||||
LogLevel string `json:"log_level,omitempty" env:"PICOCLAW_LOG_LEVEL"`
|
||||
AllowedCIDRs []string `json:"allowed_cidrs,omitempty"`
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -438,9 +438,15 @@ func setupAndStartServices(
|
|||
}
|
||||
|
||||
if runningServices.ListenHost == gatewayFallbackBindHost {
|
||||
fmt.Printf("✓ Health endpoints available on all interfaces at port %d (/health, /ready and /reload POST)\n", cfg.Gateway.Port)
|
||||
fmt.Printf(
|
||||
"✓ Health endpoints available on all interfaces at port %d (/health, /ready and /reload POST)\n",
|
||||
cfg.Gateway.Port,
|
||||
)
|
||||
} else {
|
||||
fmt.Printf("✓ Health endpoints available at http://%s/health, /ready and /reload (POST)\n", runningServices.ListenAddr)
|
||||
fmt.Printf(
|
||||
"✓ Health endpoints available at http://%s/health, /ready and /reload (POST)\n",
|
||||
runningServices.ListenAddr,
|
||||
)
|
||||
}
|
||||
if len(runningServices.EffectiveCIDRs) > 0 {
|
||||
fmt.Printf("✓ Gateway CIDR allowlist enabled: %s\n", strings.Join(runningServices.EffectiveCIDRs, ", "))
|
||||
|
|
|
|||
|
|
@ -30,7 +30,11 @@ var (
|
|||
discoverGatewayCIDRs = discoverLocalInterfaceCIDRs
|
||||
)
|
||||
|
||||
func resolveGatewayListenDecision(configuredHost string, port int, configuredCIDRs []string) (*gatewayListenDecision, error) {
|
||||
func resolveGatewayListenDecision(
|
||||
configuredHost string,
|
||||
port int,
|
||||
configuredCIDRs []string,
|
||||
) (*gatewayListenDecision, error) {
|
||||
host := strings.TrimSpace(configuredHost)
|
||||
if host == "" {
|
||||
host = gatewayDefaultLoopbackHost
|
||||
|
|
@ -94,11 +98,17 @@ func resolveGatewayListenDecision(configuredHost string, port int, configuredCID
|
|||
}
|
||||
|
||||
return &gatewayListenDecision{
|
||||
BindHost: gatewayFallbackBindHost,
|
||||
Port: port,
|
||||
AllowedCIDRs: fallbackCIDRs,
|
||||
AutoFallback: true,
|
||||
FallbackReason: fmt.Sprintf("loopback bind %s:%d failed, fallback to %s:%d with CIDR allowlist", host, port, gatewayFallbackBindHost, port),
|
||||
BindHost: gatewayFallbackBindHost,
|
||||
Port: port,
|
||||
AllowedCIDRs: fallbackCIDRs,
|
||||
AutoFallback: true,
|
||||
FallbackReason: fmt.Sprintf(
|
||||
"loopback bind %s:%d failed, fallback to %s:%d with CIDR allowlist",
|
||||
host,
|
||||
port,
|
||||
gatewayFallbackBindHost,
|
||||
port,
|
||||
),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +169,8 @@ func discoverLocalInterfaceCIDRs() ([]string, error) {
|
|||
continue
|
||||
}
|
||||
ip := ipNet.IP
|
||||
if ip.IsLoopback() || ip.IsUnspecified() || ip.IsMulticast() || ip.IsInterfaceLocalMulticast() || ip.IsLinkLocalMulticast() || ip.IsLinkLocalUnicast() {
|
||||
if ip.IsLoopback() || ip.IsUnspecified() || ip.IsMulticast() ||
|
||||
ip.IsInterfaceLocalMulticast() || ip.IsLinkLocalMulticast() || ip.IsLinkLocalUnicast() {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue