Skip to content
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.

Commit

Permalink
added records slice for easy authorization parsing.
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Lloyd <mike.lloyd@gsa.gov>
  • Loading branch information
siennathesane committed Nov 7, 2019
1 parent f57452b commit 3e9e64c
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 7 deletions.
8 changes: 6 additions & 2 deletions dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ type IntegrationServer struct {
// RecordsHandler that can be queried against.
TestRecords map[string]string

// Channel for receiving records. This is exported so it can be used as a pipeline for inspecting records as they
// traverse from Gravel to the integration DNS.
// Records received and available for downstream processing.
Records []DnsMessage

// Channel for receiving records. Mostly used for internal purposes.
RecordsHandler chan DnsMessage

// Options on how the DNS instance is running.
Expand Down Expand Up @@ -87,6 +89,7 @@ func NewIntegrationServer(opts *IntegrationServerOpts) *IntegrationServer {

is.Opts = opts
is.RecordsHandler = opts.RecordHandler
is.Records = make([]DnsMessage, 0)
is.TestRecords = make(map[string]string)
if is.Opts.DnsPort == 0 {
is.Opts.DnsPort = 54
Expand Down Expand Up @@ -161,6 +164,7 @@ func (is *IntegrationServer) handleRecords() {
for {
select {
case msg := <-is.RecordsHandler:
is.Records = append(is.Records, msg)
if is.Opts.AutoUpdateAuthZRecords {
is.mu.Lock()

Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module github.com/18f/gravel
go 1.12

require (
github.com/go-acme/lego/v3 v3.0.0
github.com/letsencrypt/challtestsrv v1.1.0
github.com/miekg/dns v1.1.15
github.com/go-acme/lego/v3 v3.1.0
github.com/letsencrypt/challtestsrv v1.2.0
github.com/miekg/dns v1.1.22
github.com/sirupsen/logrus v1.4.2
github.com/stretchr/testify v1.3.0
gopkg.in/square/go-jose.v2 v2.3.1
github.com/stretchr/testify v1.4.0
gopkg.in/square/go-jose.v2 v2.4.0
)
Loading

0 comments on commit 3e9e64c

Please sign in to comment.