mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2024-12-22 22:36:53 +00:00
add raw ip support
This commit is contained in:
parent
20e2065109
commit
4d184f7f86
@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"sync"
|
||||
|
||||
"regexp"
|
||||
"github.com/babolivier/go-doh-client"
|
||||
)
|
||||
|
||||
@ -15,6 +16,13 @@ func Init(dns string) {
|
||||
}
|
||||
|
||||
func Lookup(domain string) (string, error) {
|
||||
ipRegex := "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"
|
||||
|
||||
if r, _ := regexp.MatchString(ipRegex, domain); r {
|
||||
return domain, nil
|
||||
}
|
||||
|
||||
|
||||
a, _, err := resolver.LookupA(domain)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
Loading…
Reference in New Issue
Block a user