chore(lint): fix golines formatting in gateway files

This commit is contained in:
Sakurapainting 2026-04-02 18:24:36 +08:00
parent 8c1b1feaad
commit be39b34b7b
3 changed files with 30 additions and 13 deletions

View file

@ -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, ", "))

View file

@ -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
@ -98,7 +102,13 @@ func resolveGatewayListenDecision(configuredHost string, port int, configuredCID
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),
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
}