Skip to content

Host not found (authoritative) #107

Description

@DD-L

lssserver.exe:

2016-Apr-09 12:06:07.268711 [DEBUG] start socks5_request_processing...  [tid:7f0723367780] session_server.cpp:274 left_read_handler
2016-Apr-09 12:06:07.268715 [DEBUG] lproxy::socks5::req::AddrType = domain  [tid:7f0723367780] session_server.cpp:943 socks5_request_processing
2016-Apr-09 12:06:07.268734 [DEBUG] lproxy::socks5::req::Addr.domain = cn.bing.com  [tid:7f0723367780] session_server.cpp:949 socks5_request_processing
2016-Apr-09 12:06:07.268739 [DEBUG] lproxy::socks5::req::Port = 80  [tid:7f0723367780] session_server.cpp:973 socks5_request_processing
2016-Apr-09 12:06:07.268754 [DEBUG] lproxy::socks5::req::Cmd = TCP-CONNECT  [tid:7f0723367780] session_server.cpp:977 socks5_request_processing
2016-Apr-09 12:06:07.268842 [DEBUG] start async_read local...   [tid:7f0723367780] session_server.cpp:287 left_read_handler
2016-Apr-09 12:06:07.269290 [ WARN] Host not found (authoritative)  [tid:7f0721935700] session_server.cpp:1106 tcp_resolve_handler

在 deel/lproxy-dev 里运行的好好的,到了基于 docker.io/busybox 制作的镜像的容器中,就会报上面的那个问题,导致 lproxy 服务不可用。

网搜查到几个可能有帮助的链接:

  1. http://stackoverflow.com/questions/12542460/boost-asio-host-not-found-authorative
  2. http://stackoverflow.com/questions/5971242/how-does-boost-asios-hostname-resolution-work-on-linux-is-it-possible-to-use-n

摘录下来就是

The problem was that the constructor for query has the address_configured flag set by default which won't return an address if the loopback device is the only device with an address. By just settings flags to 0 or anything other than address_configured the problem is fixed. Here is what I'm successfully using now:
tcp::resolver::query query(host, PORT, boost::asio::ip::resolver_query_base::numeric_service);

查了下文档:

http://www.boost.org/doc/libs/1_60_0/doc/html/boost_asio/reference/ip__resolver_query_base.html#boost_asio.reference.ip__resolver_query_base.data_members

Name Description
address_configured Only return IPv4 addresses if a non-loopback IPv4 address is configured for the system. Only return IPv6 addresses if a non-loopback IPv6 address is configured for the system.
all_matching If used with v4_mapped, return all matching IPv6 and IPv4 addresses.
canonical_name Determine the canonical name of the host specified in the query.
numeric_host Host name should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted.
numeric_service Service name should be treated as a numeric string defining a port number and no name resolution should be attempted.
passive Indicate that returned endpoint is intended for use as a locally bound socket endpoint.
v4_mapped If the query protocol family is specified as IPv6, return IPv4-mapped IPv6 addresses on finding no IPv6 addresses.

记录下来,以便查阅

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions