config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_PORT = 6968 // 'E' (0x69) + 'D' (0x68)
View Source
const DEFAULT_ZIPMODE = 1 // Zip filename encoding detection mode. 0 -  strict; 1 - guess the best (shift_jis > gbk)

Variables

View Source
var (
	Test1             = false
	Test2             = false
	VerboseLevel      = 0
	DefaultConfigFile = ""
	ConfigDir         = "" // "/root/.config/erodownloader"
	ConfigFilename    = "" // "erodownloader.toml"
	ConfigFile        = "" // Fullpath, e.g. "/root/.config/erodownloader/erodownloader.toml"
	ConfigName        = "" // "erodownloader"
	ConfigType        = "" // "toml"
	Data              *Config
	Db                *gorm.DB
)
View Source
var InternalClients = []*ClientConfig{
	{
		Name:     constants.LOCAL_CLIENT,
		Type:     "aria2",
		Url:      "http://localhost:6800/jsonrpc",
		SavePath: "",
		Internal: true,
		Local:    true,
	},
}

Internal local clients.

View Source
var InternalSites = []*SiteConfig{
	{
		Name:     "asmrc",
		Type:     "asmrconnecting",
		Url:      "https://asmrconnecting.xyz/",
		Internal: true,
	},
}

Functions

func Load

func Load() (err error)

func UpdateCookies

func UpdateCookies(userAgent string, cookies []*fhttp.Cookie) error

Types

type ClientConfig

type ClientConfig struct {
	Name     string
	Type     string // "aria2"
	SavePath string
	Url      string // "http://localhost:6800/jsonrpc"
	Token    string // secret or authorization token
	Internal bool
	Local    bool // the client is running in the same machine & fs as this tool
	Windows  bool // Windows use "\" as sep.
	Comment  string
}

func GetClientConfig

func GetClientConfig(name string) *ClientConfig

type Config

type Config struct {
	Sites        []*SiteConfig
	Clients      []*ClientConfig
	Passwords    []string
	SavePath     string // default save path for internal (local) clients
	Aria2Url     string // url of default local aria2 client
	Aria2Token   string // token of default local aria2 client
	FlareSolverr string // 'http://localhost:8191/v1'
	UserAgent    string
	Port         int             // web ui port
	Token        string          //web ui token
	Cookies      []*fhttp.Cookie // used keys: name, value, domain, path
}

func (*Config) GetCookieHeader

func (c *Config) GetCookieHeader(urlObj *url.URL) string

Return effective cookie header ("a=1; b=2" format) of provided urlObj. Currently, cookie path is ignored.

type SiteConfig

type SiteConfig struct {
	Name     string
	Aliases  []string
	Type     string
	Url      string
	Internal bool
	Comment  string
}

func GetSiteConfig

func GetSiteConfig(name string) *SiteConfig

func (*SiteConfig) GetName

func (siteConfig *SiteConfig) GetName() string

Jump to

Keyboard shortcuts

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