I use Cloudflare to hide the IP of the site, I want to do the same to hide the IP for the TCP server. There is a connection Client -> Server -> Client directly through the IP and port. I want to implement a connection using DNS record SRV in C ++. Any ideas? Maybe there are articles on this topic, I independently searched on the Internet - it did not work out.
1 answer
If you need it under Windows, then Windns.h has a DnsQuery function that can get SRV records ( DNS_TYPE_SRV )
You can take an example as a basis. I partially earned it - I could not get the IP address (SRV returns the name always) (I suspect the problem was in the encoding, I did not understand it)
https://gist.github.com/krepver/b2cab8d939fb36d9dd9e23dd9bcd2648
dnsTest.exe -n _jabber._tcp.jabber.ru -t SRV -s 8.8.8.8 Address: jabber.ru Port: 5269 Failed to query the host record for jabber.ru and the error is 123 |