|
@@ -33,7 +33,7 @@ type DNS struct {
|
|
|
clients []*Client
|
|
clients []*Client
|
|
|
ctx context.Context
|
|
ctx context.Context
|
|
|
domainMatcher strmatcher.IndexMatcher
|
|
domainMatcher strmatcher.IndexMatcher
|
|
|
- matcherInfos []*DomainMatcherInfo
|
|
|
|
|
|
|
+ matcherInfos []DomainMatcherInfo
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// DomainMatcherInfo contains information attached to index returned by Server.domainMatcher
|
|
// DomainMatcherInfo contains information attached to index returned by Server.domainMatcher
|
|
@@ -93,7 +93,7 @@ func New(ctx context.Context, config *Config) (*DNS, error) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// MatcherInfos is ensured to cover the maximum index domainMatcher could return, where matcher's index starts from 1
|
|
// MatcherInfos is ensured to cover the maximum index domainMatcher could return, where matcher's index starts from 1
|
|
|
- matcherInfos := make([]*DomainMatcherInfo, domainRuleCount+1)
|
|
|
|
|
|
|
+ matcherInfos := make([]DomainMatcherInfo, domainRuleCount+1)
|
|
|
domainMatcher := &strmatcher.MatcherGroup{}
|
|
domainMatcher := &strmatcher.MatcherGroup{}
|
|
|
geoipContainer := router.GeoIPMatcherContainer{}
|
|
geoipContainer := router.GeoIPMatcherContainer{}
|
|
|
|
|
|
|
@@ -108,9 +108,9 @@ func New(ctx context.Context, config *Config) (*DNS, error) {
|
|
|
|
|
|
|
|
for _, ns := range config.NameServer {
|
|
for _, ns := range config.NameServer {
|
|
|
clientIdx := len(clients)
|
|
clientIdx := len(clients)
|
|
|
- updateDomain := func(domainRule strmatcher.Matcher, originalRuleIdx int, matcherInfos []*DomainMatcherInfo) error {
|
|
|
|
|
|
|
+ updateDomain := func(domainRule strmatcher.Matcher, originalRuleIdx int, matcherInfos []DomainMatcherInfo) error {
|
|
|
midx := domainMatcher.Add(domainRule)
|
|
midx := domainMatcher.Add(domainRule)
|
|
|
- matcherInfos[midx] = &DomainMatcherInfo{
|
|
|
|
|
|
|
+ matcherInfos[midx] = DomainMatcherInfo{
|
|
|
clientIdx: uint16(clientIdx),
|
|
clientIdx: uint16(clientIdx),
|
|
|
domainRuleIdx: uint16(originalRuleIdx),
|
|
domainRuleIdx: uint16(originalRuleIdx),
|
|
|
}
|
|
}
|