mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-16 20:42:40 +08:00
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:
parent
3a00bcb5b3
commit
a47261ffd0
1 changed files with 3 additions and 3 deletions
|
|
@ -8,9 +8,9 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
const SockPath = "/etc/1panel/agent.sock"
|
||||||
sockPath = "/etc/1panel/agent.sock"
|
|
||||||
|
|
||||||
|
var (
|
||||||
LocalAgentProxy *httputil.ReverseProxy
|
LocalAgentProxy *httputil.ReverseProxy
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ func Init() {
|
||||||
Timeout: 5 * time.Second,
|
Timeout: 5 * time.Second,
|
||||||
}
|
}
|
||||||
dialUnix := func(ctx context.Context, network, addr string) (net.Conn, error) {
|
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{
|
transport := &http.Transport{
|
||||||
DialContext: dialUnix,
|
DialContext: dialUnix,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue