Move code to init

pull/62/head
v2ray 2015-12-14 01:12:29 +01:00
parent d3422597d6
commit 543478a01e
1 changed files with 5 additions and 3 deletions

View File

@ -37,9 +37,13 @@ const (
)
var (
compiledMatchers []*RegexpDomainMatcher
)
func init() {
compiledMatchers = make([]*RegexpDomainMatcher, 0, 1024)
regexpDomains = []string{
regexpDomains := []string{
dotCn,
anySubDomain + "10010" + dotCom,
@ -187,9 +191,7 @@ var (
anySubDomain + "youku" + dotCom,
anySubDomain + "zhihu" + dotCom,
}
)
func init() {
for _, pattern := range regexpDomains {
matcher, err := NewRegexpDomainMatcher(pattern)
if err != nil {