Skip to content

Commit 6f04a62

Browse files
authored
example fix
1 parent 04f43a9 commit 6f04a62

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
```cpp
66
// announce callbacks:
7-
callback<udp_callback_t> udp_callback;
7+
ep::callback<udp_callback_t> udp_callback;
88

99
// install detour functions:
10-
udp_callback.install([&](client* person, unsigned int& source_ip, unsigned int& dest_ip, unsigned short& source_port, unsigned short& dest_port, proxys::data* buf) -> bool {
11-
printf("[%s -> %s | %d -> %d] length: %d\n\n", utils::dip_to_strip(source_ip).c_str(), utils::dip_to_strip(dest_ip).c_str(), source_port, dest_port, buf->length);
10+
udp_callback.install([&](ep::client* person, unsigned int& source_ip, unsigned int& dest_ip, unsigned short& source_port, unsigned short& dest_port, ep::buffer* buf) -> bool {
11+
printf("[%s -> %s | %d -> %d] length: %d\n\n", ep::utils::dip_to_strip(source_ip).c_str(), ep::utils::dip_to_strip(dest_ip).c_str(), source_port, dest_port, buf->length);
1212
return true;
1313
});
1414

1515
// enable callbacks treatment:
16-
server.callback_enable(proxys::callback_udp, &udp_callback);
16+
proxy.callback_enable(ep::callback_t::udp, &udp_callback);
1717
```
1818
###### due to the peculiarities of the TCP/IP protocol, the dest IP and port cannot be changed on the go, because of this, the TCP callback has a different structure: ```(client* person, std::string source_ip, std::string dest_ip, proxys::data* buf)```
1919
###### one-header solution available in "one-header" branch

0 commit comments

Comments
 (0)