refactor: Change sockPath variable to constant in proxy initialization

* Update sockPath to a constant SockPath for improved clarity and consistency
* Ensure the new constant is used in the dialer function for Unix socket connections
This commit is contained in:
HynoR 2025-12-04 13:27:27 +08:00
parent 3a00bcb5b3
commit a47261ffd0

View file

@ -8,9 +8,9 @@ import (
"time"
)
var (
sockPath = "/etc/1panel/agent.sock"
const SockPath = "/etc/1panel/agent.sock"
var (
LocalAgentProxy *httputil.ReverseProxy
)
@ -19,7 +19,7 @@ func Init() {
Timeout: 5 * time.Second,
}
dialUnix := func(ctx context.Context, network, addr string) (net.Conn, error) {
return dialer.DialContext(ctx, "unix", sockPath)
return dialer.DialContext(ctx, "unix", SockPath)
}
transport := &http.Transport{
DialContext: dialUnix,