Documentation
¶
Index ¶
- type Base64JSONFormatter
- type Base64Parser
- type ClashFormatter
- type ClashParser
- type EgernFormatter
- type Error
- type Formatter
- type JSONFormatter
- type LoonFormatter
- type Parser
- type QuantumultXFormatter
- type Registry
- func (r *Registry) AutoParse(content []byte) ([]*model.ParsedNode, error)
- func (r *Registry) GetFormatter(format model.SubscriptionFormat) (Formatter, bool)
- func (r *Registry) GetParser(name string) Parser
- func (r *Registry) RegisterFormatter(format model.SubscriptionFormat, f Formatter)
- func (r *Registry) RegisterParser(p Parser)
- type SIP008Parser
- type ShadowrocketFormatter
- type SingBoxFormatter
- type StashFormatter
- type SurgeFormatter
- type V2RayFormatter
- type WireGuardFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base64JSONFormatter ¶
type Base64JSONFormatter struct{}
Base64JSONFormatter Base64 编码的 JSON 格式化器 (你的自定义格式)
func (*Base64JSONFormatter) ContentType ¶
func (f *Base64JSONFormatter) ContentType() string
func (*Base64JSONFormatter) FileExtension ¶
func (f *Base64JSONFormatter) FileExtension() string
func (*Base64JSONFormatter) Format ¶
func (f *Base64JSONFormatter) Format(nodes []*model.ParsedNode, ctx *model.TemplateRenderContext) ([]byte, error)
func (*Base64JSONFormatter) Name ¶
func (f *Base64JSONFormatter) Name() string
type Base64Parser ¶
type Base64Parser struct{}
Base64Parser Base64 编码的 V2Ray 订阅解析器
func (*Base64Parser) Detect ¶
func (p *Base64Parser) Detect(content []byte) bool
func (*Base64Parser) Name ¶
func (p *Base64Parser) Name() string
func (*Base64Parser) Parse ¶
func (p *Base64Parser) Parse(content []byte) ([]*model.ParsedNode, error)
type ClashFormatter ¶
type ClashFormatter struct{}
ClashFormatter Clash YAML 格式化器 支持 Clash Meta (mihomo) 扩展功能
func (*ClashFormatter) ContentType ¶
func (f *ClashFormatter) ContentType() string
func (*ClashFormatter) FileExtension ¶
func (f *ClashFormatter) FileExtension() string
func (*ClashFormatter) Format ¶
func (f *ClashFormatter) Format(nodes []*model.ParsedNode, ctx *model.TemplateRenderContext) ([]byte, error)
func (*ClashFormatter) Name ¶
func (f *ClashFormatter) Name() string
type ClashParser ¶
type ClashParser struct{}
ClashParser Clash YAML 订阅解析器
func (*ClashParser) Detect ¶
func (p *ClashParser) Detect(content []byte) bool
func (*ClashParser) Name ¶
func (p *ClashParser) Name() string
func (*ClashParser) Parse ¶
func (p *ClashParser) Parse(content []byte) ([]*model.ParsedNode, error)
type EgernFormatter ¶
type EgernFormatter struct {
// contains filtered or unexported fields
}
EgernFormatter Egern 格式化器(兼容 Clash YAML)
func (*EgernFormatter) ContentType ¶
func (f *EgernFormatter) ContentType() string
func (*EgernFormatter) FileExtension ¶
func (f *EgernFormatter) FileExtension() string
func (*EgernFormatter) Format ¶
func (f *EgernFormatter) Format(nodes []*model.ParsedNode, ctx *model.TemplateRenderContext) ([]byte, error)
func (*EgernFormatter) Name ¶
func (f *EgernFormatter) Name() string
type Formatter ¶
type Formatter interface {
// Format 格式化节点列表
Format(nodes []*model.ParsedNode, ctx *model.TemplateRenderContext) ([]byte, error)
// ContentType 获取 MIME 类型
ContentType() string
// FileExtension 获取文件扩展名
FileExtension() string
// Name 获取格式化器名称
Name() string
}
Formatter 订阅格式化器接口 用于将 ParsedNode 列表转换为各种订阅格式
type JSONFormatter ¶
type JSONFormatter struct{}
JSONFormatter 原始 JSON 格式化器
func (*JSONFormatter) ContentType ¶
func (f *JSONFormatter) ContentType() string
func (*JSONFormatter) FileExtension ¶
func (f *JSONFormatter) FileExtension() string
func (*JSONFormatter) Format ¶
func (f *JSONFormatter) Format(nodes []*model.ParsedNode, ctx *model.TemplateRenderContext) ([]byte, error)
func (*JSONFormatter) Name ¶
func (f *JSONFormatter) Name() string
type LoonFormatter ¶
type LoonFormatter struct {
// contains filtered or unexported fields
}
LoonFormatter emits Loon's native node-subscription syntax. It is deliberately independent from the V2Ray, Shadowrocket, Clash, and Sing-box formatters so a Loon compatibility change cannot alter another client's subscription.
func (*LoonFormatter) ContentType ¶
func (f *LoonFormatter) ContentType() string
func (*LoonFormatter) FileExtension ¶
func (f *LoonFormatter) FileExtension() string
func (*LoonFormatter) Format ¶
func (f *LoonFormatter) Format(nodes []*model.ParsedNode, ctx *model.TemplateRenderContext) ([]byte, error)
func (*LoonFormatter) Name ¶
func (f *LoonFormatter) Name() string
type Parser ¶
type Parser interface {
// Parse 解析订阅内容
Parse(content []byte) ([]*model.ParsedNode, error)
// Detect 检测内容是否为该格式
Detect(content []byte) bool
// Name 获取解析器名称
Name() string
}
Parser 订阅解析器接口 用于解析各种订阅格式并转换为统一的 ParsedNode 格式
type QuantumultXFormatter ¶
type QuantumultXFormatter struct{}
QuantumultXFormatter Quantumult X 格式化器
func (*QuantumultXFormatter) ContentType ¶
func (f *QuantumultXFormatter) ContentType() string
func (*QuantumultXFormatter) FileExtension ¶
func (f *QuantumultXFormatter) FileExtension() string
func (*QuantumultXFormatter) Format ¶
func (f *QuantumultXFormatter) Format(nodes []*model.ParsedNode, ctx *model.TemplateRenderContext) ([]byte, error)
func (*QuantumultXFormatter) Name ¶
func (f *QuantumultXFormatter) Name() string
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry 解析器和格式化器注册表
func (*Registry) AutoParse ¶
func (r *Registry) AutoParse(content []byte) ([]*model.ParsedNode, error)
AutoParse 自动检测格式并解析
func (*Registry) GetFormatter ¶
func (r *Registry) GetFormatter(format model.SubscriptionFormat) (Formatter, bool)
GetFormatter 获取格式化器
func (*Registry) RegisterFormatter ¶
func (r *Registry) RegisterFormatter(format model.SubscriptionFormat, f Formatter)
RegisterFormatter 注册格式化器
type SIP008Parser ¶
type SIP008Parser struct{}
SIP008Parser SIP008 JSON 格式解析器
func (*SIP008Parser) Detect ¶
func (p *SIP008Parser) Detect(content []byte) bool
func (*SIP008Parser) Name ¶
func (p *SIP008Parser) Name() string
func (*SIP008Parser) Parse ¶
func (p *SIP008Parser) Parse(content []byte) ([]*model.ParsedNode, error)
type ShadowrocketFormatter ¶
type ShadowrocketFormatter struct {
// contains filtered or unexported fields
}
ShadowrocketFormatter Shadowrocket 格式化器
func (*ShadowrocketFormatter) ContentType ¶
func (f *ShadowrocketFormatter) ContentType() string
func (*ShadowrocketFormatter) FileExtension ¶
func (f *ShadowrocketFormatter) FileExtension() string
func (*ShadowrocketFormatter) Format ¶
func (f *ShadowrocketFormatter) Format(nodes []*model.ParsedNode, ctx *model.TemplateRenderContext) ([]byte, error)
func (*ShadowrocketFormatter) Name ¶
func (f *ShadowrocketFormatter) Name() string
type SingBoxFormatter ¶
type SingBoxFormatter struct{}
SingBoxFormatter Sing-box JSON 格式化器
func (*SingBoxFormatter) ContentType ¶
func (f *SingBoxFormatter) ContentType() string
func (*SingBoxFormatter) FileExtension ¶
func (f *SingBoxFormatter) FileExtension() string
func (*SingBoxFormatter) Format ¶
func (f *SingBoxFormatter) Format(nodes []*model.ParsedNode, ctx *model.TemplateRenderContext) ([]byte, error)
func (*SingBoxFormatter) Name ¶
func (f *SingBoxFormatter) Name() string
type StashFormatter ¶
type StashFormatter struct {
// contains filtered or unexported fields
}
StashFormatter Stash 格式化器(兼容 Clash YAML)
func (*StashFormatter) ContentType ¶
func (f *StashFormatter) ContentType() string
func (*StashFormatter) FileExtension ¶
func (f *StashFormatter) FileExtension() string
func (*StashFormatter) Format ¶
func (f *StashFormatter) Format(nodes []*model.ParsedNode, ctx *model.TemplateRenderContext) ([]byte, error)
func (*StashFormatter) Name ¶
func (f *StashFormatter) Name() string
type SurgeFormatter ¶
type SurgeFormatter struct{}
SurgeFormatter Surge 格式化器
func (*SurgeFormatter) ContentType ¶
func (f *SurgeFormatter) ContentType() string
func (*SurgeFormatter) FileExtension ¶
func (f *SurgeFormatter) FileExtension() string
func (*SurgeFormatter) Format ¶
func (f *SurgeFormatter) Format(nodes []*model.ParsedNode, ctx *model.TemplateRenderContext) ([]byte, error)
func (*SurgeFormatter) Name ¶
func (f *SurgeFormatter) Name() string
type V2RayFormatter ¶
type V2RayFormatter struct{}
V2RayFormatter V2Ray Base64 格式化器 符合 V2bX/Xray 协议配置规范
func (*V2RayFormatter) ContentType ¶
func (f *V2RayFormatter) ContentType() string
func (*V2RayFormatter) FileExtension ¶
func (f *V2RayFormatter) FileExtension() string
func (*V2RayFormatter) Format ¶
func (f *V2RayFormatter) Format(nodes []*model.ParsedNode, ctx *model.TemplateRenderContext) ([]byte, error)
func (*V2RayFormatter) Name ¶
func (f *V2RayFormatter) Name() string
type WireGuardFormatter ¶
type WireGuardFormatter struct{}
WireGuardFormatter emits native WireGuard configuration blocks. The format is intentionally plain .conf so clients that support WireGuard import can use it without depending on non-standard URI schemes.
func (*WireGuardFormatter) ContentType ¶
func (f *WireGuardFormatter) ContentType() string
func (*WireGuardFormatter) FileExtension ¶
func (f *WireGuardFormatter) FileExtension() string
func (*WireGuardFormatter) Format ¶
func (f *WireGuardFormatter) Format(nodes []*model.ParsedNode, ctx *model.TemplateRenderContext) ([]byte, error)
func (*WireGuardFormatter) Name ¶
func (f *WireGuardFormatter) Name() string