cmd

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:          "openserp",
	Short:        "Open SERP",
	Long:         `Get [Google, Yandex, Baidu] search engine results via API or CLI.`,
	Version:      version,
	SilenceUsage: true,
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		err := initializeConfig(cmd)
		if err != nil {
			return err
		}

		core.InitLogger(config.Server.IsVerbose, config.Server.IsDebug)
		logrus.Debugf("Final config: %+v", config)
		return nil
	},
}

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	Timeout       int    `mapstructure:"timeout"`
	BrowserPath   string `mapstructure:"browser_path"`
	IsBrowserHead bool   `mapstructure:"head"`
	IsLeaveHead   bool   `mapstructure:"leave_head"`
	IsLeakless    bool   `mapstructure:"leakless"`
	IsStealth     bool   `mapstructure:"stealth"`
}

type CORSConfig added in v0.6.0

type CORSConfig struct {
	Enabled      bool   `mapstructure:"enabled"`
	AllowOrigins string `mapstructure:"allow_origins"`
	AllowMethods string `mapstructure:"allow_methods"`
	AllowHeaders string `mapstructure:"allow_headers"`
	MaxAge       int    `mapstructure:"max_age"`
}

type CacheConfig added in v0.6.0

type CacheConfig struct {
	TTLSeconds int `mapstructure:"ttl_seconds"`
	MaxSize    int `mapstructure:"max_size"`
}

type CircuitBreakerConfig added in v0.6.0

type CircuitBreakerConfig struct {
	Failures        int `mapstructure:"failures"`
	RecoverySeconds int `mapstructure:"recovery_seconds"`
	Successes       int `mapstructure:"successes"`
}

type Config added in v0.2.1

type Config struct {
	Server           ServerConfig         `mapstructure:"server"`
	App              AppConfig            `mapstructure:"app"`
	Proxies          core.ProxiesConfig   `mapstructure:"proxies"`
	Cache            CacheConfig          `mapstructure:"cache"`
	Resilience       ResilienceConfig     `mapstructure:"resilience"`
	CircuitBreaker   CircuitBreakerConfig `mapstructure:"circuit_breaker"`
	CORS             CORSConfig           `mapstructure:"cors"`
	Config2Capcha    Config2Captcha       `mapstructure:"2captcha"`
	GoogleConfig     EngineConfig         `mapstructure:"google"`
	YandexConfig     EngineConfig         `mapstructure:"yandex"`
	BaiduConfig      EngineConfig         `mapstructure:"baidu"`
	BingConfig       EngineConfig         `mapstructure:"bing"`
	DuckDuckGoConfig EngineConfig         `mapstructure:"duckduckgo"`
}

type Config2Captcha added in v0.4.1

type Config2Captcha struct {
	ApiKey string `mapstructure:"apikey"`
}

type EngineConfig added in v0.6.0

type EngineConfig struct {
	core.SearchEngineOptions `mapstructure:",squash"`
	Proxy                    string `mapstructure:"proxy"`
}

type ResilienceConfig added in v0.6.0

type ResilienceConfig struct {
	MaxRetries            int  `mapstructure:"max_retries"`
	AllowEndpointFallback bool `mapstructure:"allow_endpoint_fallback"`
}

type ServerConfig added in v0.6.0

type ServerConfig struct {
	Host          string `mapstructure:"host"`
	Port          int    `mapstructure:"port"`
	ConfigPath    string `mapstructure:"config_path"`
	IsDebug       bool   `mapstructure:"debug"`
	IsVerbose     bool   `mapstructure:"verbose"`
	IsRawRequests bool   `mapstructure:"raw_requests"`
	Insecure      bool   `mapstructure:"insecure"`
}

Jump to

Keyboard shortcuts

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