In https://luohuahuang.org/2018/08/23/mitmproxy/ I introduced a tool to setup HTTP(s) proxy to test our new server. Our Android client is using HTTPS protocol, however our iOS client is using TCP protocol. mitmproxy is for HTTP(s) protocol only.
Found one tool https://gist.github.com/ogrrd/5831371 for this purpose.
Follow steps on https://gist.github.com/ogrrd/5831371 and http://www.natemcintyre.com/blog/2016/8/25/configuring-your-own-dns-server-on-mac-os-x to setup
- brew install dnsmasq
- mkdir -pv $(brew –prefix)/etc/
- echo ‘address=/.dev/127.0.0.1’ > $(brew –prefix)/etc/dnsmasq.conf
- sudo cp -v $(brew –prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
- sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
- sudo mkdir -v /etc/resolver
- sudo bash -c ‘echo “nameserver 127.0.0.1” > /etc/resolver/dev’
- Configure hostname to IP address mapping via the local hosts file.
- Command: vim /etc/hosts
- This step can vary depending on how you have ‘dnsmasq’ configured, but with default configurations the software will look to the servers /etc/hosts file to serve as the hostname/ip registrar.
- System Preferences > Network > Wi-Fi (or whatever you use) > Advanced… > DNS > add 127.0.0.1 to top of the list.