Skip to content

Commit

Permalink
clientproxy: reorder imports
Browse files Browse the repository at this point in the history
  • Loading branch information
natesales committed Feb 24, 2021
1 parent 873163e commit 0baaff9
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions cmd/clientproxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package main

import (
"flag"
"github.com/miekg/dns"
log "github.com/sirupsen/logrus"
"net"
"os"

"github.com/miekg/dns"
log "github.com/sirupsen/logrus"

"github.com/natesales/doq/pkg/client"
)

Expand All @@ -25,14 +26,6 @@ func main() {
log.SetLevel(log.DebugLevel)
}

// Create a new DoQ client
doqClient, err := client.New(*doqServer, *tlsInsecureSkipVerify, *tlsCompat)
if err != nil {
log.Fatal(doqClient)
os.Exit(1)
}
defer doqClient.Close()

// Create the UDP DNS listener
log.Debug("creating UDP listener")
pc, err := net.ListenPacket("udp", *listenAddr)
Expand All @@ -58,13 +51,23 @@ func main() {
log.Warn(err)
}

// Create a new DoQ client
doqClient, err := client.New(*doqServer, *tlsInsecureSkipVerify, *tlsCompat)
if err != nil {
log.Fatal(doqClient)
os.Exit(1)
}

log.Debugln("sending DoQ query")
resp, err := doqClient.SendQuery(msgIn)
if err != nil {
log.Fatal(err)
os.Exit(1)
}

log.Debugln("closing doq quic stream")
doqClient.Close()

packed, err := resp.Pack()
pc.WriteTo(packed, addr)
log.Debug("finished writing")
Expand Down

0 comments on commit 0baaff9

Please sign in to comment.