Skip to content

Commit

Permalink
* removed lots of commented out code
Browse files Browse the repository at this point in the history
  • Loading branch information
johanix committed Sep 27, 2024
1 parent 87cc282 commit 912aff2
Show file tree
Hide file tree
Showing 18 changed files with 25 additions and 344 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 2-Clause License

Copyright (c) 2024, DNS Threat and Privacy Internet Research
Copyright (c) 2024 Johan Stenstam, [email protected]

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
44 changes: 0 additions & 44 deletions Makefile

This file was deleted.

16 changes: 1 addition & 15 deletions api_utils.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
// Copyright 2024 Johan Stenstam, [email protected]
//
// 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, [email protected]
*/
package tapir

Expand Down
8 changes: 1 addition & 7 deletions apiclient.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2024 DNS TAPIR
*
* Copyright (c) 2024 Johan Stenstam, [email protected]
*/
package tapir

Expand Down Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion bitmask.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) DNS TAPIR
* Copyright (c) 2024 Johan Stenstam, [email protected]
*/

package tapir
Expand Down
17 changes: 3 additions & 14 deletions certs.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
// Copyright 2024 Johan Stenstam, [email protected]
//
// 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, [email protected]
*/
package tapir

import (
Expand Down
2 changes: 1 addition & 1 deletion cli_utils.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 DNS TAPIR
* Copyright (c) 2024 Johan Stenstam, [email protected]
*/
package tapir

Expand Down
2 changes: 1 addition & 1 deletion dawg_utils.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) DNS TAPIR
* Copyright (c) 2024 Johan Stenstam, [email protected]
*/
package tapir

Expand Down
17 changes: 2 additions & 15 deletions delegation_utils.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
// Copyright 2024 Johan Stenstam, [email protected]
//
// 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, [email protected]
*/

package tapir

import (
Expand Down
22 changes: 1 addition & 21 deletions dns_utils.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 DNS TAPIR
* Copyright (c) 2024 Johan Stenstam, [email protected]
*/
package tapir

Expand All @@ -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 == "" {
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -187,34 +178,28 @@ 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)
zd.ApexLen++
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
}

Expand Down Expand Up @@ -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 = ""
}
}
Expand All @@ -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
Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 1 addition & 3 deletions globals.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
/*
* Copyright (c) 2024 Johan Stenstam, [email protected]
*/
package tapir

// "github.com/spf13/cobra"
// "github.com/spf13/viper"
package tapir

type CliFlags struct {
ShowHdr bool
Expand Down
16 changes: 1 addition & 15 deletions logging.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
// Copyright 2024 Johan Stenstam, [email protected]
//
// 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, [email protected]
* Copyright 2024 Johan Stenstam, [email protected]
*/

package tapir
Expand Down
21 changes: 0 additions & 21 deletions make-version.sh

This file was deleted.

Loading

0 comments on commit 912aff2

Please sign in to comment.