fix port issue and paging issue with charts
ci.vdhsn.com/push Build is passing Details

trunk
Adam Veldhousen 3 years ago
parent e3945527d9
commit cf84d11981
Signed by: adam
GPG Key ID: 6DB29003C6DD1E4B

@ -90,7 +90,7 @@ func (ss *Sqlite) GetLogAggregate(la LogAggregateInput) (LogAggregate, error) {
logs, err := ss.GetLog(GetLogInput{
Start: la.Start,
End: la.End,
Limit: 10000,
Limit: -1,
Page: 0,
})
if err != nil {
@ -362,7 +362,7 @@ func (ss *Sqlite) GetRules() ([]RuleRow, error) {
}
func (ss *Sqlite) GetLog(in GetLogInput) (GetLogResult, error) {
if in.Limit <= 0 {
if in.Limit == 0 {
in.Limit = 25
}
@ -387,7 +387,12 @@ func (ss *Sqlite) GetLog(in GetLogInput) (GetLogResult, error) {
glr.TotalResults = lpi.Total
glr.PageCount = lpi.PageCount + 1
sql := `
limitTxt := "LIMIT ?"
if in.Limit <= -1 {
limitTxt = ""
}
sql := fmt.Sprintf(`
SELECT
started, clientIp, protocol, domain, totalTimeMs,
error, recurseRoundTripTimeMs, recurseUpstreamIp, status
@ -403,10 +408,10 @@ func (ss *Sqlite) GetLog(in GetLogInput) (GetLogResult, error) {
recurseUpstreamIp,
status
FROM log
WHERE CAST(strftime('%s', started) AS INTEGER) BETWEEN ? AND ?
WHERE CAST(strftime('%%s', started) AS INTEGER) BETWEEN ? AND ?
ORDER BY started DESC
) WHERE id <= ? ORDER BY id DESC LIMIT ?;
`
) WHERE id <= ? ORDER BY id DESC %s;
`, limitTxt)
rows, err := ss.DB.Query(sql, in.Start.UTC().Format(ISO8601), in.End.UTC().Format(ISO8601), lpi.FirstItemID, in.Limit)
if err != nil {

@ -7,7 +7,7 @@ build: clobber .bin/client/public .bin/gopherhole
dev: clean .bin/gopherhole
GOPHERHOLE_UPSTREAM="1.1.1.1:53" \
GOPHERHOLE_MIN_TTL="60s" \
.bin/gopherhole -dns-address=:5353 -http-address=:8000
.bin/gopherhole -dns-address=:15353 -http-address=:8000
client-dev:
docker run -it --rm --name='client-dev' \
@ -37,10 +37,10 @@ vdhsn/gopherhole:
-t vdhsn/gopherhole:latest .
test:
dig -p 5353 twitter.com @localhost
dig -p 5353 google.com @localhost
dig -p 5353 loki.veldhousen.ninja @localhost
dig -p 5353 www.liveauctioneers.com @localhost
dig -p 15353 twitter.com @localhost
dig -p 15353 google.com @localhost
dig -p 15353 loki.veldhousen.ninja @localhost
dig -p 15353 www.liveauctioneers.com @localhost
lint: tidy
# lint: $(LINTBIN) tidy

Loading…
Cancel
Save