Documentation ¶
Index ¶
- Constants
- func BuildCGRoutersFromCRConfig(crc *tc.CRConfig) (map[tc.CacheGroupName]DNSDSServers, error)
- func BuildDSServersFromCRConfig(crc *tc.CRConfig) (map[tc.DeliveryServiceName]map[tc.CacheGroupName]DNSDSServers, error)
- func BuildHTTPSecondDNSMatches(crc *tc.CRConfig, cdnDomain string) map[string]tc.CacheName
- func BuildMatchesFromCRConfig(crc *tc.CRConfig, cdnDomain string) ([]DSAndMatch, []DSAndMatch, error)
- func BuildServerAvailableFromCRStates(crs *tc.CRStates) map[tc.CacheName]bool
- func ParseIPOrCIDR(str string) net.IP
- type DNSDS
- type DNSDSServer
- type DNSDSServers
- type DSAndMatch
- type DSMatches
- type Shared
- func (sh *Shared) GetCDNDomain() string
- func (sh *Shared) GetCRConfig() *tc.CRConfig
- func (sh *Shared) GetCRStates() *tc.CRStates
- func (sh *Shared) GetCZF() *czf.ParsedCZF
- func (sh *Shared) GetCerts() map[string]*tls.Certificate
- func (sh *Shared) GetServerForDomain(addr net.Addr, zone string, domain string, v4 bool) (string, string, string, bool, bool)
- func (sh *Shared) GetServerForDomainDNS(addr net.Addr, zone string, domain string, v4 bool, ...) (string, string, string, bool, bool)
- func (sh *Shared) GetServerForDomainHTTP(addr net.Addr, zone string, domain string, v4 bool, ...) (string, string, string, bool, bool)
- func (sh *Shared) GetServerName(cacheName tc.CacheName, v4 bool) (string, string, string, bool, bool)
- func (sh *Shared) SetCRConfig(crConfig *tc.CRConfig)
- func (sh *Shared) SetCRStates(crStates *tc.CRStates)
Constants ¶
const CRConfigMatchListTypeHost = `HOST`
const CRConfigMatchSetProtocolDNS = `DNS`
const CRConfigMatchSetProtocolHTTP = `HTTP`
const DefaultHTTPRoutingName = "ccr"
Variables ¶
This section is empty.
Functions ¶
func BuildCGRoutersFromCRConfig ¶
func BuildCGRoutersFromCRConfig(crc *tc.CRConfig) (map[tc.CacheGroupName]DNSDSServers, error)
func BuildDSServersFromCRConfig ¶
func BuildDSServersFromCRConfig(crc *tc.CRConfig) (map[tc.DeliveryServiceName]map[tc.CacheGroupName]DNSDSServers, error)
func BuildHTTPSecondDNSMatches ¶
BuildHTTPSecondDNSMatches returns a map[fqdn]cache for the DNS FQDNs for HTTP Delivery Services.
That is, for an HTTP DS, a client 1. Makes a DNS request to TR, and gets an IP back of TR itself 2. Makes a HTTP request to TR 3. Gets a 302 redirect to a FQDN, which is cache-host.ds-name.cdn-domain. 4. Makes a DNS request for that FQDN, and gets the IP of that cache 6. Makes an HTTP request to the cache.
The matches here are for step 4, the second DNS lookup of an HTTP DS, for cache-name.ds-name.cdn-domain.
func BuildMatchesFromCRConfig ¶
func BuildMatchesFromCRConfig(crc *tc.CRConfig, cdnDomain string) ([]DSAndMatch, []DSAndMatch, error)
BuildMatchesFromCRConfig builds DSAndMatch objects from the CRConfig Delivery Services.
Note if an error is returned, the []DSAndMatch is still valid, and contains successful matches from all DSes that didn't error. This is very important for Self-Service: if a DS is broken, it must not break other DSes.
Returns the DNS matches, HTTP DNS matches, and any errors from malformed DSes
func BuildServerAvailableFromCRStates ¶
func BuildServerAvailableFromCRStates(crs *tc.CRStates) map[tc.CacheName]bool
func ParseIPOrCIDR ¶
Types ¶
type DNSDSServer ¶
type DNSDSServer struct { HostName tc.CacheName Addr string // Addr is the IPv4 or IPv6 address of the server, to be returned via DNS. Status tc.CacheStatus // Status is the TO Status (Reported, ONLINE, etc) - TODO change to int, faster compare? }
type DNSDSServers ¶
type DNSDSServers struct { V4s []DNSDSServer V6s []DNSDSServer }
DNSDSServers contains hash rings of servers to route to, for a certain deliveryservice and cachegroup. These have already been hashed, but will need checked for health before sending clients to them. If a server is unhealthy, the next server in the hash ring should be used instead. TODO sort by hash
type DSAndMatch ¶
type DSAndMatch struct { Matches []match.DNSDSMatch DS tc.DeliveryServiceName }
type DSMatches ¶
type DSMatches []DSAndMatch
type Shared ¶
type Shared struct {
// contains filtered or unexported fields
}
func NewShared ¶
func NewShared(czf *czf.ParsedCZF, crc *tc.CRConfig, crs *tc.CRStates, certs map[string]*tls.Certificate) *Shared
NewShared creates a new Shared data object. Logs all errors, fatal and non-fatal. On fatal error, returns nil
func (*Shared) GetCDNDomain ¶
func (*Shared) GetCRConfig ¶
func (sh *Shared) GetCRConfig() *tc.CRConfig
GetCRConfig gets the Content Router Config (CRConfig). The returned CRConfig MUST NOT be modified.
Safe for use by handlers.
func (*Shared) GetCRStates ¶
func (sh *Shared) GetCRStates() *tc.CRStates
func (*Shared) GetCZF ¶
GetCZF gets the Coverage Zone File (CZF). The returned CZF MUST NOT be modified.
Safe for use by handlers.
func (*Shared) GetServerForDomain ¶
func (sh *Shared) GetServerForDomain(addr net.Addr, zone string, domain string, v4 bool) (string, string, string, bool, bool)
GetServerForDomain returns the IP of the cache, the cache hostname, the DS name, whether to immediately return a refused (because the domain was not in the DS list), and whether to return a SERVFAIL (because there was a server error looking up the DS). Error messages are logged. TODO NXDOMAIN instead of refusing if it's a CDN domain e.g. top.comcast.net but just a nonexistent DS? TODO change to return multiple IPs, depending on DS configuration.
func (*Shared) GetServerForDomainDNS ¶
func (*Shared) GetServerForDomainHTTP ¶
func (sh *Shared) GetServerForDomainHTTP( addr net.Addr, zone string, domain string, v4 bool, dsName tc.DeliveryServiceName, ) (string, string, string, bool, bool)
GetServerForDomainHTTP returns the server IP to return to the client, for the given HTTP DS' initial DNS request.
Because it's an HTTP DS, the initial DNS request returns the IP of a Traffic Router (which will then be requested over HTTP by the client, and which will return a 302 to a cache).
func (*Shared) GetServerName ¶
func (*Shared) SetCRConfig ¶
func (sh *Shared) SetCRConfig(crConfig *tc.CRConfig)
func (*Shared) SetCRStates ¶
func (sh *Shared) SetCRStates(crStates *tc.CRStates)