common

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "clash"

Variables

View Source
var ExecutableDir = getExecutableDir()
View Source
var Path = func() *path {
	homeDir, err := os.UserHomeDir()
	if err != nil {
		homeDir, _ = os.Getwd()
	}

	homeDir = P.Join(homeDir, ".config", Name)
	return &path{homeDir: homeDir, configFile: "config.yaml"}
}()

Path is used to get the configuration path

Functions

func ExecCmd

func ExecCmd(cmdStr string) (string, error)

func ExtractZipFile added in v0.1.1

func ExtractZipFile(source, destination string) ([]string, error)

func InitResourcesIfNotExist added in v0.1.1

func InitResourcesIfNotExist()

func MakeRequest

func MakeRequest(c *Config) *resty.Client

func ResolveExecutableResourcesDir added in v0.1.1

func ResolveExecutableResourcesDir(path string) string

Types

type Config

type Config struct {
	ExternalController string `yaml:"external-controller" json:"external-controller"`
	ExternalUI         string `yaml:"external-ui" json:"external-ui"`
	Secret             string `yaml:"secret" json:"secret"`
}

func Parse

func Parse() (*Config, error)

func ParseConfig

func ParseConfig(buf []byte) (*Config, error)

func ParseWithPath

func ParseWithPath(path string) (*Config, error)

type HTTPError

type HTTPError struct {
	Message string `json:"message"`
}

Directories

Path Synopsis
Open a file, directory, or URI using the OS's default application for that object type.
Open a file, directory, or URI using the OS's default application for that object type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL