configutil

package
v0.3.0-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirPerm     = 0777
	DirPermTemp = 0700
	FilePerm    = 0666
)
View Source
const (
	// DefaultUserAgent is the true/identifying UA for Javinizer.
	DefaultUserAgent = "Javinizer (+https://github.com/javinizer/Javinizer)"

	// DefaultFakeUserAgent is a browser-like UA for scraper-hostile sites.
	// Used as fallback when scraper UserAgent is not set.
	DefaultFakeUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36"
)

Variables

This section is empty.

Functions

func ApplyUmask

func ApplyUmask(perm os.FileMode) os.FileMode

func StoreUmask

func StoreUmask(mask int)

func ValidateFlareSolverrConfig

func ValidateFlareSolverrConfig(path string, cfg FlareSolverrConfig) error

ValidateFlareSolverrConfig validates FlareSolverr configuration

func ValidateHTTPBaseURL

func ValidateHTTPBaseURL(path, raw string) error

ValidateHTTPBaseURL validates that a base URL is a valid HTTP or HTTPS URL.

func ValidateRequestDelay

func ValidateRequestDelay(path string, delay int) error

ValidateRequestDelay validates request delay configuration

Types

type FlareSolverrConfig

type FlareSolverrConfig struct {
	Enabled    bool   `yaml:"enabled" json:"enabled"`         // Enable FlareSolverr for bypassing Cloudflare
	URL        string `yaml:"url" json:"url"`                 // FlareSolverr endpoint (default: http://localhost:8191/v1)
	Timeout    int    `yaml:"timeout" json:"timeout"`         // Request timeout in seconds (default: 30)
	MaxRetries int    `yaml:"max_retries" json:"max_retries"` // Max retry attempts for FlareSolverr calls (default: 3)
	SessionTTL int    `yaml:"session_ttl" json:"session_ttl"` // Session TTL in seconds (default: 300)
}

FlareSolverrConfig holds FlareSolverr configuration for bypassing Cloudflare Copied from internal/config to avoid circular dependency

type UserAgentString

type UserAgentString struct {
	Value string
}

UserAgentString is a custom User-Agent string type that marshals/unmarshals as a plain string.

func (UserAgentString) MarshalJSON

func (u UserAgentString) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler so UserAgentString marshals as a plain string.

func (UserAgentString) MarshalYAML

func (u UserAgentString) MarshalYAML() (interface{}, error)

MarshalYAML implements custom marshaling so the field serializes as a plain string.

func (*UserAgentString) Scan

func (u *UserAgentString) Scan(value interface{}) error

Scan implements sql.Scanner for database compatibility.

func (*UserAgentString) UnmarshalJSON

func (u *UserAgentString) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler so UserAgentString unmarshals from a plain string or an object with a "value" field.

func (*UserAgentString) UnmarshalYAML

func (u *UserAgentString) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements custom unmarshaling so the field accepts a plain string.

Jump to

Keyboard shortcuts

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