gfreezy / seeker

通过使用 tun 来实现透明代理。实现了类似 surge 增强模式与网关模式。
Apache License 2.0
21 stars 2 forks source link

启动报错 #180

Open bhzhu203 opened 2 days ago

bhzhu203 commented 2 days ago
cat seeker.conf 
verbose: true
dns_start_ip: 10.0.0.10
# 可以指定多个 DNS 服务器,如果不指定则使用系统默认的 DNS 服务器。一般最好指定,否则Wi-Fi切换的时候可能会出现 DNS 服务器无法访问的问题。
# 一般 DHCP 获取 IP 的时候会自动获取 DNS 服务器,切换 Wi-Fi 的时候,DNS 服务器也会发生变化。
dns_servers:
  - 223.5.5.5:53
  - 114.114.114.114:53
  - tcp://114.114.114.114:53
dns_timeout: 1s
tun_bypass_direct: true  # 直连的域名直接返回真实IP,不走tun
# redir 模式使用 iptable 的 redirect 功能: iptables -t nat -A PREROUTING -d 11.0.0.0/16 -p tcp -j REDIRECT --to-ports 1300
# redir 模式下只支持 tcp 流量。默认使用 tun 模式。特殊设备不支持 tun 的情况,可以使用 redir 模式。
redir_mode: false
queue_number: 2  # 队列数量,linux 有效。至少为 1,queue_number 越大,性能越好。一般 2 就可以跑满 1Gbps 带宽
threads_per_queue: 3  # 每个队列的线程数量,主要工作是处理 tun 数据转发时对数据包进行 checksum 计算。一般 2-3 就可以处理一个 queue 的转发。
tun_name: utun
tun_ip: 10.0.0.1
tun_cidr: 10.0.0.0/16
db_path: seeker.sqlite # 数据库路径,如果使用相对路径,相对于可执行文件的路径。默认会搜索可执行文件同级目录下的 seeker.sqlite 文件
dns_listens:
  # 如果本机没有其他程序监听 53 端口,可以使用 0.0.0.0
  - 0.0.0.0:53
  # Ubuntu 等新版本的系统默认使用 systemd-resolved,已经监听了 127.0.0.53:53,所以没法直接监听 0.0.0.0:53。
  # 这种情况下可以监听 127.0.0.1:53。如果使用 docker,再监听 172.17.0.1:53。如果局域网内别的机器需要走代理,可以监听
  # 192.168.0.xx:53(本机的局域网 IP)
  - 127.0.0.1:53
  - 172.17.0.1:53
  - 192.168.0.3:53
# 是否支持局域网内其他机器走代理
gateway_mode: false
ping_timeout: 2s
# probe_timeout 时间内如果可以建立 TCP 连接则直连(443端口会额外建立 SSL 连接),否则走代理。不要调的太低,国内有些网站会有很长的 SSL 握手时间。
# 如果目标端口为 443,TCP 连接的超时时间为 probe_timeout, SSL 连接超时时间也为 probe_timeout,总的超时时间为 probe_timeout * 2;
# 如果目标端口不为 443,TCP 连接的超时时间为 probe_timeout。
probe_timeout: 200ms
connect_timeout: 1s
read_timeout: 30s
write_timeout: 5s
# geoip 数据库路径,如果使用相对路径,相对于可执行文件的路径。默认会搜索可执行文件同级目录下的 geoip.mmdb 文件
# 可以从 https://github.com/Hackl0us/GeoIP2-CN 下载 mmdb 格式的文件
geo_ip: geoip.mmdb

max_connect_errors: 2  # ss 服务器重试次数,到达重试次数后会自动选择下一个最快的服务器
ping_urls:
  - host: www.facebook.com
    port: 80
    path: /
  - host: www.youtube.com
    port: 80
    path: /
  - host: twitter.com
    port: 80
    path: /

#remote_config_urls:  # ss 订阅地址,启动时自动拉群配置,并将配置的服务器地址自动加入服务器列表
#  - https://addr-to-ss-subscribe-url

servers:
  - name: socks5 proxy server
    addr: 10.10.10.199:7337
    protocol: Socks5  # Https or Http or Socks5 or Shadowsocks

#  - name: http proxy server
#    addr: domain-or-ip-to-socks5-server:port
#    username: username
#    password: pass
#    protocol: Https  # Https or Http or Socks5 or Shadowsocks
#
#  - name: https proxy server
#    addr: domain-or-ip-to-socks5-server:port
#    username: username
#    password: pass
#    protocol: Https  # Https or Http or Socks5 or Shadowsocks
#
#  - name: server1
#    addr: domain-or-ip-to-ss-server:port
#    method: chacha20-ietf
#    password: password
#    protocol: Shadowsocks
#    obfs:  # 不设置默认不使用 obfs。只有 Shadowsocks 支持 obfs
#      mode: Http  # 目前只支持 Http
#      host: c61be5399e.microsoft.com
#
#  - name: server2
#    addr: domain-or-ip-to-ss-server:port
#    method: chacha20-ietf
#    password: password
#    protocol: Shadowsocks

rules:
  - 'DOMAIN,audio-ssl.itunes.apple.com,DIRECT'
  - 'DOMAIN,gspe1-ssl.ls.apple.com,REJECT'
  - 'DOMAIN-SUFFIX,aaplimg.com,DIRECT'
  - 'DOMAIN-SUFFIX,apple.co,DIRECT'
  - 'DOMAIN-KEYWORD,bbcfmt,PROXY'
  - 'DOMAIN-KEYWORD,uk-live,PROXY'
  - 'DOMAIN-SUFFIX,snssdk.com,DIRECT'
  - 'DOMAIN-SUFFIX,toutiao.com,PROBE'
  - 'IP-CIDR,19.23.212.0/16,PROXY'
  - 'IP-CIDR,19.23.21.0/16,PROBE'
  - 'IP-CIDR,10.10.10.0/24,DIRECT'
  - 'GEOIP,CN,DIRECT'
  - 'MATCH,PROBE'

root [ /home/bhzhu/source/seeker/target/x86_64-unknown-linux-musl/release ]# ./seeker -c seeker.conf Starting....thread 'main' panicked at sysconfig/src/command.rs:12:9: ip route add 19.23.212.0/16 via 10.0.0.1 dev utun stdout: stderr: RTNETLINK answers: Invalid argument

stack backtrace: 0: 0x7ffff6feb55a - 1: 0x7ffff6c332d3 - 2: 0x7ffff6fe3c73 - 3: 0x7ffff6feb3b2 - 4: 0x7ffff6fec3b6 - 5: 0x7ffff6fec200 - 6: 0x7ffff6fec957 - 7: 0x7ffff6fec7fa - 8: 0x7ffff6feba09 - 9: 0x7ffff6fec49c - 10: 0x7ffff6b0bb50 - 11: 0x7ffff700d1dd - 12: 0x7ffff700f318 - 13: 0x7ffff70376e3 - 14: 0x7ffff6f7ae66 - 15: 0x7ffff6ebf003 - 16: 0x7ffff6f95b22 - 17: 0x7ffff6f026d3 - 18: 0x7ffff6f01a1d - 19: 0x7ffff6fdc387 - 20: 0x7ffff6fab49c -

系统没有产生 utun设备 所以执行 ip route失败

ip add 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 3c:06:a7:ce:64:cb brd ff:ff:ff:ff:ff:ff inet 10.10.10.167/24 brd 10.10.10.255 scope global noprefixroute dynamic enp1s0 valid_lft 27079sec preferred_lft 27079sec inet6 fe80::bfe4:a2e3:d528:af5/64 scope link noprefixroute valid_lft forever preferred_lft forever 3: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 00:e0:70:d7:7c:ed brd ff:ff:ff:ff:ff:ff inet 192.168.1.84/24 brd 192.168.1.255 scope global noprefixroute dynamic eno1 valid_lft 243078sec preferred_lft 243078sec inet6 240e:391:c89:a30::c/128 scope global noprefixroute dynamic valid_lft 2575878sec preferred_lft 588678sec inet6 240e:391:c89:a30:2f6e:eceb:a5e3:1a8c/64 scope global noprefixroute dynamic valid_lft 547sec preferred_lft 547sec inet6 fe80::79c0:96a6:e620:87cc/64 scope link noprefixroute valid_lft forever preferred_lft forever

gfreezy commented 2 days ago
tun_name: utun

这里改成

tun_name: utun5

之类的,数字需要自己试一下,看哪个没被占用

bhzhu203 commented 1 day ago
tun_name: utun

这里改成

tun_name: utun5

之类的,数字需要自己试一下,看哪个没被占用

是因为utun5没用 我才改成utun的 都没用

gfreezy commented 23 hours ago

19.23.212.0/16 这个表示法有错误。/16 表示子网掩码,意味着网络前缀长度为16位,即前两个八位组表示网络部分,后两个八位组表示主机部分。因此,正确的网络地址应该是 19.23.0.0/16,而不是 19.23.212.0/16。在 /16 网络中,最后两个八位组(即 212.0 部分)应该是主机地址的一部分,而不是网络地址的一部分。

gfreezy commented 23 hours ago

发了个新版本,会自动处理这个问题

bhzhu203 commented 18 hours ago

1.删除没用配置

rules:
  - 'DOMAIN,audio-ssl.itunes.apple.com,DIRECT'
  - 'DOMAIN,gspe1-ssl.ls.apple.com,REJECT'
  - 'DOMAIN-SUFFIX,aaplimg.com,DIRECT'
  - 'DOMAIN-SUFFIX,apple.co,DIRECT'
  - 'DOMAIN-KEYWORD,bbcfmt,PROXY'
  - 'DOMAIN-KEYWORD,uk-live,PROXY'
  - 'DOMAIN-SUFFIX,snssdk.com,DIRECT'
  - 'DOMAIN-SUFFIX,toutiao.com,PROBE'
#  - 'IP-CIDR,19.23.212.0/16,PROXY'
#  - 'IP-CIDR,19.23.21.0/16,PROBE'
  - 'IP-CIDR,10.10.10.0/24,DIRECT'
  - 'GEOIP,CN,DIRECT'
  - 'MATCH,PROBE'

2.停止系统dns服务器 systemctl stop systemd-resolved

就可以使用了,不过还是有些报错,好像有些端口被占用了:

./seeker -c seeker.conf 
Starting....thread 'async-std/runtime' panicked at ./home/bhzhu/source/seeker/hermesdns/src/dns/server.rs:177:70:
called `Result::unwrap()` on an `Err` value: Os { code: 99, kind: AddrNotAvailable, message: "Address not available" }
stack backtrace:
Started!
   0:     0x7ffff75db52a - <unknown>
   1:     0x7ffff722d4b3 - <unknown>
   2:     0x7ffff75d3c43 - <unknown>
   3:     0x7ffff75db382 - <unknown>
   4:     0x7ffff75dc386 - <unknown>
   5:     0x7ffff75dc1d0 - <unknown>
   6:     0x7ffff75dc927 - <unknown>
   7:     0x7ffff75dc7ca - <unknown>
   8:     0x7ffff75db9d9 - <unknown>
   9:     0x7ffff75dc46c - <unknown>
  10:     0x7ffff710dbc0 - <unknown>
  11:     0x7ffff710dfc6 - <unknown>
  12:     0x7ffff74dd048 - <unknown>
  13:     0x7ffff74bab76 - <unknown>
  14:     0x7ffff7142931 - <unknown>
  15:     0x7ffff713b1b7 - <unknown>
  16:     0x7ffff713b635 - <unknown>
  17:     0x7ffff75e076b - <unknown>
thread 'async-std/runtime' panicked at /home/bhzhu/source/seeker/hermesdns/src/dns/server.rs:177:70:
called `Result::unwrap()` on an `Err` value: Os { code: 99, kind: AddrNotAvailable, message: "Address not available" }
stack backtrace:
   0:     0x7ffff75db52a - <unknown>
   1:     0x7ffff722d4b3 - <unknown>
   2:     0x7ffff75d3c43 - <unknown>
   3:     0x7ffff75db382 - <unknown>
   4:     0x7ffff75dc386 - <unknown>
   5:     0x7ffff75dc1d0 - <unknown>
   6:     0x7ffff75dc927 - <unknown>
   7:     0x7ffff75dc7ca - <unknown>
   8:     0x7ffff75db9d9 - <unknown>
   9:     0x7ffff75dc46c - <unknown>
  10:     0x7ffff710dbc0 - <unknown>
  11:     0x7ffff710dfc6 - <unknown>
  12:     0x7ffff74dd048 - <unknown>
  13:     0x7ffff74bab76 - <unknown>
  14:     0x7ffff7142931 - <unknown>
  15:     0x7ffff713b1b7 - <unknown>
  16:     0x7ffff713b635 - <unknown>
  17:     0x7ffff75e076b - <unknown>
thread 'async-std/runtime' panicked at /home/bhzhu/source/seeker/hermesdns/src/dns/server.rs:177:70:
called `Result::unwrap()` on an `Err` value: Os { code: 98, kind: AddrInUse, message: "Address in use" }
stack backtrace:
   0:     0x7ffff75db52a - <unknown>
   1:     0x7ffff722d4b3 - <unknown>
   2:     0x7ffff75d3c43 - <unknown>
   3:     0x7ffff75db382 - <unknown>
   4:     0x7ffff75dc386 - <unknown>
   5:     0x7ffff75dc1d0 - <unknown>
   6:     0x7ffff75dc927 - <unknown>
   7:     0x7ffff75dc7ca - <unknown>
   8:     0x7ffff75db9d9 - <unknown>
   9:     0x7ffff75dc46c - <unknown>
  10:     0x7ffff710dbc0 - <unknown>
  11:     0x7ffff710dfc6 - <unknown>
  12:     0x7ffff74dd048 - <unknown>
  13:     0x7ffff74bab76 - <unknown>
  14:     0x7ffff7142931 - <unknown>
  15:     0x7ffff713b1b7 - <unknown>
  16:     0x7ffff713b635 - <unknown>
  17:     0x7ffff75e076b - <unknown>
^CStop server. Bye bye...