This commit is contained in:
anlicheng 2026-02-13 17:52:20 +08:00
parent f45b5e4ed4
commit c820f62a53
7 changed files with 3 additions and 50 deletions

View File

@ -1,19 +0,0 @@
%%%-------------------------------------------------------------------
%%% @author anlicheng
%%% @copyright (C) 2025, <COMPANY>
%%% @doc
%%%
%%% @end
%%% Created : 20. 1 2025 21:35
%%%-------------------------------------------------------------------
-author("anlicheng").
%% ip的使用信息
-record(client, {
client_id :: binary(),
mac :: binary(),
ip :: integer(),
host_name :: binary(),
%%
status = normal :: normal | disabled
}).

View File

@ -22,6 +22,8 @@ init() ->
Path = code:priv_dir(sdlan),
LOptions = #{
addr_family => inet,
% QUIC/TLS证书配置
certfile => Path ++ "/cert.pem",
keyfile => Path ++ "/key.pem",
alpn => Alpn,

View File

@ -17,7 +17,6 @@
dns_erlang,
pkt,
quicer,
mnesia,
erts,
public_key,
ssl,

View File

@ -11,8 +11,6 @@
start(_StartType, _StartArgs) ->
io:setopts([{encoding, unicode}]),
%% mnesia数据库
mnesia:start(),
%%
erlang:system_flag(fullsweep_after, 16),

View File

@ -85,10 +85,8 @@ handle_call(_Request, _From, State = #state{}) ->
{noreply, NewState :: #state{}} |
{noreply, NewState :: #state{}, timeout() | hibernate} |
{stop, Reason :: term(), NewState :: #state{}}).
%% node下的转发
handle_cast({stun_relay, Ip, Port, Reply}, State = #state{socket = Sock}) ->
ok = gen_udp:send(Sock, Ip, Port, Reply),
handle_cast(_Request, State) ->
{noreply, State}.
%% @private
@ -138,12 +136,6 @@ handle_info({udp, Sock, ClientIp, ClientPort, <<?PACKET_STUN_PROBE:8, Body/binar
end,
{noreply, State};
%% , stun_reply的转发通过socket来转发
handle_info({udp, Sock, _, _, <<?PACKET_STUN_PROBE_RELAY:8, Ip0, Ip1, Ip2, Ip3, Port:16, Reply/binary>>}, State = #state{socket = Sock}) ->
logger:debug("[sdlan_stun] get stun_probe_replay request, reply: ~p", [Reply]),
gen_udp:send(Sock, {Ip0, Ip1, Ip2, Ip3}, Port, Reply),
{noreply, State};
handle_info({udp, _, _Ip, _Port, <<?PACKET_STUN_DATA, Body/binary>>}, State = #state{socket = Sock}) ->
Data = catch sdlan_pb:decode_msg(Body, sdl_data),
maybe

View File

@ -58,7 +58,6 @@ init([]) ->
{ok, Socket} = gen_udp:open(0, Opts),
inet_udp:controlling_process(Socket, self()),
logger:debug("[sdlan_stun_peer_assist] started"),
{ok, #state{socket = Socket, assist_ip = AssistIp, assist_port = AssistPort}}.
%% @private

View File

@ -1,18 +0,0 @@
%%%-------------------------------------------------------------------
%%% @author anlicheng
%%% @copyright (C) 2024, <COMPANY>
%%% @doc
%%%
%%% @end
%%% Created : 09. 3 2024 15:25
%%%-------------------------------------------------------------------
-module(sdlan_test).
-author("anlicheng").
%% API
-export([test/1]).
test(X) when X band 1 == 0 ->
ok;
test(_) ->
error.