config

package
v1.1.61 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GeoIpFS embed.FS
View Source
var HtmlFs embed.FS
View Source
var StaticFS embed.FS

Functions

func Parse

func Parse(path string) error

Parse 解析配置文件,支持本地文件系统和网络链接。 配置源未变化时直接返回(不重复解析)。

func ReadFile

func ReadFile(path string) ([]byte, error)

从本地文件或者http链接读取配置文件内容

Types

type ConfigOptions

type ConfigOptions struct {
	Domain                string   `json:"domain" yaml:"domain"`
	Port                  string   `json:"port" yaml:"port"`
	TLSEnable             bool     `json:"tls_enable" yaml:"tls_enable"`
	CertFile              string   `json:"cert_file" yaml:"cert_file"`
	KeyFile               string   `json:"key_file" yaml:"key_file"`
	DatabaseUrl           string   `json:"database_url" yaml:"database_url"`
	CrawlInterval         uint64   `json:"crawl-interval" yaml:"crawl-interval"`
	CFEmail               string   `json:"cf_email" yaml:"cf_email"`
	CFKey                 string   `json:"cf_key" yaml:"cf_key"`
	SourceFiles           []string `json:"source-files" yaml:"source-files"`
	SpeedTest             bool     `json:"speedtest" yaml:"speedtest"`
	SpeedTestInterval     uint64   `json:"speedtest-interval" yaml:"speedtest-interval"`
	SpeedCountryWhiteList string   `json:"speed-country-white-list" yaml:"speed-country-white-list"`
	Connection            int      `json:"connection" yaml:"connection"`
	Timeout               int      `json:"timeout" yaml:"timeout"`
	ActiveFrequency       uint16   `json:"active-frequency" yaml:"active-frequency" `
	ActiveInterval        uint64   `json:"active-interval" yaml:"active-interval"`
	ActiveMaxNumber       uint16   `json:"active-max-number" yaml:"active-max-number"`
	TgChannelProxyUrl     string   `json:"tg_channel_proxy_url" yaml:"tg_channel_proxy_url"`
	V2WsHeaderUserAgent   string   `json:"v2_ws_header_user_agent" yaml:"v2_ws_header_user_agent"`
	GeoipDbUrl            string   `json:"geoip_db_url" yaml:"geoip_db_url"`

	SubBestNodeInterval uint64          `json:"sub-best-node-interval" yaml:"sub-best-node-interval"`
	SubIpUrl            []string        `json:"sub_ip_url" yaml:"sub_ip_url"`
	SubIpListUrl        []string        `json:"sub_ip_list_url" yaml:"sub_ip_list_url"`
	SniProbe            *SniProbeConfig `json:"sni_probe" yaml:"sni_probe"`
	HealthcheckTestURLs []string        `json:"healthcheck_test_urls" yaml:"healthcheck_test_urls"`
	ProxyInfo           ProxyInfo       `json:"proxy_info" yaml:"proxy_info"`
	CfBestIp            []string        `json:"cf_best_ip" yaml:"cf_best_ip"`
}

func Config

func Config() *ConfigOptions

Config 配置 var Config ConfigOptions

type ProxyInfo added in v1.0.0

type ProxyInfo map[string]ProxyType

type ProxyType added in v1.0.0

type ProxyType map[string]map[string]interface{}

type SniProbeConfig added in v1.1.60

type SniProbeConfig struct {
	Enable      *bool  `json:"enable" yaml:"enable"`
	Concurrency int    `json:"concurrency" yaml:"concurrency"`
	Timeout     int    `json:"timeout" yaml:"timeout"`
	Country     string `json:"country" yaml:"country"`
	TestURL     string `json:"test_url" yaml:"test_url"`
}

SniProbeConfig best 节点 SNI proxy(TCP 透传入口)可用性探测配置。 探测方式为真实 anytls 握手 + 数据往返(URLTest),是区分 HTTP 反代(443) 与 SNI proxy 的最可靠手段;标记的是 ip:port 能否透传 anytls 等原始 TCP 协议。 Enable 用 *bool:nil 表示配置了 sni_probe 段但未写 enable(默认开启), 显式 false 才关闭;整个段缺失(SniProbe == nil)表示未启用。

func (*SniProbeConfig) Enabled added in v1.1.60

func (p *SniProbeConfig) Enabled() bool

Enabled 探测开关:段缺失=false;段存在且 enable 未写=默认 true;显式 false=关闭

type Source

type Source struct {
	Type    string       `json:"type" yaml:"type"`
	Options tool.Options `json:"options" yaml:"options"`
}

Jump to

Keyboard shortcuts

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