Regex writing format
dionassydqi opened this issue · comments
I want to force a domain regex to an ip address, for example this
r([0-9]{1,2})[^ -].*.googlevideo.com
to
74.123.123.123, what is the writing format? I've tried several options but it doesn't work.
Not support
Youtube video domain is not a legal IDNA2008 name. DNS query may fails when using some proxy app.
Config
# dnsmasq.conf
port=30000
address=/:r([0-9]{1,2})[\w\d-]*\.googlevideo\.com:/74.123.123.123
Test
$ dig @localhost -p30000 r5---sn-i3b7knsd.googlevideo.com +noidnin +noidnout
; <<>> DiG 9.16.1-Ubuntu <<>> @localhost -p30000 r5---sn-i3b7knsd.googlevideo.com +noidnin +noidnout
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64919
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;r5---sn-i3b7knsd.googlevideo.com. IN A
;; ANSWER SECTION:
r5---sn-i3b7knsd.googlevideo.com. 0 IN A 74.123.123.123
;; Query time: 0 msec
;; SERVER: 127.0.0.1#30000(127.0.0.1)
;; WHEN: 三 3月 24 16:15:37 CST 2021
;; MSG SIZE rcvd: 77