Skip to content
Ery Lee edited this page Mar 15, 2015 · 3 revisions

Overview

Same to nginx allow/deny syntax.

allow address | CIDR | all;

deny address | CIDR | all;

Allow/Deny by options:

esockd:open(echo, 5000, [
    {access, [{deny, "192.168.1.1"},
              {allow, "192.168.1.0/24"},
              {deny, all}]}
]).

Allow/Deny by API:

allow/deny by API:

esockd:deny({echo, 5000}, all).
esockd:allow({echo, 5000}, "192.168.0.1/24").
esockd:deny({echo, 5000}, "192.168.1.1").

esockd_access.erl

-spec match(inet:ip_address(), [range_rule()]) -> {matched, allow} | {matched, deny} | nomatch.
match(Addr, Rules)