utils

package
v0.0.0-...-0e755ff Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CIns = Config{}

Functions

func JSONToMap

func JSONToMap(jsonStr string) (map[string]interface{}, error)

将JSON字符串转换为map的函数

func StructToJSON

func StructToJSON(v interface{}) (string, error)

将结构体转换为JSON字符串的函数

func StructToPrettyJSON

func StructToPrettyJSON(v interface{}) (string, error)

将结构体转换为格式化的JSON字符串的函数

Types

type AListDriverInfo

type AListDriverInfo struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Default  string `json:"default"`
	Options  string `json:"options"`
	Required bool   `json:"required"`
	Help     string `json:"help"`
}

type AListDriverInfoResp

type AListDriverInfoResp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Common     []AListDriverInfo    `json:"common"`
		Additional []DriverAdditionInfo `json:"additional"`
		Config     DriverConfig         `json:"config"`
	} `json:"data"`
}

type AListLoginResp

type AListLoginResp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Token string `json:"token"`
	} `json:"data"`
}

type Alist

type Alist struct {
	Url      string
	UserName string
	Password string
	OptCode  string
	Token    string
}

func (*Alist) GenerateConfigByApi

func (a *Alist) GenerateConfigByApi() (*models.EncrtptConfig, error)

func (*Alist) GetCryptDriverInfo

func (a *Alist) GetCryptDriverInfo() (*AListDriverInfoResp, error)

func (*Alist) GetCryptSorageId

func (a *Alist) GetCryptSorageId() (int, error)

func (*Alist) GetStorageIdByName

func (a *Alist) GetStorageIdByName(name string) (int, error)

func (*Alist) GetStorageInfo

func (a *Alist) GetStorageInfo(storageId int) (*StorageInfo, error)

func (*Alist) GetStorageInfoByName

func (a *Alist) GetStorageInfoByName(name string) (*StorageInfo, error)

func (*Alist) GetStorageList

func (a *Alist) GetStorageList() (*StorageListResp, error)

func (*Alist) HttpGet

func (a *Alist) HttpGet(url string, resp interface{}) error

func (*Alist) Login

func (a *Alist) Login() (string, error)

type Cipher

type Cipher struct {
	RcCipher *rcCrypt.Cipher
}
var CipherInstance *Cipher

func (*Cipher) NewCiper

func (c *Cipher) NewCiper(config *models.EncrtptConfig) (*rcCrypt.Cipher, error)

type Config

type Config struct {
	HomeDir       string
	AppSeriesDir  string
	AppDir        string
	AppConfigDir  string
	AppConfigFile string
	LogDir        string
}

func (*Config) CheckConfig

func (c *Config) CheckConfig() bool

func (*Config) GetAppConfigDir

func (c *Config) GetAppConfigDir() string

func (*Config) GetAppConfigFile

func (c *Config) GetAppConfigFile() string

func (*Config) GetAppDir

func (c *Config) GetAppDir() string

func (*Config) GetAppSeriesDir

func (c *Config) GetAppSeriesDir() string

func (*Config) GetHomeDir

func (c *Config) GetHomeDir() string

func (*Config) GetLogDir

func (c *Config) GetLogDir() string

func (*Config) ReadConfig

func (c *Config) ReadConfig() (*models.EncrtptConfig, error)

type DriverAdditionInfo

type DriverAdditionInfo struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Default  string `json:"default"`
	Options  string `json:"options"`
	Required bool   `json:"required"`
	Help     string `json:"help"`
}

type DriverConfig

type DriverConfig struct {
	Name        string `json:"name"`
	LocalSort   bool   `json:"local_sort"`
	OnlyLocal   bool   `json:"only_local"`
	OnlyProxy   bool   `json:"only_proxy"`
	NoCache     bool   `json:"no_cache"`
	NoUpload    bool   `json:"no_upload"`
	NeedMs      bool   `json:"need_ms"`
	DefaultRoot string `json:"default_root"`
	Alert       string `json:"alert"`
}

type StorageInfo

type StorageInfo struct {
	Code    int                `json:"code"`
	Message string             `json:"message"`
	Data    StorageInfoContent `json:"data"`
}

type StorageInfoContent

type StorageInfoContent struct {
	Id              int    `json:"id"`
	MountPath       string `json:"mount_path"`
	Order           int    `json:"order"`
	Driver          string `json:"driver"`
	CacheExpiration int    `json:"cache_expiration"`
	Status          string `json:"status"`
	Addition        string `json:"addition"`
	Remark          string `json:"remark"`
	Modified        string `json:"modified"`
	Disabled        bool   `json:"disabled"`
	EnableSign      bool   `json:"enable_sign"`
	OrderBy         string `json:"order_by"`
	OrderDirection  string `json:"order_direction"`
	ExtractFolder   string `json:"extract_folder"`
	WebProxy        bool   `json:"web_proxy"`
	WebdavPolicy    string `json:"webdav_policy"`
	DownProxyURL    string `json:"down_proxy_url"`
}

type StorageListResp

type StorageListResp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Content []StorageInfoContent `json:"content"`
		Total   int                  `json:"total"`
	}
}

Jump to

Keyboard shortcuts

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