queuefair

package
v2.6.2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

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 GetHash

func GetHash(secret, message string) string

func Log

func Log(message string)

func ProcessIdentifier

func ProcessIdentifier(parameter string) string

func Urldecode

func Urldecode(param string) string

func Urlencode

func Urlencode(param string) string

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)

func (*QueueFairHTTPService) SetCookie

func (s *QueueFairHTTPService) SetCookie(name, value string, lifetimeSeconds int, domain 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
}
var SharedSettingsCache *SettingsCache

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.

Directories

Path Synopsis
queue_fair_echo_service.go
queue_fair_echo_service.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL