change tcp to unix socket

This commit is contained in:
BoHung Chiu 2023-04-20 21:58:18 +08:00
parent c48d821994
commit 036a6dfe8f
1 changed files with 2 additions and 2 deletions

View File

@ -38,7 +38,7 @@ var (
key = kingpin.Flag("key", "Path to the client's TLS Certificate Private Key").ExistingFile() key = kingpin.Flag("key", "Path to the client's TLS Certificate Private Key").ExistingFile()
insecure = kingpin.Flag("insecure", "Controls whether a client verifies the server's certificate chain and host name").Short('k').Bool() insecure = kingpin.Flag("insecure", "Controls whether a client verifies the server's certificate chain and host name").Short('k').Bool()
chartsListenAddr = kingpin.Flag("listen", "Listen addr to serve Web UI").Default(":18888").String() chartsListenAddr = kingpin.Flag("listen", "Listen addr to serve Web UI").Default("test.sock").String()
timeout = kingpin.Flag("timeout", "Timeout for each http request").PlaceHolder("DURATION").Duration() timeout = kingpin.Flag("timeout", "Timeout for each http request").PlaceHolder("DURATION").Duration()
dialTimeout = kingpin.Flag("dial-timeout", "Timeout for dial addr").PlaceHolder("DURATION").Duration() dialTimeout = kingpin.Flag("dial-timeout", "Timeout for dial addr").PlaceHolder("DURATION").Duration()
reqWriteTimeout = kingpin.Flag("req-timeout", "Timeout for full request writing").PlaceHolder("DURATION").Duration() reqWriteTimeout = kingpin.Flag("req-timeout", "Timeout for full request writing").PlaceHolder("DURATION").Duration()
@ -269,7 +269,7 @@ func main() {
// charts listener // charts listener
var ln net.Listener var ln net.Listener
if *chartsListenAddr != "" { if *chartsListenAddr != "" {
ln, err = net.Listen("tcp", *chartsListenAddr) ln, err = net.Listen("unix", *chartsListenAddr)
if err != nil { if err != nil {
errAndExit(err.Error()) errAndExit(err.Error())
return return