-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathclient_config.go
More file actions
69 lines (57 loc) · 1.98 KB
/
Copy pathclient_config.go
File metadata and controls
69 lines (57 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package config
import (
"github.com/getlantern/fronted"
)
// ClientConfig captures configuration information for a Client
type ClientConfig struct {
DumpHeaders bool // whether or not to dump headers of requests and responses
Fronted *FrontedConfig
// Legacy masquerade configuration
// included to test presence for older clients
MasqueradeSets map[string][]*fronted.Masquerade
// DNS host-to-ip mappings to bypass DNS when resolving hostnames
// This only works for direct dials (i.e., domain routing rules that are
// MustDirect or 'md':
// https://github.com/getlantern/flashlight/blob/f82d9ab04da841e4a2833783b244948a8daa547e/domainrouting/domainrouting.go#L33
DNSResolutionMapForDirectDials map[string]string
}
// Configuration structure for direct domain fronting
type FrontedConfig struct {
Providers map[string]*ProviderConfig
}
// Configuration structure for a particular fronting provider (cloudfront, akamai, etc)
type ProviderConfig struct {
HostAliases map[string]string
TestURL string
Masquerades []*fronted.Masquerade
Validator *ValidatorConfig
PassthroughPatterns []string
FrontingSNIs map[string]*fronted.SNIConfig
VerifyHostname *string `yaml:"verifyHostname,omitempty"`
}
// returns a fronted.ResponseValidator specified by the
// provider config or nil if none was specified
func (p *ProviderConfig) GetResponseValidator(providerID string) fronted.ResponseValidator {
// hard-coded custom validators can be determined here if needed...
if p.Validator == nil {
return nil
}
// ...
// unknown or empty
return nil
}
// Configuration struture that specifies a fronted.ResponseValidator
type ValidatorConfig struct {
RejectStatus []int
}
func newFrontedConfig() *FrontedConfig {
return &FrontedConfig{
Providers: make(map[string]*ProviderConfig),
}
}
// NewClientConfig creates a new client config with default values.
func NewClientConfig() *ClientConfig {
return &ClientConfig{
Fronted: newFrontedConfig(),
}
}