config

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Port         uint16              // MediaWarp开放端口
	MediaServer  MediaServerSetting  // 上游媒体服务器设置
	Logger       LoggerSetting       // 日志设置
	Cache        CacheSetting        // 缓存设置
	Web          WebSetting          // Web服务器设置
	ClientFilter ClientFilterSetting // 客户端过滤设置
	HTTPStrm     HTTPStrmSetting     // HTTPSTRM设置
	AlistStrm    AlistStrmSetting    // AlistStrm设置
	Subtitle     SubtitleSetting     // 字幕设置
)

Functions

func AccessLogPath

func AccessLogPath() string

访问日志文件路径

func ConfigDir

func ConfigDir() string

配置文件目录

func ConfigPath

func ConfigPath() string

配置文件路径

func CostomDir

func CostomDir() string

静态资源文件目录

用户自定义静态文件存放地址

func Init

func Init(path string) error

初始化configManager

func ListenAddr

func ListenAddr() string

MediaWarp监听地址

监听所有网卡

func LogDir

func LogDir() string

获取日志目录

总日志目录 ./logs

func LogDirWithDate

func LogDirWithDate() string

获取日志目录

带有日期 ./logs/2024-9-29

func ServiceLogPath

func ServiceLogPath() string

服务日志文件路径

Types

type AlistSetting

type AlistSetting struct {
	ADDR       string   `yaml:"addr"`
	Username   string   `yaml:"username"`
	Password   string   `yaml:"password"`
	Token      *string  `yaml:"token"`
	PrefixList []string `yaml:"prefix_list"`
}

AlistStrm具体设置

type AlistStrmSetting

type AlistStrmSetting struct {
	Enable bool           `yaml:"enable"`
	Proxy  bool           `yaml:"proxy"`   // 开启后支持媒体服务器串流、转码播放
	RawURL bool           `yaml:"raw_url"` // 是否使用原始 URL
	List   []AlistSetting `yaml:"list"`
}

AlistStrm播放设置

type BaseLoggerSetting

type BaseLoggerSetting struct {
	Console bool `yaml:"console"` // 是否将日志输出到终端中
	File    bool `yaml:"file"`    // 是否将日志输出到文件中
}

基础日志配置字段

type CacheSetting

type CacheSetting struct {
	Enable      bool          `yaml:"enable"`
	HTTPStrmTTL time.Duration `yaml:"http_strm_ttl"`
	AlistAPITTL time.Duration `yaml:"alist_api_ttl"`
	ImageTTL    time.Duration `yaml:"image_ttl"`
	SubtitleTTL time.Duration `yaml:"subtitle_ttl"`
}

缓存设置

type ClientFilterSetting

type ClientFilterSetting struct {
	Enable     bool                 `yaml:"enable"`
	Mode       constants.FliterMode `yaml:"mode"`
	ClientList []string             `yaml:"list"`
}

客户端User-Agent过滤设置

type HTTPStrmSetting

type HTTPStrmSetting struct {
	Enable            bool     `yaml:"enable"`
	Proxy             bool     `yaml:"proxy"`              // 开启后支持媒体服务器串流、转码播放
	FinalURL          bool     `yaml:"final_url"`          // 对 URL 进行重定向判断,找到非重定向地址再重定向给客户端,减少客户端重定向次数
	CompatibilityMode bool     `yaml:"compatibility_mode"` // 兼容模式,开启后将使用更兼容但效率较低的方式获取最终 URL
	PrefixList        []string `yaml:"prefix_list"`
}

HTTPStrm播放设置

type LoggerSetting

type LoggerSetting struct {
	AccessLogger  BaseLoggerSetting `yaml:"access"`  // 访问日志相关配置
	ServiceLogger BaseLoggerSetting `yaml:"service"` // 服务日志相关配置
}

日志设置

type MediaServerSetting

type MediaServerSetting struct {
	Type constants.MediaServerType `yaml:"type"` // 媒体服务器类型
	ADDR string                    `yaml:"addr"` // 地址
	AUTH string                    `yaml:"auth"` // 认证授权KEY
}

上游媒体服务器相关设置

type Setting

type Setting struct {
	Port         uint16              `yaml:"port"`
	MediaServer  MediaServerSetting  `yaml:"server"`
	Logger       LoggerSetting       `yaml:"log"`
	Cache        CacheSetting        `yaml:"cache"`
	Web          WebSetting          `yaml:"web"`
	ClientFilter ClientFilterSetting `yaml:"client"`
	HTTPStrm     HTTPStrmSetting     `yaml:"http_strm"`
	AlistStrm    AlistStrmSetting    `yaml:"alist_strm"`
	Subtitle     SubtitleSetting     `yaml:"subtitle"`
}

type SubtitleSetting

type SubtitleSetting struct {
	Enable   bool     `yaml:"enable"`
	SRT2ASS  bool     `yaml:"srt2ass"` // SRT 字幕转 ASS 字幕
	ASSStyle []string `yaml:"ass_style"`
	SubSet   bool     `yaml:"subset"` // ASS 字幕字体子集化
}

字幕设置

type VersionInfo

type VersionInfo struct {
	AppVersion string `json:"app_version"` // 程序版本号
	CommitHash string `json:"commit_hash"` // GIt Commit Hash
	BuildDate  string `json:"build_date"`  // 编译时间
	GoVersion  string `json:"go_version"`  // 编译 Golang 版本
	OS         string `json:"os"`          // 操作系统
	Arch       string `json:"arch"`        //  架构
}

程序版本信息

func Version

func Version() *VersionInfo

获取版本信息

type WebSetting

type WebSetting struct {
	Enable            bool   `yaml:"enable"`              // 启用自定义前端设置
	Custom            bool   `yaml:"custom"`              // 启用用户自定义静态资源
	Index             bool   `yaml:"index"`               // 是否从 custom 目录读取 index.html 文件作为首页
	Head              string `yaml:"head"`                // 添加到 index.html 的 HEAD 中
	Robots            string `yaml:"robots"`              // 自定义 robots.txt,若为空表示不修改
	ExternalPlayerUrl bool   `yaml:"external_player_url"` // 是否开启外置播放器
	Crx               bool   `yaml:"crx"`                 // crx 美化
	ActorPlus         bool   `yaml:"actor_plus"`          // 过滤没有头像的演员和制作人员
	FanartShow        bool   `yaml:"fanart_show"`         // 显示同人图(fanart图)
	Danmaku           bool   `yaml:"danmaku"`             // Web 弹幕
	VideoTogether     bool   `yaml:"video_together"`      // VideoTogether
}

Web前端自定义设置

Jump to

Keyboard shortcuts

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