package config import ( "errors" "fmt" "os" "time" ) const TimeFormat = "2006-01-02/15:04:05" const BufSize = 1024 const IoTimeout = 5 * time.Second var errNegativeUid = errors.New("negative uid") func GetSystemSocketPath() (string, error) { return "/run/tunnel/socket", nil } func GetSocketPath() (string, error) { uid := os.Getuid() switch uid { case -1: return "", errNegativeUid case 0: return GetSystemSocketPath() } return fmt.Sprintf("/run/user/%d/tunnel/socket", uid), nil }