Documentation
¶
Overview ¶
Package bootstrap 提供 goed2k 客户端的共享初始化逻辑: 配置映射、状态加载、监听启动,以及服务器 / DHT 后台引导。
CLI(cmd/goed2k)与 github.com/goed2k/daemon(https://github.com/goed2k/daemon) 均可复用此包。
Index ¶
- Constants
- func BuildSettings(cfg Config) (ed2k.Settings, error)
- func DefaultStatePath() string
- func InitClient(cfg Config, logger *slog.Logger) (*ed2k.Client, error)
- func RunBackground(client *ed2k.Client, cfg Config, notify Notifier)
- func SplitCommaList(value string) []string
- type Config
- type Notifier
Constants ¶
View Source
const ( DefaultServerList = "" /* 128-byte string literal not displayed */ DefaultServerMet = "ed2k://|serverlist|http://upd.emule-security.org/server.met|/" DefaultNodesDat = "http://www.alldivx.de/nodes/nodes.dat,https://upd.emule-security.org/nodes.dat" )
Variables ¶
This section is empty.
Functions ¶
func BuildSettings ¶
BuildSettings maps Config to library Settings.
func DefaultStatePath ¶
func DefaultStatePath() string
DefaultStatePath returns the per-user state file location.
func InitClient ¶
InitClient creates a client, optionally loads persisted state, and starts listening.
func RunBackground ¶
RunBackground starts server/DHT bootstrap goroutines.
func SplitCommaList ¶
SplitCommaList splits a comma-separated list and trims empty entries.
Types ¶
type Config ¶
type Config struct {
Links []string
OutDir string
ServerAddr string
ServerMetPath string
ListenPort int
UDPPort int
UDPPortV6 int
EnableKAD bool
EnableKADV6 bool
EnableUPnP bool
EnableCryptLayer bool
EnableCryptLayerRequired bool
EnableSecIdent bool
SecIdentRequired bool
CreditsOnlyVerified bool
IdentityKeyPath string
CategoriesConfig string
KADNodesDat string
KADNodes string
KADV6NodesDat string
KADV6Nodes string
PeerTimeout int
MaxDownloadRateKB int
MaxUploadRateKB int
Timeout time.Duration
StatePath string
DisableState bool
}
Config holds runtime options for the goed2k CLI.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns library defaults aligned with the CLI.
Click to show internal directories.
Click to hide internal directories.