kleinCommand/common/unixSocket.go

19 lines
398 B
Go
Raw Permalink Normal View History

2025-07-20 00:47:03 +02:00
package common
import (
2025-07-20 18:46:55 +02:00
"net"
2025-07-20 00:47:03 +02:00
"os"
"path/filepath"
)
var ExampleServiceSocketPath = GetSocketPath(ExampleServiceName)
2025-07-20 18:46:55 +02:00
var ParrotServiceSocketPath = GetSocketPath(ParrotServiceName)
2025-07-20 00:47:03 +02:00
func GetSocketPath(serviceName string) string {
return filepath.Join(os.TempDir(), serviceName+".sock")
}
2025-07-20 18:46:55 +02:00
func GetSocketConnection(socketPath string) (net.Conn, error) {
return net.Dial("unix", socketPath)
}