Browse Source

- FIX: timetable eval time as "local time" (no UTC)

- FIX: Dockerfile: added timezone configuration (defaults to CET), use TZ env var to change it
master
bloved 1 month ago
parent
commit
85ff0dac52
5 changed files with 14 additions and 3 deletions
  1. +2
    -0
      Dockerfile.amd64
  2. +2
    -0
      Dockerfile.arm32v7
  3. +2
    -0
      Dockerfile.arm64v8
  4. +2
    -0
      README.md
  5. +6
    -3
      dns_handler.go

+ 2
- 0
Dockerfile.amd64 View File

@ -10,9 +10,11 @@ FROM debian:latest
RUN apt update
RUN apt upgrade -y
RUN apt install ca-certificates -y
RUN apt install tzdata -y
RUN mkdir -p /opt/zabov
WORKDIR /opt/zabov
COPY --from=builder /go/src/zabov /opt/zabov
EXPOSE 53/udp
ENV TZ Europe/Rome
ENTRYPOINT ["/opt/zabov/zabov"]

+ 2
- 0
Dockerfile.arm32v7 View File

@ -10,8 +10,10 @@ FROM arm32v7/debian:latest
RUN apt update
RUN apt upgrade -y
RUN apt install ca-certificates -y
RUN apt install tzdata -y
RUN mkdir -p /opt/zabov
WORKDIR /opt/zabov
COPY --from=builder /go/src/zabov /opt/zabov
EXPOSE 53/udp
ENV TZ Europe/Rome
ENTRYPOINT ["/opt/zabov/zabov"]

+ 2
- 0
Dockerfile.arm64v8 View File

@ -10,8 +10,10 @@ FROM arm64v8/debian:latest
RUN apt update
RUN apt upgrade -y
RUN apt install ca-certificates -y
RUN apt install tzdata -y
RUN mkdir -p /opt/zabov
WORKDIR /opt/zabov
COPY --from=builder /go/src/zabov /opt/zabov
EXPOSE 53/udp
ENV TZ Europe/Rome
ENTRYPOINT ["/opt/zabov/zabov"]

+ 2
- 0
README.md View File

@ -176,6 +176,8 @@ ipgroups: an array of ipgroup dictionaries
# DOCKER
Multistage Dockerfiles are provided for AMD64, ARMv7, ARM64V8
NOTE: you shall use TZ env var to change docker image timezone. TZ defaults to CET.
# TODO:
- ~~caching~~

+ 6
- 3
dns_handler.go View File

@ -105,6 +105,8 @@ func init() {
dns.TypeTA: "TypeTA",
dns.TypeDLV: "TypeDLV",
dns.TypeReserved: "TypeReserved"}
fmt.Println("Local Time:", getLocalTime().Format(time.ANSIC))
}
func logQuery(clientIP string, name string, reqType uint16, config string, timetable string, killed string) {
@ -136,8 +138,8 @@ func logQuery(clientIP string, name string, reqType uint16, config string, timet
}
}
func getCurTime() (time.Time, error) {
return time.Parse("15:04", time.Now().Format("15:04"))
func getLocalTime() time.Time {
return time.Now().Local()
}
func confFromTimeTable(timetable string) string {
@ -149,7 +151,8 @@ func confFromTimeTable(timetable string) string {
return "default"
}
for _, ttentry := range tt.table {
now := time.Now()
now := getLocalTime()
nowHour := now.Hour()
nowMinute := now.Minute()
weekday := weekdays[now.Weekday()]

Loading…
Cancel
Save