Documentation
¶
Overview ¶
Package iyuu 是 IYUU 辅种接口的客户端。
接口按 MIT 许可的 iyuuplus-dev 客户端(composer/reseed-client)核对:请求头 token,响应信封 {code, msg, data}, code 为 0 成功、429 限流(data 里有 Retry-After),其余为错误。只参考接口行为,不移植代码。
Index ¶
Constants ¶
View Source
const ( // DefaultBaseURL 是 IYUU 的接口地址(token 在请求头里,只用 https)。 DefaultBaseURL = "https://2025.iyuu.cn" // Version 是查询时报给 IYUU 的客户端版本,与现行 iyuuplus-dev 一致。 Version = "8.3.24" // MaxBatch 是一次查询最多的 info hash 数。 MaxBatch = 200 )
Variables ¶
View Source
var ErrNoToken = errors.New("没有设置 IYUU token")
ErrNoToken 表示没有配置 IYUU token。
Functions ¶
Types ¶
type Candidate ¶
type Candidate struct {
SID int `json:"sid"`
TorrentID string `json:"torrent_id"`
InfoHash string `json:"info_hash"`
}
Candidate 是一个可以辅种的种子:哪个站点(sid)、站内种子 ID、info hash。
func (*Candidate) UnmarshalJSON ¶
UnmarshalJSON 兼容 torrent_id 是数字或字符串两种写法。
type Client ¶
Client 调用 IYUU 接口。
func (*Client) Query ¶
func (c *Client) Query(ctx context.Context, hashes []string, sidSha1 string) (map[string][]Candidate, error)
Query 查询一批(最多 MaxBatch 个)info hash 的辅种结果:源 info hash → 可辅种的种子。
func (*Client) ReportExisting ¶
ReportExisting 报告用户开启辅种的站点(sid 列表),返回查询时要带的 sid_sha1(有效 7 天)。
type RateLimitError ¶
RateLimitError 是 IYUU 返回的 429:RetryAfter 之后再试。
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string
Click to show internal directories.
Click to hide internal directories.