Skip to content

Commit 7388afe

Browse files
committed
move doqproto to doq package
1 parent 2279ed4 commit 7388afe

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

internal/doqproto/main.go renamed to main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package doqproto
1+
package doq
22

33
// Only implementations of the final, published RFC can identify
44
// themselves as "doq". Until such an RFC exists, implementations MUST
@@ -15,6 +15,6 @@ var TlsProtosCompat = []string{"doq-i02", "doq-i01", "doq-i00", "doq", "dq"}
1515

1616
// Errors
1717
const (
18-
DoqNoError = 0x00 // No error. This is used when the connection or stream needs to be closed, but there is no error to signal.
19-
DoqInternalError = 0x01 // The DoQ implementation encountered an internal error and is incapable of pursuing the transaction or the connection
18+
NoError = 0x00 // No error. This is used when the connection or stream needs to be closed, but there is no error to signal.
19+
InternalError = 0x01 // The DoQ implementation encountered an internal error and is incapable of pursuing the transaction or the connection
2020
)

pkg/client/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/miekg/dns"
1010
log "github.com/sirupsen/logrus"
1111

12-
"github.com/natesales/doq/internal/doqproto"
12+
"github.com/natesales/doq"
1313
)
1414

1515
// Client stores a DoQ client
@@ -22,9 +22,9 @@ func New(server string, tlsInsecureSkipVerify bool, compat bool) (Client, error)
2222
// Select TLS protocols for DoQ
2323
var tlsProtos []string
2424
if compat {
25-
tlsProtos = doqproto.TlsProtosCompat
25+
tlsProtos = doq.TlsProtosCompat
2626
} else {
27-
tlsProtos = doqproto.TlsProtos
27+
tlsProtos = doq.TlsProtos
2828
}
2929

3030
// Connect to DoQ server
@@ -59,14 +59,14 @@ func (c Client) SendQuery(message dns.Msg) (dns.Msg, error) {
5959
log.Debugln("packing dns message")
6060
packed, err := message.Pack()
6161
if err != nil {
62-
stream.Close()
62+
_ = stream.Close()
6363
return dns.Msg{}, errors.New("dns message pack: " + err.Error())
6464
}
6565

6666
// Send the DNS query over QUIC
6767
log.Debugln("writing packed format to the stream")
6868
_, err = stream.Write(packed)
69-
stream.Close()
69+
_ = stream.Close()
7070
if err != nil {
7171
return dns.Msg{}, errors.New("quic stream write: " + err.Error())
7272
}

pkg/server/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/miekg/dns"
1414
log "github.com/sirupsen/logrus"
1515

16-
"github.com/natesales/doq/internal/doqproto"
16+
"github.com/natesales/doq"
1717
)
1818

1919
// Server stores a DoQ server
@@ -45,9 +45,9 @@ func New(listenAddr string, cert tls.Certificate, upstream string, tlsCompat boo
4545
// Select TLS protocols for DoQ
4646
var tlsProtos []string
4747
if tlsCompat {
48-
tlsProtos = doqproto.TlsProtosCompat
48+
tlsProtos = doq.TlsProtosCompat
4949
} else {
50-
tlsProtos = doqproto.TlsProtos
50+
tlsProtos = doq.TlsProtos
5151
}
5252

5353
// Create QUIC listener
@@ -88,7 +88,7 @@ func handleDoQSession(session quic.Session, upstream string) {
8888
} else {
8989
log.Warnf("QUIC stream accept: %v", err)
9090
}
91-
_ = session.CloseWithError(doqproto.DoqInternalError, "") // Close the session with an internal error message
91+
_ = session.CloseWithError(doq.InternalError, "") // Close the session with an internal error message
9292
return
9393
}
9494

0 commit comments

Comments
 (0)