mirror of
https://gitee.com/wanwujie/sub2api
synced 2026-04-26 09:24:48 +08:00
22 lines
693 B
Go
22 lines
693 B
Go
|
|
package service
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
"context"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// QuotaFetcher 额度获取接口,各平台实现此接口
|
|||
|
|
type QuotaFetcher interface {
|
|||
|
|
// CanFetch 检查是否可以获取此账户的额度
|
|||
|
|
CanFetch(account *Account) bool
|
|||
|
|
// GetProxyURL 获取账户的代理 URL(如果没有代理则返回空字符串)
|
|||
|
|
GetProxyURL(ctx context.Context, account *Account) (string, error)
|
|||
|
|
// FetchQuota 获取账户额度信息
|
|||
|
|
FetchQuota(ctx context.Context, account *Account, proxyURL string) (*QuotaResult, error)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// QuotaResult 额度获取结果
|
|||
|
|
type QuotaResult struct {
|
|||
|
|
UsageInfo *UsageInfo // 转换后的使用信息
|
|||
|
|
Raw map[string]any // 原始响应,可存入 account.Extra
|
|||
|
|
}
|