abh / geodns

DNS server with per-client targeted responses
Apache License 2.0
1.37k stars 191 forks source link

Geo dns not work #141

Open sadeghpro opened 6 months ago

sadeghpro commented 6 months ago

Hi every one, I have a file named s-m.app.json that contains this

{
    "serial":1394372421,
    "ttl":    120,
    "targeting": "country continent @ regiongroup region asn",
    "data":{
        "":{
            "ns": [ "ns1.s-m.app", "ns2.s-m.app" ],
            "a":[
                [
                   "157.90.127.83",
                   "100"
                ]
            ]
        },
        "test":{
            "ns": [ "ns1.s-m.app", "ns2.s-m.app" ],
            "a":[
                [
                   "157.90.127.83",
                   "100"
                ]
            ]
        },
        "test.asia":{
            "ns": [ "ns1.s-m.app", "ns2.s-m.app" ],
            "a":[
                [
                   "185.53.143.66",
                   "100"
                ]
            ]
        }
    }
}

but when I ran below command from asia I don't get correct ip ➜ ~ dig -t a +short test.s-m.app 157.90.127.83 ➜ ~ dig -t a +short test.asia.s-m.app 185.53.143.66

as you see it get test.asia record as subdomain.

I build geodns with this docker file

FROM golang:1.22rc1

RUN apt-get update \
 && apt-get install -y libgeoip-dev

RUN git clone https://github.com/abh/geodns.git /geodns
WORKDIR /geodns
RUN go build && ./geodns -h

CMD [ "./geodns", "-log" ]

and run it with this docker-compose.yml file

version: '3.3'
services:
  geodns:
    image: sadeghpro/geodns:1.0.1
    container_name: geodns
    restart: unless-stopped
    volumes:
      - ./dns:/geodns/dns
    ports:
      - "53:53/udp"
      - "53:53"
      - "8053:8053"

I tried asia.test with putting "version": 2 at top of file but nothing changed.