Skip to content

Commit

Permalink
tetragon: extract protobuf from the dns cache
Browse files Browse the repository at this point in the history
Preparing to use Cilium to fetch DNS names (lost in conversion to OSS) we
have the dns pkg pulling in protobufs. This is a bit odd and not ideal
because Cilium certainly doesn't care about Tetragon protobufs and
importing them and using them in Cilium side is awkward.

For now do some simple refactoring to clean up the API.

Signed-off-by: John Fastabend <[email protected]>
  • Loading branch information
jrfastab authored and michi-covalent committed Jun 3, 2022
1 parent ff0b1f1 commit 8fd6076
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions pkg/dns/dns_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package dns
import (
"fmt"

"github.com/cilium/tetragon/api/v1/tetragon"
lru "github.com/hashicorp/golang-lru"
)

Expand Down Expand Up @@ -36,13 +35,9 @@ func (c *Cache) GetIp(ip string) ([]string, error) {
return entry.([]string), nil
}

func (c *Cache) AddIp(dns *tetragon.DnsInfo) {
if !dns.Response {
return
}

for _, ip := range dns.Ips {
c.cache.Add(ip, dns.Names)
func (c *Cache) AddIp(ips, names []string) {
for _, ip := range ips {
c.cache.Add(ip, names)
}
}

Expand Down

0 comments on commit 8fd6076

Please sign in to comment.