Documentation ¶
Index ¶
- Constants
- Variables
- func CanonicalModelID(name string) string
- func ChaturbateCanonicalModelID(name string) string
- func CheckErr(err error)
- func CloseBody(body io.Closer)
- func Flirt4FreeCanonicalModelID(name string) string
- func HashDiffAll(before, after map[string]bool) []string
- func HashDiffNewRemoved(before, after map[string]bool) (new []string, removed []string)
- func Ldbg(format string, v ...interface{})
- func Lerr(format string, v ...interface{})
- func Linf(format string, v ...interface{})
- func LoadAllAds(files map[string][]string) (trMap map[string]map[string]*Translation, tpl map[string]*template.Template)
- func LoadAllTranslations(files map[string][]string) (trMap map[string]*Translations, tpl map[string]*template.Template)
- func LoadEndpointTranslations(files []string) (*Translations, AllTranslations)
- func NoRedirect(_ *http.Request, _ []*http.Request) error
- func TwitchCanonicalModelID(name string) string
- type AllTranslations
- type BongaCamsChecker
- type CamSodaChecker
- type ChaturbateChecker
- type CheckMode
- type Checker
- type CheckerCommon
- type CheckerConfig
- type Client
- type Flirt4FreeChecker
- type LiveJasminChecker
- type ParseKind
- type QueryModelList
- type RandomChecker
- type StatusKind
- type StatusRequest
- type StatusResults
- type StatusResultsData
- type StatusUpdate
- type StatusUpdateRequest
- type StatusUpdateResults
- type StatusUpdateResultsData
- type StreamateChecker
- type StringSetFlag
- type StripchatChecker
- type Translation
- type Translations
- type TwitchChecker
- type Updater
- type VerbosityKind
Constants ¶
const ( SilentVerbosity = 0 ErrVerbosity = 1 InfVerbosity = 2 DbgVerbosity = 3 )
Verbosity constants
Variables ¶
var AllModels = QueryModelList{/* contains filtered or unexported fields */}
AllModels should be used to query all statuses
var ErrFullQueue = errors.New("queue is full")
ErrFullQueue emerges whenever we unable to add a request because the queue is full
var ModelIDRegexp = regexp.MustCompile(`^[a-z0-9\-_@]+$`)
ModelIDRegexp is a regular expression to check model IDs
var TwitchModelIDRegexp = regexp.MustCompile(`^@?[a-z0-9][a-z0-9\-_]*$`)
TwitchModelIDRegexp is a regular expression to check model IDs
var Version = "(devel)"
Version is the version of the current code state
Functions ¶
func CanonicalModelID ¶
CanonicalModelID preprocesses model ID string to canonical form
func ChaturbateCanonicalModelID ¶
ChaturbateCanonicalModelID preprocesses model ID string to canonical for Chaturbate form
func Flirt4FreeCanonicalModelID ¶
Flirt4FreeCanonicalModelID preprocesses model ID string to canonical for Flirt4Free form
func HashDiffAll ¶
HashDiffAll returns symmetric difference between before and after
func HashDiffNewRemoved ¶
HashDiffNewRemoved returns new and removed elements
func LoadAllAds ¶
func LoadAllAds(files map[string][]string) (trMap map[string]map[string]*Translation, tpl map[string]*template.Template)
LoadAllAds loads all ads
func LoadAllTranslations ¶
func LoadAllTranslations(files map[string][]string) (trMap map[string]*Translations, tpl map[string]*template.Template)
LoadAllTranslations loads all translations
func LoadEndpointTranslations ¶
func LoadEndpointTranslations(files []string) (*Translations, AllTranslations)
LoadEndpointTranslations loads translations for a specific endpoint
func NoRedirect ¶
NoRedirect tells HTTP client not to redirect
func TwitchCanonicalModelID ¶
TwitchCanonicalModelID preprocesses channel string to canonical form
Types ¶
type AllTranslations ¶
type AllTranslations map[string]*Translation
AllTranslations represents a collection of translated texts in all supported languages
func LoadAds ¶
func LoadAds(files []string) AllTranslations
LoadAds loads ads for a specific endpoint
type BongaCamsChecker ¶
type BongaCamsChecker struct{ CheckerCommon }
BongaCamsChecker implements a checker for BongaCams
func (*BongaCamsChecker) CheckStatusSingle ¶
func (c *BongaCamsChecker) CheckStatusSingle(modelID string) StatusKind
CheckStatusSingle checks BongaCams model status
func (*BongaCamsChecker) CheckStatusesMany ¶
func (c *BongaCamsChecker) CheckStatusesMany(QueryModelList, CheckMode) (onlineModels map[string]StatusKind, images map[string]string, err error)
CheckStatusesMany returns BongaCams online models
type CamSodaChecker ¶
type CamSodaChecker struct{ CheckerCommon }
CamSodaChecker implements a checker for CamSoda
func (*CamSodaChecker) CheckStatusSingle ¶
func (c *CamSodaChecker) CheckStatusSingle(modelID string) StatusKind
CheckStatusSingle checks CamSoda model status
func (*CamSodaChecker) CheckStatusesMany ¶
func (c *CamSodaChecker) CheckStatusesMany(QueryModelList, CheckMode) (onlineModels map[string]StatusKind, images map[string]string, err error)
CheckStatusesMany returns CamSoda online models
type ChaturbateChecker ¶
type ChaturbateChecker struct{ CheckerCommon }
ChaturbateChecker implements a checker for Chaturbate
func (*ChaturbateChecker) CheckStatusSingle ¶
func (c *ChaturbateChecker) CheckStatusSingle(modelID string) StatusKind
CheckStatusSingle checks Chaturbate model status
func (*ChaturbateChecker) CheckStatusesMany ¶
func (c *ChaturbateChecker) CheckStatusesMany(QueryModelList, CheckMode) (onlineModels map[string]StatusKind, images map[string]string, err error)
CheckStatusesMany returns Chaturbate online models
type Checker ¶
type Checker interface { CheckStatusSingle(modelID string) StatusKind CheckStatusesMany(specific QueryModelList, checkMode CheckMode) (statuses map[string]StatusKind, images map[string]string, err error) Start() Init(checker Checker, config CheckerConfig) Updater() Updater QueryStatuses(statusRequest StatusRequest) error // contains filtered or unexported methods }
Checker is the interface for a checker for specific site
type CheckerCommon ¶
type CheckerCommon struct { CheckerConfig // contains filtered or unexported fields }
CheckerCommon contains common fields for all the checkers
func (*CheckerCommon) Init ¶
func (c *CheckerCommon) Init(checker Checker, config CheckerConfig)
Init initializes checker common fields
func (*CheckerCommon) QueryStatuses ¶
func (c *CheckerCommon) QueryStatuses(statusRequest StatusRequest) error
QueryStatuses adds a status request to the queue
func (*CheckerCommon) Updater ¶
func (c *CheckerCommon) Updater() Updater
Updater returns default updater
type CheckerConfig ¶
type CheckerConfig struct { UsersOnlineEndpoints []string Clients []*Client Headers [][2]string Dbg bool SpecificConfig map[string]string QueueSize int SiteOnlineModels map[string]bool Subscriptions map[string]StatusKind IntervalMs int }
CheckerConfig represents checker config
type Client ¶
type Client struct { // Client is HTTP client Client *http.Client // Addr is source IP address Addr net.Addr }
Client wraps HTTP client and source IP address
type Flirt4FreeChecker ¶
type Flirt4FreeChecker struct{ CheckerCommon }
Flirt4FreeChecker implements a checker for Flirt4Free
func (*Flirt4FreeChecker) CheckStatusSingle ¶
func (c *Flirt4FreeChecker) CheckStatusSingle(modelID string) StatusKind
CheckStatusSingle checks Flirt4Free model status
func (*Flirt4FreeChecker) CheckStatusesMany ¶
func (c *Flirt4FreeChecker) CheckStatusesMany(QueryModelList, CheckMode) (onlineModels map[string]StatusKind, images map[string]string, err error)
CheckStatusesMany returns Flirt4Free online models
type LiveJasminChecker ¶
type LiveJasminChecker struct{ CheckerCommon }
LiveJasminChecker implements a checker for LiveJasmin
func (*LiveJasminChecker) CheckStatusSingle ¶
func (c *LiveJasminChecker) CheckStatusSingle(modelID string) StatusKind
CheckStatusSingle checks LiveJasmin model status
func (*LiveJasminChecker) CheckStatusesMany ¶
func (c *LiveJasminChecker) CheckStatusesMany(QueryModelList, CheckMode) (onlineModels map[string]StatusKind, images map[string]string, err error)
CheckStatusesMany returns LiveJasmin online models
type ParseKind ¶
type ParseKind int
ParseKind specifies Telegram message parsing method
func (ParseKind) MarshalYAML ¶
MarshalYAML is generated so ParseKind satisfies yaml.Marshaler.
func (*ParseKind) UnmarshalYAML ¶
UnmarshalYAML is generated so ParseKind satisfies yaml.Unmarshaler.
type QueryModelList ¶
type QueryModelList struct {
// contains filtered or unexported fields
}
QueryModelList represents a model list to query
func NewQueryModelList ¶
func NewQueryModelList(list []string) QueryModelList
NewQueryModelList returns a query list for specific models
type RandomChecker ¶
type RandomChecker struct{ CheckerCommon }
RandomChecker implements test checker
func (*RandomChecker) CheckStatusSingle ¶
func (c *RandomChecker) CheckStatusSingle(modelID string) StatusKind
CheckStatusSingle mimics checker
func (*RandomChecker) CheckStatusesMany ¶
func (c *RandomChecker) CheckStatusesMany(QueryModelList, CheckMode) (onlineModels map[string]StatusKind, images map[string]string, err error)
CheckStatusesMany returns Random online models
type StatusKind ¶
type StatusKind int
StatusKind represents a status of a model
const ( StatusUnknown StatusKind = 0 StatusOffline StatusKind = 1 StatusOnline StatusKind = 2 StatusNotFound StatusKind = 4 StatusDenied StatusKind = 8 )
Model statuses
func (StatusKind) String ¶
func (s StatusKind) String() string
type StatusRequest ¶
type StatusRequest struct { SpecialModels map[string]bool Specific map[string]bool Callback func(StatusResults) CheckMode CheckMode }
StatusRequest represents a request of model status
type StatusResults ¶
type StatusResults struct { Data *StatusResultsData Errors int }
StatusResults contains results from online checking algorithm
type StatusResultsData ¶
type StatusResultsData struct { Statuses map[string]StatusKind Images map[string]string Elapsed time.Duration }
StatusResultsData contains data from online checking algorithm
type StatusUpdate ¶
type StatusUpdate struct { ModelID string Status StatusKind }
StatusUpdate represents an update of model status
type StatusUpdateRequest ¶
type StatusUpdateRequest struct { SpecialModels map[string]bool Subscriptions map[string]StatusKind Specific map[string]bool Callback func(StatusUpdateResults) }
StatusUpdateRequest represents a request of models updates
type StatusUpdateResults ¶
type StatusUpdateResults struct { Data *StatusUpdateResultsData Errors int }
StatusUpdateResults contains results from updates checking algorithm
type StatusUpdateResultsData ¶
type StatusUpdateResultsData struct { Updates []StatusUpdate Images map[string]string Elapsed time.Duration }
StatusUpdateResultsData contains data from updates checking algorithm
type StreamateChecker ¶
type StreamateChecker struct{ CheckerCommon }
StreamateChecker implements a checker for Streamate
func (*StreamateChecker) CheckStatusSingle ¶
func (c *StreamateChecker) CheckStatusSingle(modelID string) StatusKind
CheckStatusSingle checks Streamate model status
func (*StreamateChecker) CheckStatusesMany ¶
func (c *StreamateChecker) CheckStatusesMany(QueryModelList, CheckMode) (onlineModels map[string]StatusKind, images map[string]string, err error)
CheckStatusesMany returns Streamate online models
type StringSetFlag ¶
StringSetFlag is a flag representing a set of strings
func (*StringSetFlag) Set ¶
func (s *StringSetFlag) Set(value string) error
Set implements flag.Value interface
func (*StringSetFlag) String ¶
func (s *StringSetFlag) String() string
String implements flag.Value interface
type StripchatChecker ¶
type StripchatChecker struct{ CheckerCommon }
StripchatChecker implements a checker for Stripchat
func (*StripchatChecker) CheckStatusSingle ¶
func (c *StripchatChecker) CheckStatusSingle(modelID string) StatusKind
CheckStatusSingle checks Stripchat model status
func (*StripchatChecker) CheckStatusesMany ¶
func (c *StripchatChecker) CheckStatusesMany(QueryModelList, CheckMode) (onlineModels map[string]StatusKind, images map[string]string, err error)
CheckStatusesMany returns Stripchat online models
type Translation ¶
type Translation struct { Key string `yaml:"-"` Str string `yaml:"str"` Parse ParseKind `yaml:"parse"` DisablePreview bool `yaml:"disable_preview"` }
Translation represents a translated text for a Telegram message
type Translations ¶
type Translations struct { Help *Translation `yaml:"help"` Online *Translation `yaml:"online"` List *Translation `yaml:"list"` Offline *Translation `yaml:"offline"` Denied *Translation `yaml:"denied"` SyntaxAdd *Translation `yaml:"syntax_add"` SyntaxRemove *Translation `yaml:"syntax_remove"` SyntaxFeedback *Translation `yaml:"syntax_feedback"` InvalidSymbols *Translation `yaml:"invalid_symbols"` AlreadyAdded *Translation `yaml:"already_added"` AddError *Translation `yaml:"add_error"` ModelAdded *Translation `yaml:"model_added"` ModelNotInList *Translation `yaml:"model_not_in_list"` ModelRemoved *Translation `yaml:"model_removed"` CheckingModel *Translation `yaml:"checking_model"` Feedback *Translation `yaml:"feedback"` Social *Translation `yaml:"social"` UnknownCommand *Translation `yaml:"unknown_command"` InvalidCommand *Translation `yaml:"invalid_command"` Languages *Translation `yaml:"languages"` Version *Translation `yaml:"version"` ProfileRemoved *Translation `yaml:"profile_removed"` NoOnlineModels *Translation `yaml:"no_online_models"` RemoveAll *Translation `yaml:"remove_all"` AllModelsRemoved *Translation `yaml:"all_models_removed"` TryToBuyLater *Translation `yaml:"try_to_buy_later"` PayThis *Translation `yaml:"pay_this"` SelectCurrency *Translation `yaml:"select_currency"` UnknownCurrency *Translation `yaml:"unknown_currency"` BuyAd *Translation `yaml:"buy_ad"` PaymentComplete *Translation `yaml:"payment_complete"` MailReceived *Translation `yaml:"mail_received"` BuyButton *Translation `yaml:"buy_button"` ReferralLink *Translation `yaml:"referral_link"` InvalidReferralLink *Translation `yaml:"invalid_referral_link"` FollowerExists *Translation `yaml:"follower_exists"` ReferralApplied *Translation `yaml:"referral_applied"` OwnReferralLinkHit *Translation `yaml:"own_referral_link_hit"` SubscriptionUsage *Translation `yaml:"subscription_usage"` SubscriptionUsageAd *Translation `yaml:"subscription_usage_ad"` NotEnoughSubscriptions *Translation `yaml:"not_enough_subscriptions"` Week *Translation `yaml:"week"` ZeroSubscriptions *Translation `yaml:"zero_subscriptions"` FAQ *Translation `yaml:"faq"` RawCommands *Translation `yaml:"raw_commands"` Settings *Translation `yaml:"settings"` OK *Translation `yaml:"ok"` TooManySubscriptionsForPics *Translation `yaml:"too_many_subscriptions_for_pics"` Maintenance *Translation `yaml:"maintenance"` WeAreUp *Translation `yaml:"we_are_up"` }
Translations represents a collection of translated texts for Telegram messages
type TwitchChecker ¶
type TwitchChecker struct {
CheckerCommon
}
TwitchChecker implements a checker for Twitch
func (*TwitchChecker) CheckStatusSingle ¶
func (c *TwitchChecker) CheckStatusSingle(modelID string) StatusKind
CheckStatusSingle checks Twitch channel status
func (*TwitchChecker) CheckStatusesMany ¶
func (c *TwitchChecker) CheckStatusesMany(channels QueryModelList, checkMode CheckMode) (results map[string]StatusKind, images map[string]string, err error)
CheckStatusesMany checks Twitch channel status
type Updater ¶
type Updater interface {
QueryUpdates(updateRequest StatusUpdateRequest) error
}
Updater implements updater adapter
type VerbosityKind ¶
type VerbosityKind int
VerbosityKind represents logging verbosity
var Verbosity VerbosityKind = DbgVerbosity
Verbosity is the current logging verbosity
Source Files ¶
- body.go
- bongacams.go
- camsoda.go
- chaturbate.go
- check_mode.go
- checker.go
- chunks.go
- clients_loop.go
- convert.go
- err.go
- flirt4free.go
- full_updater.go
- hash_diff.go
- http.go
- livejasmin.go
- log.go
- models.go
- parsekind_yamlenums.go
- random_checker.go
- selective_updater.go
- set_flag.go
- status.go
- streamate.go
- stripchat.go
- translations.go
- twitch.go
- updater.go
- version.go