diff --git a/config/sys-dev.config b/config/sys-dev.config index ead4a42..6c945f2 100644 --- a/config/sys-dev.config +++ b/config/sys-dev.config @@ -67,7 +67,7 @@ {mysql_sdlan, [{size, 10}, {max_overflow, 20}, {worker_module, mysql}], [ - {host, {118, 178, 229, 213}}, + {host, {47, 111, 101, 3}}, {port, 3306}, {user, "punchnetuser"}, {connect_mode, lazy}, @@ -79,8 +79,8 @@ } ]}, - {api_url, "http://127.0.0.1:18082/test/"} - + %{api_url, "http://127.0.0.1:18082/test/"} + {api_url, "https://test.punchsky.com/api/"} ]}, {throttle, [ diff --git a/src/http/node_handler.erl b/src/http/node_handler.erl index 0076fb7..b9171af 100644 --- a/src/http/node_handler.erl +++ b/src/http/node_handler.erl @@ -28,7 +28,7 @@ handle_request("POST", "/node/acl_changed", _, #{<<"network_id">> := NetworkId, undefined -> {ok, 200, sdlan_util:json_error(-1, <<"network not found">>)}; Pid -> - case sdlan_network:acl_changed(Pid, ClientId) of + case sdlan_network:exposed_service_changed(Pid, ClientId) of ok -> {ok, 200, sdlan_util:json_data(<<"success">>)}; {error, Reason} -> diff --git a/src/sdlan_network.erl b/src/sdlan_network.erl index 5d7346b..680435e 100644 --- a/src/sdlan_network.erl +++ b/src/sdlan_network.erl @@ -20,7 +20,7 @@ %% API -export([start_link/2]). -export([get_name/1, get_pid/1, lookup_pid/1, peer_info/3, unregister/3, debug_info/1, get_network_id/1, attach/7, arp_request/2]). --export([forward_by_ets/5, update_hole/7, disable_client/2, get_channel/2, acl_changed/2]). +-export([forward_by_ets/5, update_hole/7, disable_client/2, get_channel/2, exposed_service_changed/2]). -export([command/4, wait_command_ack/2]). %% gen_server callbacks @@ -155,9 +155,9 @@ update_hole(Pid, SessionToken, ClientId, Mac, Peer, NatType, V6Info) when is_pid disable_client(Pid, ClientId) when is_pid(Pid), is_binary(ClientId) -> gen_server:call(Pid, {disable_client, ClientId}). --spec acl_changed(Pid :: pid(), ClientId :: binary()) -> ok | {error, Reason :: binary()}. -acl_changed(Pid, ClientId) when is_pid(Pid), is_binary(ClientId) -> - gen_server:call(Pid, {acl_changed, ClientId}). +-spec exposed_service_changed(Pid :: pid(), ClientId :: binary()) -> ok | {error, Reason :: binary()}. +exposed_service_changed(Pid, ClientId) when is_pid(Pid), is_binary(ClientId) -> + gen_server:call(Pid, {exposed_service_changed, ClientId}). -spec get_channel(Pid :: pid(), ClientId :: binary()) -> error | {ok, ChannelPid :: pid()}. get_channel(Pid, ClientId) when is_pid(Pid), is_binary(ClientId) -> @@ -300,7 +300,7 @@ handle_call({peer_info, SrcMac, DstMac}, _From, State = #state{endpoint_table = handle_call({arp_request, TargetIp}, _From, State = #state{endpoint_table = EndpointTable}) -> MatchSpec = ets:fun2ms(fun(Object = {_Mac, #endpoint{ip = Ip}}) when Ip =:= TargetIp -> Object - end), + end), case select_endpoint(EndpointTable, MatchSpec) of error -> {reply, error, State}; @@ -323,7 +323,7 @@ handle_call({command, ReceiverPid, ClientId, SubCommand}, _From, State = #state{ end; %% 触发acl改变 -handle_call({acl_changed, ClientId}, _From, State = #state{endpoint_table = EndpointTable}) -> +handle_call({exposed_service_changed, ClientId}, _From, State = #state{endpoint_table = EndpointTable}) -> MatchSpec = ets:fun2ms(fun(Object = {_Mac, #endpoint{client_id = ClientId0}}) when ClientId0 =:= ClientId -> Object end),