Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions golang/internal/ui/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ func (u *ui) updateHeader(v *gocui.View, window5m *client.StatSnapshot) {
window5m.Pcap.IfDrops,
)
dnsc := window5m.DNS.WirePackets
_, _ = fmt.Fprintf(v, "DNS Wire Pkts %d (%3.1f%%) | Rates Total %d/s %d/%d/%d/%d | UDP %d (%3.1f%%) | TCP %d (%3.1f%%) | IPv4 %d (%3.1f%%) | IPv6 %d (%3.1f%%) | Query %d (%3.1f%%) | Response %d (%3.1f%%)\n",
_, _ = fmt.Fprintf(v, "DNS Wire Pkts %d/%d | Rates Total %d/s %d/%d/%d/%d | UDP %d (%3.1f%%) | TCP %d (%3.1f%%) | IPv4 %d (%3.1f%%) | IPv6 %d (%3.1f%%) | Query %d (%3.1f%%) | Response %d (%3.1f%%)\n",
dnsc.Total-dnsc.Filtered,
dnsc.Total,
(float64(dnsc.Total)/float64(pcounts.Total))*100,
dnsc.Rates.Total.Live,
dnsc.Rates.Total.P50,
dnsc.Rates.Total.P90,
Expand Down
1 change: 1 addition & 0 deletions golang/pkg/client/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type NameCount struct {
// DNSPayload contains the information specifically for the DNS protocol
type DNSPayload struct {
WirePackets struct {
Filtered int64 `mapstructure:"filtered"`
Ipv4 int64 `mapstructure:"ipv4"`
Ipv6 int64 `mapstructure:"ipv6"`
Queries int64 `mapstructure:"queries"`
Expand Down
15 changes: 14 additions & 1 deletion src/Configurable.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,23 @@ class Configurable
for (YAML::const_iterator it = config_yaml.begin(); it != config_yaml.end(); ++it) {
auto key = it->first.as<std::string>();

if (!it->second.IsScalar()) {
if (!it->second.IsScalar() && !it->second.IsSequence()) {
throw ConfigException(fmt::format("invalid value for key: {}", key));
}

if (it->second.IsSequence()) {
StringList sl;
for (std::size_t i = 0; i < it->second.size(); ++i) {
if (!it->second[i].IsScalar()) {
throw ConfigException(fmt::format("invalid value for sequence in key: {}", key));
}
sl.push_back(it->second[i].as<std::string>());
}
_config[key] = sl;
continue;
}

// otherwise, scalar
auto value = it->second.as<std::string>();

// the yaml library doesn't discriminate between scalar types, so we have to do that ourselves
Expand Down