utils

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CurUser       *user.User
	UserName      string // system username
	HttpClient    = &http.Client{}
	DownZipSuffix string // "zip" or "gz"

	ClashUpdateCh  = make(chan int)
	ClashAppDir    string        // Clash Premium Dir
	ClashConfig    = ClashConf{} // Clash Premium config struct
	ClashPort      int           // 系统代理使用的端口
	ClashScheme    string        // 系统代理使用的协议
	CurrentWorkDir string        //
	ClashWebExe    string        // path_to_clashweb

)

Functions

func CheckStartup

func CheckStartup() bool

检查是否开机启动

func DeCompress

func DeCompress(dst, src, filename string) error

func Exec

func Exec(exe string, args ...string) (string, error)

执行命令,如果出错并弹出程序输出

func FileExists

func FileExists(file string) bool

func GbkToUtf8

func GbkToUtf8(s []byte) []byte

https://www.jianshu.com/p/9ebb1c152000 GBK 转 UTF-8

func GetSysProcAttr

func GetSysProcAttr() *syscall.SysProcAttr

func GetSystemProxy added in v1.0.6

func GetSystemProxy()

获取系统代理

func ReadConfig added in v1.0.5

func ReadConfig()

func Request

func Request(method, url string, query url.Values, headers map[string]string) (int64, []byte)

func RequestToFile

func RequestToFile(method, url, filename string, query url.Values, headers map[string]string) bool

func SetClashStartup

func SetClashStartup(enable bool) bool

设置 Clash 开机启动 https://blog.lovefan.club/2020/09/18/22.html

func SetSystemProxy

func SetSystemProxy(enable bool) bool

linux and mac 设置系统代理 https://mrjun.cn/Dy4ALDFDO/

Types

type ClashConf

type ClashConf struct {
	MixedPort   int    `yaml:"mixed-port"`
	Port        int    `yaml:"port"`
	SocksPort   int    `yaml:"socks-port"`
	RedirPort   int    `yaml:"redir-port"`
	TproxyPort  int    `yaml:"tproxy-port"`
	BindAddress string `yaml:"bind-address"`
}

type Downloader

type Downloader struct {
	io.Reader
	Total   int64
	Current int64
}

func (*Downloader) Read

func (d *Downloader) Read(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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