From 912aff27eea2e07d5d03ded011498e0b7352af42 Mon Sep 17 00:00:00 2001 From: Johan Stenstam Date: Fri, 27 Sep 2024 12:24:42 +0200 Subject: [PATCH] * removed lots of commented out code --- LICENSE | 2 +- Makefile | 44 --------------- api_utils.go | 16 +----- apiclient.go | 8 +-- bitmask.go | 2 +- certs.go | 17 +----- cli_utils.go | 2 +- dawg_utils.go | 2 +- delegation_utils.go | 17 +----- dns_utils.go | 22 +------- globals.go | 4 +- logging.go | 16 +----- make-version.sh | 21 ------- mqtt_utils.go | 130 +------------------------------------------- rr_set.go | 17 +----- structs.go | 17 +----- tty_utils.go | 3 +- zone_utils.go | 29 +--------- 18 files changed, 25 insertions(+), 344 deletions(-) delete mode 100644 Makefile delete mode 100644 make-version.sh diff --git a/LICENSE b/LICENSE index 516c133..f3bf262 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 2-Clause License -Copyright (c) 2024, DNS Threat and Privacy Internet Research +Copyright (c) 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/Makefile b/Makefile deleted file mode 100644 index c5d48aa..0000000 --- a/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# PROG:=tem -VERSION:=`cat ./VERSION` -COMMIT:=`git describe --dirty=+WiP --always` -APPDATE=`date +"%Y-%m-%d-%H:%M"` -GOFLAGS:=-v -ldflags "-X app.version=$(VERSION)-$(COMMIT)" - -GOOS ?= $(shell uname -s | tr A-Z a-z) - -GO:=GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 go - -build: gen-mqtt-msg-new-qname.go - /bin/sh make-version.sh $(VERSION)-$(COMMIT) $(APPDATE) - -# tapir.pb.go: tapir.proto -# protoc -I=. --go_out=. tapir.proto - -lint: - go fmt ./... - go vet ./... - staticcheck ./... - gosec ./... - golangci-lint run - - -# gen-mqtt-msg-new-qname.go: checkout/events-mqtt-message-new_qname.json -# go-jsonschema checkout/events-mqtt-message-new_qname.json --package tapir --tags json --only-models --output gen-mqtt-msg-new-qname.go - -# gen-mqtt-msg.go: checkout/events-mqtt-message.json -# go-jsonschema checkout/events-mqtt-message.json --package tapir --tags json --only-models --output gen-mqtt-msg.go - -# checkout/events-mqtt-message-new_qname.json: checkout -# cd checkout; python schemasplit.py events-mqtt-message-new_qname.yaml - -# checkout/events-mqtt-message.json: checkout -# cd checkout; python schemasplit.py events-mqtt-message.yaml - -# checkout: -# git clone git@github.com:dnstapir/protocols.git checkout - -clean: - @rm -f $(PROG) *~ - -.PHONY: build clean generate - diff --git a/api_utils.go b/api_utils.go index 23ea284..36d41b0 100644 --- a/api_utils.go +++ b/api_utils.go @@ -1,19 +1,5 @@ -// Copyright 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - /* - * + * Copyright 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se */ package tapir diff --git a/apiclient.go b/apiclient.go index 452602c..d10aa36 100644 --- a/apiclient.go +++ b/apiclient.go @@ -1,6 +1,5 @@ /* - * Copyright (c) 2024 DNS TAPIR - * + * Copyright (c) 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se */ package tapir @@ -160,11 +159,6 @@ func (api *ApiClient) SetupTLS(tlsConfig *tls.Config) error { if err != nil { return fmt.Errorf("error reading CA file '%s': %v", cacert, err) } - // roots := x509.NewCertPool() - // ok := roots.AppendCertsFromPEM(caCertPEM) - // if !ok { - // log.Printf("Error parsing root cert: %v\n", err) - // } client = &http.Client{ Transport: &http.Transport{ diff --git a/bitmask.go b/bitmask.go index 71f9cee..0ffe809 100644 --- a/bitmask.go +++ b/bitmask.go @@ -1,5 +1,5 @@ /* - * Copyright (c) DNS TAPIR + * Copyright (c) 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se */ package tapir diff --git a/certs.go b/certs.go index 42ac56d..6668069 100644 --- a/certs.go +++ b/certs.go @@ -1,17 +1,6 @@ -// Copyright 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - +/* + * Copyright 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se + */ package tapir import ( diff --git a/cli_utils.go b/cli_utils.go index 451ce0f..a972976 100644 --- a/cli_utils.go +++ b/cli_utils.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 DNS TAPIR + * Copyright (c) 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se */ package tapir diff --git a/dawg_utils.go b/dawg_utils.go index 02d208d..c0d07ec 100644 --- a/dawg_utils.go +++ b/dawg_utils.go @@ -1,5 +1,5 @@ /* - * Copyright (c) DNS TAPIR + * Copyright (c) 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se */ package tapir diff --git a/delegation_utils.go b/delegation_utils.go index 99da430..3ffc050 100644 --- a/delegation_utils.go +++ b/delegation_utils.go @@ -1,20 +1,7 @@ -// Copyright 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - /* - * + * Copyright 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se */ + package tapir import ( diff --git a/dns_utils.go b/dns_utils.go index da94430..9016dc6 100644 --- a/dns_utils.go +++ b/dns_utils.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 DNS TAPIR + * Copyright (c) 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se */ package tapir @@ -25,9 +25,6 @@ const ( // TODO: Add support for TSIG zone transfers. -// keepfunc(rrtype) is a predicate that is used to decide whether to include a particular -// RRtype in the resulting, kept, zonedata. Used to filter out DNSSEC RRs if needed. - func (zd *ZoneData) ZoneTransferIn(upstream string, serial uint32, ttype string) (uint32, error) { if upstream == "" { @@ -76,8 +73,6 @@ func (zd *ZoneData) ZoneTransferIn(upstream string, serial uint32, ttype string) } } - // zd.Logger.Printf("ZoneTransferIn: %s: dropped %d RRs (filter), kept %d apex RRs + %d BodyRRs", - // zd.ZoneName, zd.DroppedRRs, zd.ApexLen, len(zd.BodyRRs)) zd.Logger.Printf("ZoneTransferIn: %s: dropped %d RRs (filter), kept %d apex RRs", zd.ZoneName, zd.DroppedRRs, zd.ApexLen) @@ -138,12 +133,8 @@ func (zd *ZoneData) ReadZone(r io.Reader) (uint32, error) { zd.ComputeIndices() // for zonetype 3, otherwise no-op - // fmt.Printf("ReadZoneFile: Size: zoneparser: %d zd.RRs: %d\n", size.Of(zp), size.Of(zd.RRs)) - zd.XfrType = "axfr" // XXX: technically not true, but the distinction is between complete zone and "diff" - // zd.Logger.Printf("ReadZoneFile: %s: dropped %d RRs (filter), kept %d apex RRs + %d BodyRRs", - // zd.ZoneName, zd.DroppedRRs, zd.ApexLen, len(zd.BodyRRs)) zd.Logger.Printf("ReadZoneFile: %s: dropped %d RRs (filter), kept %d apex RRs", zd.ZoneName, zd.DroppedRRs, zd.ApexLen) @@ -187,10 +178,8 @@ func (zd *ZoneData) RRSortFunc(rr dns.RR, first_soa *dns.SOA) { zd.ApexLen++ } tmp = odmap.RRtypes[rrtype] - // zd.Logger.Printf("RRSortFunc: odmap.RRtypes: %v", odmap.RRtypes) tmp.RRs = append(tmp.RRs, rr) odmap.RRtypes[rrtype] = tmp - // odmap.RRtypes[rrtype].RRs = append(odmap.RRtypes[rrtype].RRs, rr) case *dns.NS: if owner == zd.ZoneName { zd.NSrrs = append(zd.NSrrs, rr) @@ -198,23 +187,19 @@ func (zd *ZoneData) RRSortFunc(rr dns.RR, first_soa *dns.SOA) { tmp = odmap.RRtypes[rrtype] tmp.RRs = append(tmp.RRs, rr) odmap.RRtypes[rrtype] = tmp - // odmap.RRtypes[rrtype].RRs = append(odmap.RRtypes[rrtype].RRs, rr) } else { tmp = odmap.RRtypes[rrtype] tmp.RRs = append(tmp.RRs, rr) odmap.RRtypes[rrtype] = tmp - // odmap.RRtypes[rrtype].RRs = append(odmap.RRtypes[rrtype].RRs, rr) } case *dns.RRSIG, *dns.NSEC, *dns.NSEC3, *dns.NSEC3PARAM, *dns.CDS, *dns.CDNSKEY, *dns.DNSKEY: // ignore default: - // log.Printf("RRSortFunc: owner=%s, rrtype=%s", owner, dns.TypeToString[rrtype]) tmp = odmap.RRtypes[rrtype] tmp.RRs = append(tmp.RRs, rr) odmap.RRtypes[rrtype] = tmp } - // zd.Logger.Printf("ZoneName: %s, zonetype: %d", zd.ZoneName, zd.ZoneType) zd.Data[owner] = odmap } @@ -264,7 +249,6 @@ func (zd *ZoneData) WriteZoneToFile(f *os.File) error { } totalbytes += bytes bytes = 0 - // fmt.Printf("Size(zonedata): %d\n", size.Of(zonedata)) zonedata = "" } } @@ -273,7 +257,6 @@ func (zd *ZoneData) WriteZoneToFile(f *os.File) error { return err } totalbytes += bytes - // fmt.Printf("Size(zonedata): %d\n", size.Of(zonedata)) writer.Flush() return err @@ -319,9 +302,6 @@ func (zd *ZoneData) ComputeIndices() { soas.RRs = soas.RRs[:1] zd.Owners[zd.OwnerIndex[zd.ZoneName]].RRtypes[dns.TypeSOA] = soas } - // if zd.Debug { - // zd.PrintOwners() - // } } func (zd *ZoneData) PrintRRs() { diff --git a/globals.go b/globals.go index ef261b4..8fa619f 100644 --- a/globals.go +++ b/globals.go @@ -1,10 +1,8 @@ /* * Copyright (c) 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se */ -package tapir -// "github.com/spf13/cobra" -// "github.com/spf13/viper" +package tapir type CliFlags struct { ShowHdr bool diff --git a/logging.go b/logging.go index b879098..06bc4ee 100644 --- a/logging.go +++ b/logging.go @@ -1,19 +1,5 @@ -// Copyright 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - /* - * Johan Stenstam, johan.stenstam@internetstiftelsen.se + * Copyright 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se */ package tapir diff --git a/make-version.sh b/make-version.sh deleted file mode 100644 index d70d302..0000000 --- a/make-version.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# Copyright 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -appversion=$1 -appdate=$2 - -echo "package tapir" > version.go -echo "const AppVersion = \"$appversion\"" >> version.go -echo "const AppDate = \"$appdate\"" >> version.go diff --git a/mqtt_utils.go b/mqtt_utils.go index 77d975b..9a13ecc 100644 --- a/mqtt_utils.go +++ b/mqtt_utils.go @@ -1,5 +1,5 @@ /* - * Copyright (c) DNS TAPIR + * Copyright (c) Johan Stenstam, johan.stenstam@internetstiftelsen.se */ package tapir @@ -63,93 +63,6 @@ func NewMqttEngine(creator, clientid string, pubsub uint8, statusch chan Compone qos = 2 } - // clientCertFile := viper.GetString("tapir.mqtt.clientcert") - // if clientCertFile == "" { - // return nil, fmt.Errorf("MQTT client cert file not specified in config") - // } - - // clientKeyFile := viper.GetString("tapir.mqtt.clientkey") - // if clientKeyFile == "" { - // return nil, fmt.Errorf("MQTT client key file not specified in config") - // } - - // cacertFile := viper.GetString("tapir.mqtt.cacert") - // if cacertFile == "" { - // return nil, fmt.Errorf("MQTT CA cert file not specified in config") - // } - - // Setup CA cert for validating the MQTT connection - // cacertFile = filepath.Clean(cacertFile) - // caCert, err := os.ReadFile(cacertFile) - // if err != nil { - // return nil, fmt.Errorf("failed to read CA certificate in file %s: %w", cacertFile, err) - // } - // caCertPool := x509.NewCertPool() - // ok := caCertPool.AppendCertsFromPEM([]byte(caCert)) - // if !ok { - // return nil, fmt.Errorf("failed to parse CA certificate in file %s", cacertFile) - // } - - // Setup client cert/key for mTLS authentication - // clientCert, err := tls.LoadX509KeyPair(clientCertFile, clientKeyFile) - // if err != nil { - // return nil, fmt.Errorf("failed to load client certificate in file %s: %w", clientCertFile, err) - // } - - // Check if the client certificate is expiring soon (less than a month away) - // now := time.Now() - // expirationDays := viper.GetInt("certs.expirationwarning") - // if expirationDays == 0 { - // expirationDays = 30 - // } - // expirationWarningThreshold := now.AddDate(0, 0, expirationDays) - // if clientCert.Leaf == nil { - // // Parse the certificate if Leaf is not available - // cert, err := x509.ParseCertificate(clientCert.Certificate[0]) - // if err != nil { - // return nil, fmt.Errorf("failed to parse client certificate: %w", err) - // } - // clientCert.Leaf = cert - // } - - // log.Printf("*** Parsed DNS TAPIR client cert (from file %s):\n*** Cert not valid before: %v\n*** Cert not valid after: %v", clientCertFile, clientCert.Leaf.NotBefore, clientCert.Leaf.NotAfter) - - // if clientCert.Leaf.NotAfter.Before(expirationWarningThreshold) { - // msg := fmt.Sprintf("Client certificate will expire on %v (< %d days away)", clientCert.Leaf.NotAfter.Format(TimeLayout), expirationDays) - // lg.Printf("WARNING: %s", msg) - // statusch <- ComponentStatusUpdate{ - // Component: "cert-status", - // Status: StatusWarn, - // Msg: msg, - // TimeStamp: time.Now(), - // } - // } - - // Check if any of the CA certificates are expiring soon - // block, _ := pem.Decode([]byte(caCert)) - // if block == nil { - // return nil, fmt.Errorf("failed to decode PEM block containing the certificate") - // } - // log.Printf("Parsed CA cert: %+v", block) - // certs, err := x509.ParseCertificates(block.Bytes) - // if err != nil { - // return nil, fmt.Errorf("failed to parse CA certificates in file %s: %w", cacertFile, err) - // } - - // for _, caCert := range certs { - // log.Printf("*** Parsed DNS TAPIR CA cert (from file %s):\n*** Cert not valid before: %v\n*** Cert not valid after: %v", cacertFile, caCert.NotBefore, caCert.NotAfter) - // if caCert.NotAfter.Before(expirationWarningThreshold) { - // msg := fmt.Sprintf("CA certificate with subject %s will expire on %v (< %d days away)", caCert.Subject, caCert.NotAfter.Format(TimeLayout), expirationDays) - // lg.Printf("WARNING: %s", msg) - // statusch <- ComponentStatusUpdate{ - // Component: "cert-status", - // Status: StatusWarn, - // Msg: msg, - // TimeStamp: time.Now(), - // } - // } - // } - _, caCertPool, clientCert, err := FetchTapirClientCert(lg, statusch) if err != nil { return nil, fmt.Errorf("failed to fetch client certificate: %w", err) @@ -497,12 +410,6 @@ func NewMqttEngine(creator, clientid string, pubsub uint8, statusch chan Compone return &me, nil } -// return nil -//} - -// func (me *MqttEngine) PubSubToTopic(topic string, signingkey *ecdsa.PrivateKey, validatorkey *ecdsa.PublicKey, -// -// subscriberCh chan MqttPkg, mode string) (map[string]TopicData, error) { func (me *MqttEngine) xxxPubSubToTopic(topic string, signingkey *ecdsa.PrivateKey, validatorkey *ecdsa.PublicKey, subscriberCh chan MqttPkgIn, mode string, validate bool) (map[string]TopicData, error) { // log.Printf("MQTT Engine: AddTopic: topic %s, validatorkey %v", topic, validatorkey) @@ -522,14 +429,11 @@ func (me *MqttEngine) xxxPubSubToTopic(topic string, signingkey *ecdsa.PrivateKe } if signingkey != nil { - // log.Printf("MQTT Engine: AddTopic: me: %v", me) - // me.SigningKeys[topic] = signingkey tdata.SigningKey = signingkey log.Printf("MQTT Engine %s: added signingkey for topic %s.", me.Creator, topic) } if validatorkey != nil { - // me.ValidatorKeys[topic] = validatorkey tdata.ValidatorKey = validatorkey tdata.SubscriberCh = subscriberCh log.Printf("MQTT Engine %s: added validatorkey for topic %s.", me.Creator, topic) @@ -538,21 +442,6 @@ func (me *MqttEngine) xxxPubSubToTopic(topic string, signingkey *ecdsa.PrivateKe me.TopicData[topic] = tdata log.Printf("MQTT Engine %s: added topic %s. Engine now has %d topics", me.Creator, topic, len(me.TopicData)) - // does the MqttEngine already have a connection manager (i.e. is it already running) - // if me.ConnectionManager != nil { - // if _, err := me.ConnectionManager.Subscribe(context.Background(), &paho.Subscribe{ - // Subscriptions: []paho.SubscribeOptions{ - // { - // Topic: topic, - // QoS: byte(me.QoS), - // }, - // }, - // }); err != nil { - // return me.TopicData, fmt.Errorf("AddTopic: failed to subscribe to topic %s: %v", topic, err) - // } - // log.Printf("MQTT Engine %s: added topic %s to running MQTT Engine. Engine now has %d topics", me.Creator, topic, len(me.TopicData)) - // } - return me.TopicData, nil } @@ -578,8 +467,6 @@ func (me *MqttEngine) PubToTopic(topic string, signingkey *ecdsa.PrivateKey, mod tdata.Sign = sign if signingkey != nil { - // log.Printf("MQTT Engine: AddTopic: me: %v", me) - // me.SigningKeys[topic] = signingkey tdata.SigningKey = signingkey log.Printf("MQTT Engine %s: added signingkey for topic %s.", me.Creator, topic) } @@ -690,13 +577,8 @@ func (me *MqttEngine) RemoveTopic(topic string) (map[string]TopicData, error) { return me.TopicData, nil } -// func (me *MqttEngine) StartEngine() (chan MqttEngineCmd, chan MqttPkg, chan MqttPkg, error) { -// XXX: The outbox channel should really be type MqttData, not interface{}. It should be MqttData all over the place. func (me *MqttEngine) StartEngine() (chan MqttEngineCmd, chan MqttPkgOut, chan MqttPkgIn, error) { // We can start the mqtt engine without topics, topics may be added later - // if len(me.ValidatorKeys) == 0 && len(me.SigningKeys) == 0 { - // return nil, nil, nil, fmt.Errorf("MQTT Engine: no topics added") - //} resp := make(chan MqttEngineResponse, 1) me.CmdChan <- MqttEngineCmd{Cmd: "start", Resp: resp} r := <-resp @@ -798,15 +680,7 @@ func PrintTapirMqttPkg(pkg MqttPkgIn, lg *log.Logger) { fmt.Printf("MQTT: failed to decode json: %v", err) return } - // var out []string - // lg.Printf("Received TAPIR MQTT Message:\n") - // for _, a := range tm.Added { - // out = append(out, fmt.Sprintf("ADD: %s|%032b", a.Name, a.TagMask)) - // } - // for _, a := range tm.Removed { - // out = append(out, fmt.Sprintf("DEL: %s", a.Name)) - // } - // lg.Println(columnize.SimpleFormat(out)) + PrintTapirMsg(tm, lg) } diff --git a/rr_set.go b/rr_set.go index 95aa2da..d6fbdb3 100644 --- a/rr_set.go +++ b/rr_set.go @@ -1,20 +1,7 @@ -// Copyright 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - /* - * + * Copyright 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se */ + package tapir import ( diff --git a/structs.go b/structs.go index 4cc865a..21b536a 100644 --- a/structs.go +++ b/structs.go @@ -1,17 +1,6 @@ -// -// Copyright (c) 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * Copyright (c) 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se + */ package tapir diff --git a/tty_utils.go b/tty_utils.go index c4580bb..84644ff 100644 --- a/tty_utils.go +++ b/tty_utils.go @@ -1,6 +1,7 @@ /* - * Copyright (c) DNS TAPIR + * Copyright (c) Johan Stenstam, johan.stenstam@internetstiftelsen.se */ + package tapir import ( diff --git a/zone_utils.go b/zone_utils.go index 6654363..c2c4233 100644 --- a/zone_utils.go +++ b/zone_utils.go @@ -1,20 +1,7 @@ -// Copyright 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - /* - * Johan Stenstam, johan.stenstam@internetstiftelsen.se + * Copyright 2024 Johan Stenstam, johan.stenstam@internetstiftelsen.se */ + package tapir import ( @@ -133,16 +120,9 @@ func (zd *ZoneData) FetchFromUpstream(upstream string, current_serial uint32, ve zd.Data = zonedata.Data // zd.RpzData = zonedata.RpzData - // XXX: This isn't exactly safe (as there may be multiple ongoing requests), - // but for the limited test case we have it should work. - - // Zones[zd.ZoneName] = zonedata - return nil } -// zd.Sync() is used to ensure that the data in zd.SOA, zd.NSrrs, etc is reflected in the zd.RRs slice. -// Typically used in preparation for a ZONEMD computation or an outbound zone transfer. func (zd *ZoneData) Sync() error { log.Printf("zd.Sync(): pre sync: there are %d RRs in BodyRRs and %d RRs in RRs", len(zd.BodyRRs), len(zd.RRs)) @@ -151,9 +131,6 @@ func (zd *ZoneData) Sync() error { switch zd.ZoneType { case RpzZone: - // rrs = []dns.RR{dns.RR(&zd.SOA)} - // rrs = append(rrs, zd.NSrrs...) - // rrs = append(rrs, body_rrs...) case SliceZone: for _, odmap := range zd.Data { for _, rrl := range odmap.RRtypes { @@ -165,8 +142,6 @@ func (zd *ZoneData) Sync() error { } zd.RRs = rrs - // log.Printf("zd.Sync(): post sync: there are %d RRs in BodyRRs and %d RRs in RRs", - // len(zd.BodyRRs), len(zd.RRs)) return nil }