Documentation
¶
Index ¶
- Variables
- func BuildDetectionIndex(configs []ProviderConfig) ([]PrefixEntry, []PatternEntry, PrefixIndex)
- func DetectProviderFromIndex(key string, prefixes []PrefixEntry, patterns []PatternEntry, ...) string
- func GetCategories() ([]string, error)
- func GetProviderGroups() (map[string][]ProviderInfo, error)
- func InitValidators(proxy string, timeout int) (map[string]Validator, error)
- type DetectionResult
- type Detector
- type GenericValidator
- type MetadataConfig
- type MetadataFromValidation
- type PatternEntry
- type PrefixEntry
- type PrefixIndex
- type ProviderConfig
- type ProviderGroup
- type ProviderInfo
- type ValidationConfig
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var (
CustomProvidersDir string
)
Functions ¶
func BuildDetectionIndex ¶
func BuildDetectionIndex(configs []ProviderConfig) ([]PrefixEntry, []PatternEntry, PrefixIndex)
func DetectProviderFromIndex ¶
func DetectProviderFromIndex(key string, prefixes []PrefixEntry, patterns []PatternEntry, manualCategory string) string
func GetCategories ¶ added in v1.0.3
func GetProviderGroups ¶ added in v1.0.3
func GetProviderGroups() (map[string][]ProviderInfo, error)
Types ¶
type DetectionResult ¶ added in v1.0.4
func DetectProviderWithSuggestion ¶ added in v1.0.4
func DetectProviderWithSuggestion(key string, prefixes []PrefixEntry, patterns []PatternEntry, manualCategory string) DetectionResult
type Detector ¶
type Detector struct {
// contains filtered or unexported fields
}
func NewDetector ¶
func NewDetector() *Detector
func NewDetectorFromConfigs ¶
func NewDetectorFromConfigs(configs []ProviderConfig) *Detector
func (*Detector) DetectProvider ¶
func (*Detector) DetectProviderWithSuggestion ¶ added in v1.0.4
func (d *Detector) DetectProviderWithSuggestion(apiKey string, manualCategory string) DetectionResult
DetectProviderWithSuggestion returns detection result with suggestions if detection fails
type GenericValidator ¶
type GenericValidator struct {
// contains filtered or unexported fields
}
func NewGenericValidator ¶
func NewGenericValidator(cfg ProviderConfig, proxy string, timeout int) (*GenericValidator, error)
func NewGenericValidatorWithClient ¶
func NewGenericValidatorWithClient(cfg ProviderConfig, httpClient *http.Client, limiter *client.RateLimiterManager) *GenericValidator
func (*GenericValidator) KeyPatterns ¶
func (v *GenericValidator) KeyPatterns() []string
func (*GenericValidator) Name ¶
func (v *GenericValidator) Name() string
func (*GenericValidator) Validate ¶
func (v *GenericValidator) Validate(ctx context.Context, apiKey string) (*models.ValidationResult, error)
type MetadataConfig ¶
type MetadataConfig struct {
URL string `yaml:"url"`
Method string `yaml:"method"`
Auth string `yaml:"auth"`
Headers map[string]string `yaml:"headers"`
BalancePath string `yaml:"balance_path"`
Extract string `yaml:"extract"`
StoreAs string `yaml:"store_as"`
RegexExtract string `yaml:"regex_extract"`
RegexExtractMatch int `yaml:"regex_extract_match"`
}
type MetadataFromValidation ¶
type MetadataFromValidation struct {
BalancePath string `yaml:"balance_path"`
BalanceSubtractPath string `yaml:"balance_subtract_path"`
NamePath string `yaml:"name_path"`
NameFallbackPath string `yaml:"name_fallback_path"`
EmailPath string `yaml:"email_path"`
QuotaPath string `yaml:"quota_path"`
CreditsPath string `yaml:"credits_path"`
VIPLevelPath string `yaml:"vip_level_path"`
TeamNamePath string `yaml:"team_name_path"`
UsernamePath string `yaml:"username_path"`
RegexExtract string `yaml:"regex_extract"`
RegexExtractMatch int `yaml:"regex_extract_match"`
}
type PatternEntry ¶
type PrefixEntry ¶
type PrefixIndex ¶ added in v1.0.5
type PrefixIndex map[string][]PrefixEntry
type ProviderConfig ¶
type ProviderConfig struct {
Name string `yaml:"name"`
Category string `yaml:"category"`
KeyPrefixes []string `yaml:"key_prefixes"`
KeyPatterns []string `yaml:"key_patterns"`
Validation ValidationConfig `yaml:"validation"`
Metadata []MetadataConfig `yaml:"metadata"`
MetadataFromValidation *MetadataFromValidation `yaml:"metadata_from_validation"`
}
func LoadProviderConfigs ¶
func LoadProviderConfigs() ([]ProviderConfig, error)
type ProviderGroup ¶ added in v1.0.3
type ProviderGroup struct {
Prefix string
Providers []ProviderInfo
}
type ProviderInfo ¶
func FindProviderByName ¶ added in v1.0.3
func FindProviderByName(name string) ([]ProviderInfo, error)
func GetAllProviders ¶
func GetAllProviders() ([]ProviderInfo, error)
func GetProvidersByCategory ¶ added in v1.0.3
func GetProvidersByCategory(category string) ([]ProviderInfo, error)
type ValidationConfig ¶
Click to show internal directories.
Click to hide internal directories.