Documentation
¶
Index ¶
- Variables
- func GetHash(secret, message string) string
- func Log(message string)
- func ProcessIdentifier(parameter string) string
- func Urldecode(param string) string
- func Urlencode(param string) string
- type Config
- type QueueFairAdapter
- func (a *QueueFairAdapter) AppendExtra(queue map[string]interface{}, redirectLoc string) string
- func (a *QueueFairAdapter) AppendVariant(queue map[string]interface{}, redirectLoc string) string
- func (a *QueueFairAdapter) CheckAndAddCacheControl()
- func (a *QueueFairAdapter) CheckQueryString()
- func (a *QueueFairAdapter) ConsultAdapter(queue map[string]interface{})
- func (a *QueueFairAdapter) GetVariant(queue map[string]interface{}) string
- func (a *QueueFairAdapter) GotAdapter()
- func (a *QueueFairAdapter) GotSettings()
- func (a *QueueFairAdapter) IsContinue() bool
- func (a *QueueFairAdapter) IsMatch(queue map[string]interface{}) bool
- func (a *QueueFairAdapter) IsMatchArray(arr interface{}) bool
- func (a *QueueFairAdapter) IsPassed(queue map[string]interface{}) bool
- func (a *QueueFairAdapter) IsRuleMatch(rule map[string]interface{}) bool
- func (a *QueueFairAdapter) LoadSettings()
- func (a *QueueFairAdapter) OnMatch(queue map[string]interface{}) bool
- func (a *QueueFairAdapter) ParseSettings()
- func (a *QueueFairAdapter) Redirect(loc string, sleepSecs int)
- func (a *QueueFairAdapter) SetCookie(queueName, value string, lifetimeSeconds int, cookieDomain string)
- func (a *QueueFairAdapter) SetUIDFromCookie()
- func (a *QueueFairAdapter) SettingsURL() string
- func (a *QueueFairAdapter) UrlToJSON(urlStr string) map[string]interface{}
- func (a *QueueFairAdapter) ValidateCookie(secret string, passedLifetimeMinutes int, cookie string) bool
- func (a *QueueFairAdapter) ValidateCookieFromQueue(queue map[string]interface{}, cookie string) bool
- func (a *QueueFairAdapter) ValidateQuery(queue map[string]interface{}) bool
- type QueueFairHTTPService
- func (s *QueueFairHTTPService) AddHeader(name, value string)
- func (s *QueueFairHTTPService) GetCookie(name string) string
- func (s *QueueFairHTTPService) IsSecure() bool
- func (s *QueueFairHTTPService) Redirect(location string)
- func (s *QueueFairHTTPService) SetCookie(name, value string, lifetimeSeconds int, domain string)
- type QueueFairService
- type SettingsCache
Constants ¶
This section is empty.
Variables ¶
View Source
var QueueFairConfig = Config{ AccountSecret: "DELETE_AND_REPLACE_WITH_YOUR_ACCOUNT_SECRET", Account: "DELETE_AND_REPLACE_WITH_YOUR_ACCOUNT_SYSTEM_NAME", FilesServer: "files.queue-fair.net", QueryTimeLimitSeconds: 300, Debug: false, ReadTimeout: 5, SettingsCacheLifetimeMinutes: 5, StripPassedString: true, AdapterMode: "safe", }
QueueFairConfig is the global config instance.
Functions ¶
func ProcessIdentifier ¶
Types ¶
type Config ¶
type Config struct {
AccountSecret string
Account string
FilesServer string
QueryTimeLimitSeconds int
Debug interface{}
ReadTimeout int
SettingsCacheLifetimeMinutes int
StripPassedString bool
AdapterMode string
}
QueueFairConfig holds adapter settings.
type QueueFairAdapter ¶
type QueueFairAdapter struct {
Service QueueFairService
RequestedURL string
UserAgent string
RemoteIP string
Extra string
ContinuePage bool
Parsing bool
Protocol string
Settings map[string]interface{}
AdapterResult map[string]interface{}
AdapterQueue map[string]interface{}
PassedString string
PassedQueues map[string]bool
UID string
D bool
AddedCacheCtrl bool
}
func NewQueueFairAdapter ¶
func NewQueueFairAdapter(service QueueFairService, url, agent, ip, extra string) *QueueFairAdapter
func (*QueueFairAdapter) AppendExtra ¶
func (a *QueueFairAdapter) AppendExtra(queue map[string]interface{}, redirectLoc string) string
func (*QueueFairAdapter) AppendVariant ¶
func (a *QueueFairAdapter) AppendVariant(queue map[string]interface{}, redirectLoc string) string
func (*QueueFairAdapter) CheckAndAddCacheControl ¶
func (a *QueueFairAdapter) CheckAndAddCacheControl()
func (*QueueFairAdapter) CheckQueryString ¶
func (a *QueueFairAdapter) CheckQueryString()
func (*QueueFairAdapter) ConsultAdapter ¶
func (a *QueueFairAdapter) ConsultAdapter(queue map[string]interface{})
func (*QueueFairAdapter) GetVariant ¶
func (a *QueueFairAdapter) GetVariant(queue map[string]interface{}) string
func (*QueueFairAdapter) GotAdapter ¶
func (a *QueueFairAdapter) GotAdapter()
func (*QueueFairAdapter) GotSettings ¶
func (a *QueueFairAdapter) GotSettings()
func (*QueueFairAdapter) IsContinue ¶
func (a *QueueFairAdapter) IsContinue() bool
func (*QueueFairAdapter) IsMatch ¶
func (a *QueueFairAdapter) IsMatch(queue map[string]interface{}) bool
func (*QueueFairAdapter) IsMatchArray ¶
func (a *QueueFairAdapter) IsMatchArray(arr interface{}) bool
func (*QueueFairAdapter) IsPassed ¶
func (a *QueueFairAdapter) IsPassed(queue map[string]interface{}) bool
func (*QueueFairAdapter) IsRuleMatch ¶
func (a *QueueFairAdapter) IsRuleMatch(rule map[string]interface{}) bool
func (*QueueFairAdapter) LoadSettings ¶
func (a *QueueFairAdapter) LoadSettings()
func (*QueueFairAdapter) OnMatch ¶
func (a *QueueFairAdapter) OnMatch(queue map[string]interface{}) bool
func (*QueueFairAdapter) ParseSettings ¶
func (a *QueueFairAdapter) ParseSettings()
func (*QueueFairAdapter) Redirect ¶
func (a *QueueFairAdapter) Redirect(loc string, sleepSecs int)
func (*QueueFairAdapter) SetCookie ¶
func (a *QueueFairAdapter) SetCookie(queueName, value string, lifetimeSeconds int, cookieDomain string)
func (*QueueFairAdapter) SetUIDFromCookie ¶
func (a *QueueFairAdapter) SetUIDFromCookie()
func (*QueueFairAdapter) SettingsURL ¶
func (a *QueueFairAdapter) SettingsURL() string
func (*QueueFairAdapter) UrlToJSON ¶
func (a *QueueFairAdapter) UrlToJSON(urlStr string) map[string]interface{}
func (*QueueFairAdapter) ValidateCookie ¶
func (a *QueueFairAdapter) ValidateCookie(secret string, passedLifetimeMinutes int, cookie string) bool
func (*QueueFairAdapter) ValidateCookieFromQueue ¶
func (a *QueueFairAdapter) ValidateCookieFromQueue(queue map[string]interface{}, cookie string) bool
func (*QueueFairAdapter) ValidateQuery ¶
func (a *QueueFairAdapter) ValidateQuery(queue map[string]interface{}) bool
type QueueFairHTTPService ¶
type QueueFairHTTPService struct {
Request *http.Request
Writer http.ResponseWriter
// contains filtered or unexported fields
}
QueueFairHTTPService is the net/http implementation of QueueFairService.
func NewQueueFairHTTPService ¶
func NewQueueFairHTTPService(w http.ResponseWriter, r *http.Request, isSecure bool) *QueueFairHTTPService
func (*QueueFairHTTPService) AddHeader ¶
func (s *QueueFairHTTPService) AddHeader(name, value string)
func (*QueueFairHTTPService) GetCookie ¶
func (s *QueueFairHTTPService) GetCookie(name string) string
func (*QueueFairHTTPService) IsSecure ¶
func (s *QueueFairHTTPService) IsSecure() bool
func (*QueueFairHTTPService) Redirect ¶
func (s *QueueFairHTTPService) Redirect(location string)
type QueueFairService ¶
type QueueFairService interface {
SetCookie(name, value string, lifetimeSeconds int, domain string)
Redirect(location string)
GetCookie(name string) string
AddHeader(name, value string)
IsSecure() bool
}
QueueFairService defines behavior expected by the adapter.
type SettingsCache ¶
type SettingsCache struct {
// contains filtered or unexported fields
}
Settings are cached in memory between periodic downloads
func NewSettingsCache ¶
func NewSettingsCache(settingsURL string, lifetimeMinutes int) *SettingsCache
NewSettingsCache initializes the cache.
func (*SettingsCache) Get ¶
func (sc *SettingsCache) Get(a *QueueFairAdapter) (map[string]interface{}, error)
Get returns cached settings, refreshing if needed.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.