xray geoip not working with hev tun (Linux OS) 🤔
Closed this issue · 1 comments
hosseinkhojany commented
Config
{
"inbounds": [
{
"listen": "[::1]",
"port": 10801,
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": true,
"allowTransparent": true
},
"sniffing": {
"destOverride": [
"http",
"tls"
],
"enabled": true,
"metadataOnly": null,
"routeOnly": false
},
"tag": "socks"
},
{
"listen": "[::1]",
"port": 10802,
"protocol": "http",
"settings": {
"auth": "noauth",
"udp": true,
"allowTransparent": true
},
"sniffing": {
"destOverride": [
"http",
"tls"
],
"enabled": true,
"metadataOnly": null,
"routeOnly": false
},
"tag": "http"
}
],
"outbounds": [
{
"tag": "proxy",
"sendThrough": "0.0.0.0",
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "",
"port": 81,
"users": [
{
"id": "",
"alterId": 0,
"security": "auto",
"encryption": "none",
"flow": ""
}
]
}
]
},
"streamSettings": {
"tcpSettings": {
"header": {
"type": "none"
}
},
"realitySettings": {
"fingerprint": "firefox",
"show": false,
"publicKey": "",
"serverName": "www.speedtest.net"
},
"network": "tcp",
"security": "reality"
}
},
{
"tag": "direct",
"protocol": "freedom",
"settings": {}
}
],
"routing": {
"domainStrategy": "AsIs",
"rules": [
{
"type": "field",
"domain": [
"regexp:.*.ir$",
"ext:iran.dat:ir",
"ext:iran.dat:other",
"geosite:category-ir-gov",
"geosite:category-ir-news",
"geosite:category-ir-bank",
"geosite:category-ir-tech",
"geosite:category-ir-travel",
"geosite:category-ir-shopping",
"geosite:category-ir-insurance",
"geosite:category-ir-scholar",
"geosite:category-ir-payment",
"geosite:category-ir-social-media",
"geosite:category-ir-media",
"geosite:category-ir-bourse",
"geosite:category-ir",
"google.com",
"www.google.com",
"snapp",
"digikala",
"speedtest",
"whatismyipaddress",
"tapsi",
"blogfa",
"bank",
"sb24.com",
"sheypoor.com",
"tebyan.net",
"beytoote.com",
"telewebion.com",
"Film2movie.ws",
"Setare.com",
"Filimo.com",
"Torob.com",
"Tgju.org",
"Sarzamindownload.com",
"soft98.ir",
"downloadha.com",
"P30download.com",
"P30download.ir",
"Sanjesh.org",
"whatismyipaddress.com",
"www.whatismyip.com",
"www.speedtest.net",
"speedtest.net"
],
"network": "tcp",
"outboundTag": "direct",
"enabled": true
},
{
"type": "field",
"ip": [
"geoip:private",
"geoip:ir"
],
"network": "tcp",
"outboundTag": "direct",
"enabled": true
},
{
"type": "field",
"port": "0-65535",
"network": "tcp",
"outboundTag": "proxy",
"enabled": true
}
]
}
}
I tested this config in proxy mode with chrome extension socks5-configurator
geoip worked ✅
but when I bypass upstream and tunneling whole system with hev-tun
just geoip not working ❌
By pass upstream shell
#!/bin/bash
#variables
host_name=$1
xray_ip=$(dig +short $host_name)
def_gate=$(ip r | grep 'default' | awk '{print$3}') # This will output your default gateway ip address . if command fails try finding the deault gateway ip by using 'ip r' command
echo "\n1\n"
ip tuntap del dev tun0 mode tun user $USER
ip route del $xray_ip via $def_gate
ip tuntap add dev tun0 mode tun user $USER
ip addr add 10.0.0.1/24 dev tun0
ip addr add fdfe:dcba:9876::1/125 dev tun0
ip route add $xray_ip via $def_gate
ip link set tun0 up
ip -6 link set tun0 up
ip route add default dev tun0
ip -6 route add default dev tun0
echo "\n2\n"
chmod +x hev
# sleep 2
# insert/update hosts entry
ip_address=$xray_ip
# find existing instances in the host file and save the line numbers
suffix="XrayTun.linux"
matches_in_hosts="$(grep -n "$suffix" /etc/hosts | cut -f1 -d:)"
host_entry="${ip_address} ${host_name} ${suffix}"
echo "Please enter your password if requested."
if [ ! -z "$matches_in_hosts" ]
then
echo "Updating existing hosts entry."
# iterate over the line numbers on which matches were found
while read -r line_number; do
# replace the text of each line with the desired host entry
sudo sed -i "${line_number}s/.*/${host_entry} /" /etc/hosts
done <<< "$matches_in_hosts"
else
echo "Adding new hosts entry."
echo "$host_entry" | sudo tee -a /etc/hosts > /dev/null
fi
$2/hev $2/b2.yml # you can define the local socks5 port here 10808 is the default
Tun Config
tunnel:
name: tun0
mtu: 8500
socks5:
port: 10801
address: ::1
udp: 'udp'
misc:
task-stack-size: 20480
connect-timeout: 10000
read-write-timeout: 60000
log-file: stderr
log-level: debug
limit-nofile: 65535
heiher commented
No ideas.