anchor.diff:                                                {ifaddr, FrontAddress},
                                                 {nodelay, true},
                                                 binary]),
  +    info_new(),
       back_pool_new(BackAddress, BackPort),
       front_accept(Socket, BackAddress, BackPort).
   
  
positive.code:     try
          From = self(),
  
          {ok, Back} = front_get_back(BackAddress, BackPort),
          {ok, Endpoint} = front_socks5_handshake(Client),
          flip_send(Back, Endpoint),
  
          spawn(?MODULE, forward, [Client, Back, From]),
          spawn(?MODULE, forward, [Back, Client, From]),
  
          receive
              {close} ->
                  gen_tcp:close(Client),
                  gen_tcp:close(Back)
          end
      catch
          Error:Reason ->
              io:format("~p ~p ~p ~p.~n", [Client, Error, Reason, erlang:get_stacktrace()]),
              gen_tcp:close(Client)
      end.
  
  back_socks5_handshake(Client) ->
      {ok, <<AType:8>>} = flip_recv(Client, 1),
      case AType of
          ?IPV4 ->
              {ok, <<AddressBin:32, Port:16>>} = flip_recv(Client, 6),
              Address = list_to_tuple(binary_to_list(<<AddressBin:32>>)),
              io:format("~p ~p.~n", [Client, Address]);
          ?DOMAIN ->
              {ok, <<DomainLen:8>>} = flip_recv(Client, 1),
              {ok, DomainBin} = flip_recv(Client, DomainLen),
              Domain = binary_to_list(DomainBin),
              io:format("~p ~p.~n", [Client, Domain]),
              {ok, Address} = inet:getaddr(Domain, inet),
              {ok, <<Port:16>>} = flip_recv(Client, 2)
      end,
      {ok, Remote} = gen_tcp:connect(Address,
                                     Port,
                                     [{active, false}, binary, {nodelay, true}],
                                     ?CONNECT_TIMEOUT),
      {ok, Remote}.
  
  %% 前端完成 socks5 协议的握手，始终立刻返回“成功”。避免二次请求节约时间。
  front_socks5_handshake(Client) ->
      {ok, <<?VERSION:8, Nmethods:8>>} = gen_tcp:recv(Client, 2),
      {ok, _Methods} = gen_tcp:recv(Client, Nmethods),
      ok = gen_tcp:send(Client, <<5, 0>>),
  
      {ok, <<?VERSION:8, ?CONNECT:8, _Rsv:8, AType:8>>} = gen_tcp:recv(Client, 4),
      case AType of
          ?IPV4 ->
              {ok, Address} = gen_tcp:recv(Client, 4),
              {ok, Port} = gen_tcp:recv(Client, 2),
              Endpoint = <<AType:8, Address/binary, Port/binary>>;
          ?DOMAIN ->
              {ok, <<DomainLen:8>>} = gen_tcp:recv(Client, 1),
              {ok, DomainBin} = gen_tcp:recv(Client, DomainLen),
              {ok, Port} = gen_tcp:recv(Client, 2),
              Endpoint = <<AType:8, DomainLen:8, DomainBin/binary, Port/binary>>
      end,
      ok = gen_tcp:send(Client, <<5, 0, 0, 1, 0:32, 0:16 >>),
      {ok, Endpoint}.
  
  start() ->
      spawn(?MODULE, back_start, [['0.0.0.0', '8781']]),
  
negative.code:             end;
          Other ->
              io:format("unexpected message receive ~p.~n", [Other]),
              front_close_back(Back),
              back_pool_waiting(empty, OldPid)
      end.
  
  