utils

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2022 License: MPL-2.0 Imports: 29 Imported by: 9

Documentation

Index

Constants

View Source
const (
	SSRServer = iota
	SSRPort
	SSRProtocol
	SSRCipher
	SSROBFS
	SSRSuffix
)

Variables

This section is empty.

Functions

func Base64DecodeStripped

func Base64DecodeStripped(s string) (string, error)

func CopyFile

func CopyFile(from, to string) error

func Disable

func Disable()

func DownloadWithProgressbar

func DownloadWithProgressbar(fileUrl, fileName string) error

func DownloadWithProgressbarWithTimeout

func DownloadWithProgressbarWithTimeout(fileUrl, fileName string, timeout time.Duration) error

func EnableSysPac

func EnableSysPac(proxy string)

func EnableSysProxy

func EnableSysProxy(proxy string)

func FileExists

func FileExists(path string) bool

func FileRead

func FileRead(filename string) (content string, err error)

func FileReadByLine added in v0.0.7

func FileReadByLine(fileName string, logic func(line string) error) error

func FileWrite

func FileWrite(filename string, content string) error

func GenPassword added in v0.0.7

func GenPassword(key, pwd string) string

func GetConfigDir

func GetConfigDir() string

func GetExecPath

func GetExecPath() string

func GetExitSign

func GetExitSign() chan os.Signal

func GetFileModTime

func GetFileModTime(path string) time.Time

func GetProxyNodeType

func GetProxyNodeType(u string) types.ProxyNodeType

func GetPwd

func GetPwd() string

func GetRealIpFromCtx

func GetRealIpFromCtx(ctx *fiber.Ctx) string

func GetUserConfigDir

func GetUserConfigDir() string

func GetUserHomeDir

func GetUserHomeDir() string

func IsDir

func IsDir(path string) bool

func IsFile

func IsFile(path string) bool

func IsIp

func IsIp(ip string) bool

func IsIpV4

func IsIpV4(ip string) bool

func IsIpV6

func IsIpV6(ip string) bool

func Md5

func Md5(s string) string

func Now

func Now() uint32

func RandStringRunes

func RandStringRunes(n int) string

func Sha224

func Sha224(s string) string

func Sha256

func Sha256(s string) string

func Sha384

func Sha384(s string) string

func Sha512

func Sha512(s string) string

func ShortStr

func ShortStr(str string, max int) string

func ShortStr4Web

func ShortStr4Web(str string, max int) string

Types

type ClashRSSR

type ClashRSSR struct {
	Name          string      `json:"name"`
	Type          string      `json:"type"`
	Server        string      `json:"server"`
	Port          interface{} `json:"port"`
	Password      string      `json:"password"`
	Cipher        string      `json:"cipher"`
	Protocol      string      `json:"protocol"`
	ProtocolParam string      `json:"protocol-param"`
	OBFS          string      `json:"obfs"`
	OBFSParam     string      `json:"obfs-param"`
}

type ClashSS

type ClashSS struct {
	Name       string      `json:"name"`
	Type       string      `json:"type"`
	Server     string      `json:"server"`
	Port       interface{} `json:"port"`
	Password   string      `json:"password"`
	Cipher     string      `json:"cipher"`
	Plugin     string      `json:"plugin"`
	PluginOpts PluginOpts  `json:"plugin-opts"`
}

type ClashVmess

type ClashVmess struct {
	Name           string            `json:"name,omitempty"`
	Type           string            `json:"type,omitempty"`
	Server         string            `json:"server,omitempty"`
	Port           interface{}       `json:"port,omitempty"`
	UUID           string            `json:"uuid,omitempty"`
	AlterID        interface{}       `json:"alterId,omitempty"`
	Cipher         string            `json:"cipher,omitempty"`
	TLS            bool              `json:"tls,omitempty"`
	Network        string            `json:"network,omitempty"`
	WSPATH         string            `json:"ws-path,omitempty"`
	WSHeaders      map[string]string `json:"ws-headers,omitempty"`
	SkipCertVerify bool              `json:"skip-cert-verify,omitempty"`
}

type Ecc

type Ecc struct {
	// contains filtered or unexported fields
}

func NewEcc

func NewEcc() *Ecc

func (*Ecc) ECCDecrypt

func (p *Ecc) ECCDecrypt(ct string) (string, error)

ecc(ecies)解密

func (*Ecc) ECCEncrypt

func (p *Ecc) ECCEncrypt(pt interface{}) (string, error)

ess 加密

func (*Ecc) ECCEncrypt4Bytes

func (p *Ecc) ECCEncrypt4Bytes(pt []byte) (string, error)

ess 加密

func (*Ecc) ECCEncrypt4Str

func (p *Ecc) ECCEncrypt4Str(pt string) (string, error)

ess 加密

func (*Ecc) EccSign

func (p *Ecc) EccSign(pt []byte) (sign []byte, err error)

ecc签名

func (*Ecc) EccSignVer

func (p *Ecc) EccSignVer(pt, sign []byte) bool

ecc验签

func (*Ecc) GetPrivate

func (p *Ecc) GetPrivate() *ecdsa.PrivateKey

func (*Ecc) Init

func (p *Ecc) Init(key string) error

type PluginOpts

type PluginOpts struct {
	Mode string `json:"mode"`
	Host string `json:"host"`
}

type SSD

type SSD struct {
	Airport      string  `json:"airport"`
	Port         int     `json:"port"`
	Encryption   string  `json:"encryption"`
	Password     string  `json:"password"`
	TrafficUsed  float64 `json:"traffic_used"`
	TrafficTotal float64 `json:"traffic_total"`
	Expiry       string  `json:"expiry"`
	URL          string  `json:"url"`
	Servers      []struct {
		ID            int     `json:"id"`
		Server        string  `json:"server"`
		Ratio         float64 `json:"ratio"`
		Remarks       string  `json:"remarks"`
		Port          string  `json:"port"`
		Encryption    string  `json:"encryption"`
		Password      string  `json:"password"`
		Plugin        string  `json:"plugin"`
		PluginOptions string  `json:"plugin_options"`
	} `json:"servers"`
}

type Trojan

type Trojan struct {
	Name     string      `json:"name"`
	Type     string      `json:"type"`
	Server   string      `json:"server"`
	Password string      `json:"password"`
	Sni      string      `json:"sni,omitempty"`
	Port     interface{} `json:"port"`
}

type Vmess

type Vmess struct {
	Add  string      `json:"add"`
	Aid  interface{} `json:"aid"`
	Host string      `json:"host"`
	ID   string      `json:"id"`
	Net  string      `json:"net"`
	Path string      `json:"path"`
	Port interface{} `json:"port"`
	PS   string      `json:"ps"`
	TLS  string      `json:"tls"`
	Type string      `json:"type"`
	V    interface{} `json:"v"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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