• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

emqx / esockd / 396

08 Jul 2024 10:56AM UTC coverage: 69.194%. First build
396

Pull #188

github

web-flow
Merge 9c2399c81 into 313713eff
Pull Request #188: feat: add content-sensitive proxy behaviour for UDP

0 of 72 new or added lines in 3 files covered. (0.0%)

867 of 1253 relevant lines covered (69.19%)

59.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/udp_proxy/esockd_udp_proxy_connection.erl
1
%%--------------------------------------------------------------------
2
%% Copyright (c) 2024 EMQ Technologies Co., Ltd. All Rights Reserved.
3
%%
4
%% Licensed under the Apache License, Version 2.0 (the "License");
5
%% you may not use this file except in compliance with the License.
6
%% You may obtain a copy of the License at
7
%%
8
%%     http://www.apache.org/licenses/LICENSE-2.0
9
%%
10
%% Unless required by applicable law or agreed to in writing, software
11
%% distributed under the License is distributed on an "AS IS" BASIS,
12
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
%% See the License for the specific language governing permissions and
14
%% limitations under the License.
15
%%--------------------------------------------------------------------
16

17
-module(esockd_udp_proxy_connection).
18

19
-include("include/esockd_proxy.hrl").
20

21
-export([
22
    initialize/2,
23
    create/4,
24
    get_connection_id_result/6,
25
    dispatch/4,
26
    close/3
27
]).
28

29
-export_type([connection_id/0, connection_module/0]).
30

31
%%--------------------------------------------------------------------
32
%%- Callbacks
33
%%--------------------------------------------------------------------
34
-callback initialize(connection_options()) -> connection_state().
35

36
%% Create new connection
37
-callback create(transport(), peer(), connection_options()) -> gen_server:start_ret().
38

39
%% Find routing information
40
-callback get_connection_id(
41
    pid(), transport(), peer(), socket(), connection_state(), socket_packet()
42
) ->
43
    get_connection_id_result().
44

45
%% Dispacth message
46
-callback dispatch(pid(), connection_state(), proxy_packet()) -> ok.
47

48
%% Close Connection
49
-callback close(pid(), connection_state()) -> ok.
50

51
%%--------------------------------------------------------------------
52
%%- API
53
%%--------------------------------------------------------------------
54
initialize(Mod, Opts) ->
NEW
55
    Mod:initialize(Opts).
×
56

57
create(Mod, Transport, Peer, Opts) ->
NEW
58
    Mod:create(Transport, Peer, Opts).
×
59

60
get_connection_id_result(Mod, Transport, Peer, Socket, State, Data) ->
NEW
61
    Mod:get_connection_id_result(Transport, Peer, Socket, State, Data).
×
62

63
dispatch(Mod, Pid, State, Packet) ->
NEW
64
    Mod:dispatch(Pid, State, Packet).
×
65

66
close(Mod, Pid, State) ->
NEW
67
    Mod:close(Pid, State).
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc