Skip to content

Commit

Permalink
proxy support for DNS
Browse files Browse the repository at this point in the history
  • Loading branch information
mosajjal committed Feb 6, 2023
1 parent 77edaec commit a4256cd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func LoadDomainsCsv(Filename string) (*tst.TernarySearchTree, *tst.TernarySearch
dnslog.Error("", err)
return prefix, suffix, all, err
}
dnslog.Info("(re)fetching URL: ", Filename)
dnslog.Info("(re)fetching URL", "url", Filename)
defer resp.Body.Close()
scanner = bufio.NewScanner(resp.Body)

Expand All @@ -97,7 +97,7 @@ func LoadDomainsCsv(Filename string) (*tst.TernarySearchTree, *tst.TernarySearch
if err != nil {
return prefix, suffix, all, err
}
dnslog.Info("(re)loading File: ", Filename)
dnslog.Info("(re)loading File", "file", Filename)
defer file.Close()
scanner = bufio.NewScanner(file)
}
Expand Down
2 changes: 1 addition & 1 deletion dns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func Test_reverse(t *testing.T) {
}

func TestDNSClient_lookupDomain4(t *testing.T) {
tmp, err := dnsclient.New("udp://1.1.1.1:53", true)
tmp, err := dnsclient.New("udp://1.1.1.1:53", true, "")
if err != nil {
t.Errorf("failed to set up DNS client")
}
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
module github.com/mosajjal/sniproxy

go 1.19
go 1.20

require (
github.com/deathowl/go-metrics-prometheus v0.0.0-20221009205350-f2a1482ba35b
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
github.com/miekg/dns v1.1.50
github.com/mosajjal/dnsclient v0.1.1-0.20230201204538-e624b9613c46
github.com/mosajjal/dnsclient v0.1.1-0.20230206011533-99fa18d84393
github.com/mosajjal/doqd v0.0.0-20230201205103-19d9a309dc6a
github.com/oschwald/maxminddb-golang v1.10.0
github.com/prometheus/client_golang v1.14.0
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475
github.com/spf13/cobra v1.6.1
golang.org/x/exp v0.0.0-20230131160201-f062dba9d201
golang.org/x/exp v0.0.0-20230203172020-98cc5a0785f9
golang.org/x/net v0.5.0
)

Expand All @@ -32,7 +32,7 @@ require (
github.com/quic-go/qtls-go1-18 v0.2.0 // indirect
github.com/quic-go/qtls-go1-19 v0.2.0 // indirect
github.com/quic-go/qtls-go1-20 v0.1.0 // indirect
github.com/quic-go/quic-go v0.31.2-0.20230128084952-89769f409f63 // indirect
github.com/quic-go/quic-go v0.32.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.8.1 // indirect
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/mosajjal/dnsclient v0.1.1-0.20230201204538-e624b9613c46 h1:9JpYVSXoZxxrXZz1CqsGZ0TSYBc2PLsvMyHoNT5+1M4=
github.com/mosajjal/dnsclient v0.1.1-0.20230201204538-e624b9613c46/go.mod h1:8Trvd8mQtUzFFvQXfl8uVAkTKlRvdZTui9YdC+VaII0=
github.com/mosajjal/dnsclient v0.1.1-0.20230206011533-99fa18d84393 h1:0z8akaPI28pOF5PbqX0K8WrAQwGS7KBdNtTMrtluTOU=
github.com/mosajjal/dnsclient v0.1.1-0.20230206011533-99fa18d84393/go.mod h1:a7Dm03DazQMCGIZx37JLQBgjzSR29oGWAQmA67MGI1w=
github.com/mosajjal/doqd v0.0.0-20230201205103-19d9a309dc6a h1:SY+kMKt0eMsPSdCXVYvHDeObqwK0Fnm6n63ayAe8x/4=
github.com/mosajjal/doqd v0.0.0-20230201205103-19d9a309dc6a/go.mod h1:zplAd0brmTfRUAH00w+gBfx+IFIbiY4QXSU09qL7H20=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
Expand Down Expand Up @@ -93,6 +95,8 @@ github.com/quic-go/qtls-go1-20 v0.1.0 h1:d1PK3ErFy9t7zxKsG3NXBJXZjp/kMLoIb3y/kV5
github.com/quic-go/qtls-go1-20 v0.1.0/go.mod h1:JKtK6mjbAVcUTN/9jZpvLbGxvdWIKS8uT7EiStoU1SM=
github.com/quic-go/quic-go v0.31.2-0.20230128084952-89769f409f63 h1:WGiweFiDFZN/Gvh7vDvCA9t5ITRDVPlPiNBElcccEzg=
github.com/quic-go/quic-go v0.31.2-0.20230128084952-89769f409f63/go.mod h1:hxFKrdETREINAl6MaAghmq0tj6nWPx7PbYWFNkCFyPc=
github.com/quic-go/quic-go v0.32.0 h1:lY02md31s1JgPiiyfqJijpu/UX/Iun304FI3yUqX7tA=
github.com/quic-go/quic-go v0.32.0/go.mod h1:/fCsKANhQIeD5l76c2JFU+07gVE3KaA0FP+0zMWwfwo=
github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
Expand Down Expand Up @@ -124,6 +128,8 @@ golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE=
golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU=
golang.org/x/exp v0.0.0-20230131160201-f062dba9d201 h1:BEABXpNXLEz0WxtA+6CQIz2xkg80e+1zrhWyMcq8VzE=
golang.org/x/exp v0.0.0-20230131160201-f062dba9d201/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/exp v0.0.0-20230203172020-98cc5a0785f9 h1:frX3nT9RkKybPnjyI+yvZh6ZucTZatCCEm9D47sZ2zo=
golang.org/x/exp v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ func main() {
c.dialer = proxy.Direct
}

tmp, err := dnsclient.New(c.UpstreamDNS, true)
tmp, err := dnsclient.New(c.UpstreamDNS, true, c.UpstreamSOCKS5)
if err != nil {
log.Error("", err)
}
Expand Down

0 comments on commit a4256cd

Please sign in to comment.