Skip to content

Commit

Permalink
proxy: add quic session to dns context
Browse files Browse the repository at this point in the history
  • Loading branch information
ainar-g committed Jan 25, 2021
1 parent 397591e commit d0d0afa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
10 changes: 8 additions & 2 deletions proxy/dns_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ type DNSContext struct {
// If set, Resolve() uses it instead of default servers
CustomUpstreamConfig *UpstreamConfig

// Conn - underlying client connection. Can be null in the case of DOH.
// Conn is the underlying client connection. It is nil if Proto is
// ProtoDNSCrypt, ProtoHTTPS, or ProtoQUIC.
Conn net.Conn

// localIP - local IP address (for UDP socket to call udpMakeOOBWithSrc)
Expand All @@ -40,9 +41,14 @@ type DNSContext struct {
// DNSCryptResponseWriter - necessary to respond to a DNSCrypt query
DNSCryptResponseWriter dnscrypt.ResponseWriter

// QUICStream - QUIC stream from which we got the query (for DOQ only)
// QUICStream is the QUIC stream from which we got the query. For
// ProtoQUIC only.
QUICStream quic.Stream

// QUICSession is the QUIC session from which we got the query. For
// ProtoQUIC only.
QUICSession quic.Session

ecsReqIP net.IP // ECS IP used in request
ecsReqMask uint8 // ECS mask used in request
}
Expand Down
9 changes: 5 additions & 4 deletions proxy/server_quic.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,11 @@ func (p *Proxy) handleQUICStream(stream quic.Stream, session quic.Session) {
}

d := &DNSContext{
Proto: ProtoQUIC,
Req: &msg,
Addr: session.RemoteAddr(),
QUICStream: stream,
Proto: ProtoQUIC,
Req: &msg,
Addr: session.RemoteAddr(),
QUICStream: stream,
QUICSession: session,
}

err = p.handleDNSRequest(d)
Expand Down

0 comments on commit d0d0afa

Please sign in to comment.