header(ProxyInfo) -> header(ProxyInfo, #{})
header(ProxyInfo, BuildOpts) -> iodata()
ProxyInfo :: ranch_proxy_header:proxy_info()
BuildOpts :: #{
checksum => crc32c,
padding => pos_integer() %% >= 3
}
ranch_proxy_header:header - Build a PROXY protocol header
header(ProxyInfo) -> header(ProxyInfo, #{})
header(ProxyInfo, BuildOpts) -> iodata()
ProxyInfo :: ranch_proxy_header:proxy_info()
BuildOpts :: #{
checksum => crc32c,
padding => pos_integer() %% >= 3
}
Build a PROXY protocol header.
The proxy information to encode.
Options to control whether to add a checksum or padding should be included in the encoded PROXY protocol header.
The PROXY protocol header is returned.
ProxyInfo = #{
version => 2,
command => proxy,
transport_family => ipv4,
transport_protocol => stream,
src_address => {192, 168, 1, 11},
src_port => 54321,
dest_address => {192, 168, 1, 42},
dest_port => 443
},
Data = ranch_proxy_header:parse(ProxyInfo).
Data = ranch_proxy_header:parse(ProxyInfo, #{
checksum => crc32c,
padding => 7
}).
Donate to Loïc Hoguin because his work on Cowboy, Ranch, Gun and Erlang.mk is fantastic:
Recurring payment options are also available via GitHub Sponsors. These funds are used to cover the recurring expenses like food, dedicated servers or domain names.