Skip to content

Commit

Permalink
chore: Working with unix directory
Browse files Browse the repository at this point in the history
  • Loading branch information
xishang0128 committed Apr 17, 2024
1 parent a878254 commit 189b7b9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions hub/route/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"encoding/json"
"net"
"net/http"
"os"
"path/filepath"
"runtime/debug"
"strings"
"syscall"
Expand Down Expand Up @@ -157,6 +159,14 @@ func Start(addr string, tlsAddr string, secret string,
}

func StartUnix(addr string, isDebug bool) {
dir := filepath.Dir(addr)
if _, err := os.Stat(dir); os.IsNotExist(err) {
if err := os.MkdirAll(dir, 0o755); err != nil {
log.Errorln("External controller unix listen error: %s", err)
return
}
}

// https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
//
// Note: As mentioned above in the ‘security’ section, when a socket binds a socket to a valid pathname address,
Expand Down

0 comments on commit 189b7b9

Please sign in to comment.