Skip to content

Commit

Permalink
Merge pull request #84 from YutaroHayakawa/cleanup-dns-interceptor
Browse files Browse the repository at this point in the history
Cleanup dns-interceptor example
  • Loading branch information
YutaroHayakawa committed Jan 31, 2022
2 parents bb29957 + cdfa88d commit 9feb09c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
8 changes: 3 additions & 5 deletions examples/basic_tproxy/dns_interceptor/go.mod
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
module fqdn-firewall
module dns-interceptor

go 1.17

require (
github.com/cilium/dns v1.1.4-0.20190417235132-8e25ec9a0ff3
github.com/miekg/dns v1.1.45
golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c
)

require (
github.com/miekg/dns v1.1.45 // indirect
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 // indirect
golang.org/x/mod v0.4.2 // indirect
golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
)
6 changes: 2 additions & 4 deletions examples/basic_tproxy/dns_interceptor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ func setupTransparentSocket(network, address string, c syscall.RawConn) error {
}

type DNSInterceptor struct {
udpClient *dns.Client
tcpClient *dns.Client
}

func (di *DNSInterceptor) NewFQDNFirewall() {
Expand Down Expand Up @@ -92,12 +90,12 @@ func main() {
Control: setupTransparentSocket,
}

tcpListener, err := listenConf.Listen(context.Background(), "tcp4", "10.0.0.1:53")
tcpListener, err := listenConf.Listen(context.Background(), "tcp4", ":53")
if err != nil {
panic(err)
}

udpListener, err := listenConf.ListenPacket(context.Background(), "udp4", "10.0.0.1:53")
udpListener, err := listenConf.ListenPacket(context.Background(), "udp4", ":53")
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion examples/basic_tproxy/dns_interceptor/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ nodes:
type: direct
args: R0#net0
- name: R0
image: fqdn-firewall:latest
image: dns-interceptor:latest
buildfile: Dockerfile.dns-interceptor
buildcontext: .
interfaces:
Expand Down

0 comments on commit 9feb09c

Please sign in to comment.