shawn1m / overture

A customized DNS relay server
MIT License
1.8k stars 284 forks source link

可以增加域名后缀匹配模式吗? #275

Open blog2i2j opened 2 years ago

blog2i2j commented 2 years ago

overture的匹配模式full-map,只能对域名玩这个匹配才能识别, 可以增加对域名后缀匹配. 比如google.com作为匹配. 所有的 *.google.com都能被匹配到(比如www.google.com, mail.google.com)

blog2i2j commented 2 years ago

/*

package suffix

import ( "strings" log "github.com/sirupsen/logrus" )

type List struct { DataList []string }

func (s *List) Insert(str string) error { s.DataList = append(s.DataList, "." + str) return nil }

func (s *List) Has(str string) bool { str = "." + str for _, data := range s.DataList { if strings.Contains(str, data) { log.Debugf("Match: Domain %s match suffix-list %s", str, data) return true } } return false }

func (s *List) Name() string { return "suffix-list" }

blog2i2j commented 2 years ago

自己瞎改了一段, 测试了一下可以实现子域名匹配.

Alion548 commented 2 years ago

https://github.com/shawn1m/overture/issues/180