get it to work on macOS #104
Replies: 4 comments 2 replies
-
if you don't know the trojan service ip , what should you do? Alternatively, the IP address of the trojan service may change at any time. |
Beta Was this translation helpful? Give feedback.
-
Here is an example of policy-route by https://github.com/heiher/hev-socks5-tunnel?tab=readme-ov-file#freebsdmacos |
Beta Was this translation helpful? Give feedback.
-
Just now i wrote a little helper to get tproxy running on macOS via local virtual machine (vm) requirements:
#!/bin/sh
# ~/bin/vmtproxy
action=$1
vmip=$2
# 0.0.0.0/1 + 128.0.0.0/1 = 0/0
dest="0.0.0.0/1 128.0.0.0/1"
show_help () {
printf '%s\n' \
"vmtproxy -s vmip : add routes and set dns" \
"vmtproxy -x : del routes and reset dns" \
"vmtproxy -l : list routes and dns" \
"requirements : start the vm with vmnet-bridged and run tproxy inside vm"
exit
}
add_route () {
sudo route add $1 $2
}
del_route () {
sudo route delete $1
}
set_dns () {
networksetup -setdnsservers Wi-Fi $1
}
case $action in
-s)
[ "$vmip" ] || exit
vmtproxy -x >/dev/null 2>&1
for i in $dest ; do add_route $i $vmip ; done
set_dns $vmip
;;
-x)
for i in $dest ; do del_route $i ; done
set_dns empty
;;
-l)
printf '%s\n\n' "ROUTING TABLE :"
netstat -nr -f inet
printf '\n%s\n' "DNS :"
grep -Ev '^[[:blank:]]*#|^[[:blank:]]*$' /etc/resolv.conf
;;
*)
show_help
;;
esac pros:
cons:
|
Beta Was this translation helpful? Give feedback.
-
pf method on macOSSUMMARYfeatures
todo
STARTcommands to run
content of
|
Beta Was this translation helpful? Give feedback.
-
better approach : #104 (comment)
how
pros and cons
Beta Was this translation helpful? Give feedback.
All reactions