heiher / hev-socks5-server

A high-performance socks5 server for Unix (Linux/Android/BSD/macOS)
MIT License
185 stars 33 forks source link

macOS error: socks5 proxy addr #19

Closed AiziChen closed 3 years ago

AiziChen commented 3 years ago

在macOS平台上编译并运行,会提示:"[E] socks5 proxy addr" 我用perror函数打印这个错误,会显示:Protocol not supported 我将ai_protocol设为0,错误同样还在。

6869847A-2440-49C5-AB49-1A103ECBF189

heiher commented 3 years ago

贴下配置文件的内容。

AiziChen commented 3 years ago
main:
  # Worker threads
  workers: 4
  # Listen port
  port: 1081
  # Listen address (ipv4|ipv6)
  listen-address: '::'

auth:
  username: quanye
  password: quanyec

misc:
   # task stack size (bytes)
  task-stack-size: 8192
   # connect timeout (ms)
  connect-timeout: 5000
   # read-write timeout (ms)
  read-write-timeout: 60000
   # stdout, stderr or file-path
  log-file: stderr
   # debug, info, warn or error
  log-level: debug
   # If present, run as a daemon with this pid file
#  pid-file: /run/hev-socks5-server.pid
   # If present, set rlimit nofile; else use default value
  limit-nofile: 1024

我试了下把listen-address的值改成'0.0.0.0'也不行。不知道是哪里的问题。

heiher commented 3 years ago

hev_task_dns_getaddrinfo 返回没有传递 errno,请去掉 hev_task_dns_ 前辍再用 perror 输出一下原始错误。

AiziChen commented 3 years ago

去掉 hev_task_dns_ 前辍后能正常运行了。

heiher commented 3 years ago

这就很奇怪了,我这目前没有Mac系统来调试,刚才在FreeBSD上测试没有发现问题。 :confused:

AiziChen commented 3 years ago

我把hev-task-system/src/lib/dns/hev-task-dns-proxy.c文件里面的SOCK_SEQPACKET改成SOCK_STREAM就可以了。 macOS似乎不支持SOCK_SEQPACKETAF_UNIX一起用。 https://stackoverflow.com/questions/13287333/sock-seqpacket-availability

heiher commented 3 years ago

Nice! 使用SOCK_STREAM有风险,试试 AF_INET + SOCK_SEQPACKET 吧,看看行不行?

heiher commented 3 years ago

MacOS内核似乎就不支持 SOCK_SEQPACKET。好吧,我再换个实现方式。

AiziChen commented 3 years ago

对,man socket后看到只支持以下三种:

SOCK_STREAM
SOCK_DGRAM
SOCK_RAW

好的。

heiher commented 3 years ago

我尝试对问题进行了修复 2.2.4,由于缺少设备,无法验证,请再次确认。

感谢您的反馈与帮助!

AiziChen commented 3 years ago

感谢,已经解决!