Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
erlang
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
erlang
Commits
2b24b366
Unverified
Commit
2b24b366
authored
Feb 16, 2019
by
Сергей Прохоров
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgrade ranch to 1.7
parent
9d7903e8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
13 deletions
+13
-13
rebar.config
rebar.config
+1
-1
rebar.lock
rebar.lock
+2
-2
mtp_handler.erl
src/mtp_handler.erl
+6
-6
mtproto_proxy_app.erl
src/mtproto_proxy_app.erl
+4
-4
No files found.
rebar.config
View file @
2b24b366
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
{
erl_opts
, [
debug_info
,
{
erl_opts
, [
debug_info
,
{
parse_transform
,
lager_transform
}]}.
{
parse_transform
,
lager_transform
}]}.
{
deps
, [{
ranch
,
"1.
5
.0"
},
{
deps
, [{
ranch
,
"1.
7
.0"
},
{
lager
,
"3.6.3"
}
{
lager
,
"3.6.3"
}
]}.
]}.
...
...
rebar.lock
View file @
2b24b366
{"1.1.0",
{"1.1.0",
[{<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},1},
[{<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},1},
{<<"lager">>,{pkg,<<"lager">>,<<"3.6.3">>},0},
{<<"lager">>,{pkg,<<"lager">>,<<"3.6.3">>},0},
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.
5
.0">>},0}]}.
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.
7
.0">>},0}]}.
[
[
{pkg_hash,[
{pkg_hash,[
{<<"goldrush">>, <<"F06E5D5F1277DA5C413E84D5A2924174182FB108DABB39D5EC548B27424CD106">>},
{<<"goldrush">>, <<"F06E5D5F1277DA5C413E84D5A2924174182FB108DABB39D5EC548B27424CD106">>},
{<<"lager">>, <<"FE78951D174616273F87F0DBC3374D1430B1952E5EFC4E1C995592D30A207294">>},
{<<"lager">>, <<"FE78951D174616273F87F0DBC3374D1430B1952E5EFC4E1C995592D30A207294">>},
{<<"ranch">>, <<"
F04166F456790FEE2AC1AA05A02745CC75783C2BFB26D39FAF6AEFC9A3D3A58A
">>}]}
{<<"ranch">>, <<"
9583F47160CA62AF7F8D5DB11454068EAA32B56EEADF984D4F46E61A076DF5F2
">>}]}
].
].
src/mtp_handler.erl
View file @
2b24b366
...
@@ -49,8 +49,8 @@
...
@@ -49,8 +49,8 @@
%% APIs
%% APIs
start_link
(
Ref
,
Socket
,
Transport
,
Opts
)
->
start_link
(
Ref
,
_
Socket
,
Transport
,
Opts
)
->
{
ok
,
proc_lib
:
spawn_link
(
?
MODULE
,
ranch_init
,
[{
Ref
,
Socket
,
Transport
,
Opts
}])}.
{
ok
,
proc_lib
:
spawn_link
(
?
MODULE
,
ranch_init
,
[{
Ref
,
Transport
,
Opts
}])}.
keys_str
()
->
keys_str
()
->
[{
Name
,
Port
,
hex
(
Secret
)}
[{
Name
,
Port
,
hex
(
Secret
)}
...
@@ -59,10 +59,10 @@ keys_str() ->
...
@@ -59,10 +59,10 @@ keys_str() ->
%% Callbacks
%% Callbacks
%% Custom gen_server init
%% Custom gen_server init
ranch_init
({
Ref
,
Socket
,
Transport
,
_}
=
Opts
)
->
ranch_init
({
Ref
,
Transport
,
Opts
})
->
case
init
(
Opts
)
of
{
ok
,
Socket
}
=
ranch
:
handshake
(
Ref
),
case
init
({
Socket
,
Transport
,
Opts
})
of
{
ok
,
State
}
->
{
ok
,
State
}
->
ok
=
ranch
:
accept_ack
(
Ref
),
BufSize
=
application
:
get_env
(
?
APP
,
upstream_socket_buffer_size
,
BufSize
=
application
:
get_env
(
?
APP
,
upstream_socket_buffer_size
,
?
MAX_SOCK_BUF_SIZE
),
?
MAX_SOCK_BUF_SIZE
),
ok
=
Transport
:
setopts
(
ok
=
Transport
:
setopts
(
...
@@ -78,7 +78,7 @@ ranch_init({Ref, Socket, Transport, _} = Opts) ->
...
@@ -78,7 +78,7 @@ ranch_init({Ref, Socket, Transport, _} = Opts) ->
exit
(
normal
)
exit
(
normal
)
end
.
end
.
init
({
_
Ref
,
Socket
,
Transport
,
[
Name
,
Secret
,
Tag
]})
->
init
({
Socket
,
Transport
,
[
Name
,
Secret
,
Tag
]})
->
mtp_metric
:
set_context_labels
([
Name
]),
mtp_metric
:
set_context_labels
([
Name
]),
mtp_metric
:
count_inc
([
?
APP
,
in_connection
,
total
],
1
,
#
{}),
mtp_metric
:
count_inc
([
?
APP
,
in_connection
,
total
],
1
,
#
{}),
case
Transport
:
peername
(
Socket
)
of
case
Transport
:
peername
(
Socket
)
of
...
...
src/mtproto_proxy_app.erl
View file @
2b24b366
...
@@ -40,10 +40,10 @@ start_proxy(#{name := Name, port := Port, secret := Secret, tag := Tag} = P) ->
...
@@ -40,10 +40,10 @@ start_proxy(#{name := Name, port := Port, secret := Secret, tag := Tag} = P) ->
Res
=
Res
=
ranch
:
start_listener
(
ranch
:
start_listener
(
Name
,
ranch_tcp
,
Name
,
ranch_tcp
,
[{
ip
,
ListenIp
},
#
{
socket_opts
=>
[{
ip
,
ListenIp
},
{
port
,
Port
}
,
{
port
,
Port
}]
,
{
num_acceptors
,
NumAcceptors
}
,
num_acceptors
=>
NumAcceptors
,
{
max_connections
,
MaxConnections
}]
,
max_connections
=>
MaxConnections
}
,
mtp_handler
,
[
Name
,
Secret
,
Tag
]),
mtp_handler
,
[
Name
,
Secret
,
Tag
]),
Url
=
io_lib
:
format
(
Url
=
io_lib
:
format
(
"https://t.me/proxy?server=
~s
&port=
~w
&secret=
~s
"
,
"https://t.me/proxy?server=
~s
&port=
~w
&secret=
~s
"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment