anchor.diff:                  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.
  -
  -
  -start() ->
  -    spawn(?MODULE, back_start, []),
  -    spawn(?MODULE, front_start, []),
  -    receive
  -        {close} ->
  -            exit({done})
       end.
   
   socks5_handshake(Client) ->
  
positive.code:                 gen_tcp:close(Remote)
          end
      catch
          _:_ ->
              gen_tcp:close(Front)
      end.
  
  
  %% front，与back连接采用自定义协议，与客户端连接采用socks5
  %% client -- front，socks5 接收
  %% front -- back，Flip
  %% back -- front，Flip
  %% front -- client，Raw
  front_start() ->
      {ok, Socket} = gen_tcp:listen(?FRONT_PORT, [{reuseaddr, true},
                                                  {active, false},
                                                  binary]),
      front_accept(Socket).
  
  front_accept(Socket) ->
      {ok, Client} = gen_tcp:accept(Socket),
      spawn(?MODULE, front_process, [Client]),
      front_accept(Socket).
  
  front_process(Client) ->
      try
          From = self(),
  
          {ok, Back} = gen_tcp:connect("127.0.0.1", ?BACK_PORT, [{active, false},
                                                                   binary]),
          flip_send(Back, <<"abcd1234">>),
          {ok, <<"ok">>} = flip_recv(Back, 2),
  
          spawn(?MODULE, forward, [flip_send, Client, Back, From]),
          spawn(?MODULE, forward, [flip_recv, Back, Client, From]),
  
          receive
              {close} ->
  
negative.code:             {ok, Address} = inet:getaddr(Domain, inet),
              {ok, <<Port:16>>} = flip_recv(Client, 2)
      end,
      {ok, Remote} = gen_tcp:connect(Address,
                                     Port,
                                     [{active, false}, binary],
                                     ?CONNECT_TIMEOUT),
      ok = flip_send(Client, <<5, 0, 0, 1, 0:32, 0:16 >>),
      {ok, Remote}.
  
  start() ->
      spawn(?MODULE, back_start, [['0.0.0.0', '8781']]),
      spawn(?MODULE, front_start, [['127.0.0.1', '8781', '127.0.0.1', '8780']]),
      receive
          {close} ->
              exit({done})
      end.
  