Skip to content

Commit 8515b9a

Browse files
committed
chore: move Resolver interface to dns.go
1 parent 6c3b46b commit 8515b9a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

dns/dns.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@ import (
1313
"github.com/xvzc/SpoofDPI/util"
1414
)
1515

16+
type Resolver interface {
17+
Resolve(ctx context.Context, host string, qTypes []uint16) ([]net.IPAddr, error)
18+
String() string
19+
}
20+
1621
type Dns struct {
1722
host string
1823
port string
19-
systemClient client.Resolver
20-
generalClient client.Resolver
21-
dohClient client.Resolver
24+
systemClient Resolver
25+
generalClient Resolver
26+
dohClient Resolver
2227
}
2328

2429
func NewResolver(config *util.Config) *Dns {
@@ -61,7 +66,7 @@ func (d *Dns) ResolveHost(host string, enableDoh bool, useSystemDns bool) (strin
6166
return "", fmt.Errorf("could not resolve %s using %s", host, clt)
6267
}
6368

64-
func (d *Dns) clientFactory(enableDoh bool, useSystemDns bool) client.Resolver {
69+
func (d *Dns) clientFactory(enableDoh bool, useSystemDns bool) Resolver {
6570
if useSystemDns {
6671
return d.systemClient
6772
}

dns/resolver/resolver.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ import (
1414

1515
type exchangeFunc = func(ctx context.Context, msg *dns.Msg) (*dns.Msg, error)
1616

17-
type Resolver interface {
18-
Resolve(ctx context.Context, host string, qTypes []uint16) ([]net.IPAddr, error)
19-
String() string
20-
}
21-
2217
type DNSResult struct {
2318
msg *dns.Msg
2419
err error

0 commit comments

Comments
 (0)