remapdata

package
v1.1.5-retractions Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 9 Imported by: 28

Documentation

Index

Constants

View Source
const (
	ParentSelectionTypeConsistentHash = ParentSelectionType("consistent-hash")
	ParentSelectionTypeRoundRobin     = ParentSelectionType("round-robin")
	ParentSelectionTypeInvalid        = ParentSelectionType("")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ParentSelectionType

type ParentSelectionType string

ParentSelectionType is the algorithm to use for selecting parents.

func ParentSelectionTypeFromString

func ParentSelectionTypeFromString(s string) ParentSelectionType

func (ParentSelectionType) String

func (t ParentSelectionType) String() string

type QueryStringRule

type QueryStringRule struct {
	Remap bool `json:"remap"`
	Cache bool `json:"cache"`
}

type RemapRule

type RemapRule struct {
	RemapRuleBase
	Timeout         *time.Duration
	ParentSelection *ParentSelectionType
	To              []RemapRuleTo
	Allow           []*net.IPNet
	Deny            []*net.IPNet
	RetryCodes      map[int]struct{}
	ConsistentHash  chash.ATSConsistentHash
	Cache           icache.Cache
	Plugins         map[string]interface{}
}

func (*RemapRule) Allowed

func (r *RemapRule) Allowed(ip net.IP) bool

func (RemapRule) CacheKey

func (r RemapRule) CacheKey(method string, fromURI string) string

func (RemapRule) URI

func (r RemapRule) URI(fromURI string, path string, query string, failures int) (string, *url.URL, *http.Transport)

URI takes a request URI and maps it to the real URI to proxy-and-cache. The `failures` parameter indicates how many parents have tried and failed, indicating to skip to the nth hashed parent. Returns the URI to request, and the proxy URL (if any)

type RemapRuleBase

type RemapRuleBase struct {
	Name               string          `json:"name"`
	From               string          `json:"from"`
	CertificateFile    string          `json:"certificate-file"`
	CertificateKeyFile string          `json:"certificate-key-file"`
	ConnectionClose    bool            `json:"connection-close"`
	QueryString        QueryStringRule `json:"query-string"`
	// ConcurrentRuleRequests is the number of concurrent requests permitted to a remap rule, that is, to an origin. If this is 0, the global config is used.
	ConcurrentRuleRequests int                        `json:"concurrent_rule_requests"`
	RetryNum               *int                       `json:"retry_num"`
	DSCP                   int                        `json:"dscp"`
	PluginsShared          map[string]json.RawMessage `json:"plugins_shared"`
}

type RemapRuleTo

type RemapRuleTo struct {
	RemapRuleToBase
	ProxyURL   *url.URL
	Timeout    *time.Duration
	RetryCodes map[int]struct{}
	Transport  *http.Transport
}

type RemapRuleToBase

type RemapRuleToBase struct {
	URL      string   `json:"url"`
	Weight   *float64 `json:"weight"`
	RetryNum *int     `json:"retry_num"`
}

type RemapRulesStats

type RemapRulesStats struct {
	Allow []*net.IPNet
	Deny  []*net.IPNet
}

func (RemapRulesStats) Allowed

func (statRules RemapRulesStats) Allowed(ip net.IP) bool

Jump to

Keyboard shortcuts

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